Package net.voidnote
Class VoidNote
java.lang.Object
net.voidnote.VoidNote
Official Java SDK for VoidNote.
Zero-knowledge self-destructing notes and live encrypted streams. The key lives in the link. We never see it.
Requires Java 17+. The only external dependency is Gson for JSON.
// Read a note
ReadResult note = VoidNote.read("https://voidnote.net/note/<token>");
System.out.println(note.content());
// Create a note (destroyed after 1 read)
CreateResult created = VoidNote.create(
"launch codes: 4-8-15-16-23-42",
CreateOptions.of("vn_...").withMaxViews(1));
System.out.println(created.url());
// Live encrypted stream
StreamHandle stream = VoidNote.createStream(StreamOptions.of("vn_..."));
System.out.println("share: " + stream.url);
stream.write("Deployment starting...");
stream.write("All 47 tests passed");
stream.close();
-
Method Summary
Modifier and TypeMethodDescriptionstatic CreateResultcreate(String content, CreateOptions opts) Encryptscontentclient-side and creates a self-destructing note.static CryptoOrdercreateCryptoOrder(String apiKey, String bundleId, String chain, String token) Creates a crypto payment order.static StreamHandlecreateStream(StreamOptions opts) Opens a live encrypted stream.static ReadResultFetches and decrypts a VoidNote.static ReadResultLikeread(java.lang.String)but with a custom API base URL (for self-hosted instances).static SubmitPaymentResultsubmitCryptoPayment(String apiKey, String orderId, String txHash) Submits a completed on-chain transaction for verification.static voidWatches a stream, callingonMessagefor each decrypted event.
-
Method Details
-
read
Fetches and decrypts a VoidNote.- Parameters:
urlOrToken- Full URL (https://voidnote.net/note/<token>) or raw 64-char hex token.- Throws:
VoidNoteException
-
readFrom
Likeread(java.lang.String)but with a custom API base URL (for self-hosted instances).- Throws:
VoidNoteException
-
create
Encryptscontentclient-side and creates a self-destructing note.- Parameters:
content- The secret plaintext to protect.opts- Options including the required API key.- Throws:
VoidNoteException
-
createStream
Opens a live encrypted stream.- Parameters:
opts- Options including the required API key.- Returns:
- A
StreamHandle— sharehandle.urlwith viewers before writing. - Throws:
VoidNoteException
-
watch
Watches a stream, callingonMessagefor each decrypted event. Blocks until the stream is closed. Auto-reconnects on drop.- Parameters:
urlOrToken- Full stream URL or raw 64-char hex token.onMessage- Called with decrypted plaintext for each incoming message.- Throws:
VoidNoteException
-
createCryptoOrder
public static CryptoOrder createCryptoOrder(String apiKey, String bundleId, String chain, String token) throws VoidNoteException Creates a crypto payment order. Returns addressing details for the on-chain transfer.Supported bundles:
"test"($1/20 notes),"starter"($5/100),"standard"($20/500),"pro"($35/1000).Supported chains:
"polygon","base","arbitrum","ethereum","bitcoin","tron".Supported tokens depend on chain — stablecoins (
"USDT","USDC"), native ("ETH","BTC","TRX").- Parameters:
apiKey- Your API key (vn_...).bundleId- One of:"test","starter","standard","pro".chain- Target chain.token- Token to pay with.- Returns:
- A
CryptoOrdercontaining the recipient address and exact amount. - Throws:
VoidNoteException
-
submitCryptoPayment
public static SubmitPaymentResult submitCryptoPayment(String apiKey, String orderId, String txHash) throws VoidNoteException Submits a completed on-chain transaction for verification. If valid, credits are added to your account immediately.- Parameters:
apiKey- Your API key (vn_...).orderId- The order ID returned bycreateCryptoOrder(java.lang.String, java.lang.String, java.lang.String, java.lang.String).txHash- The on-chain transaction hash / txid.- Returns:
- A
SubmitPaymentResultwith the updated credit balance. - Throws:
VoidNoteException
-