Create a TransformStream that encrypts data with XChaCha20-Poly1305.
Accumulates all input chunks, then on flush encrypts the combined plaintext and emits nonce (24 B) || ciphertext || tag (16 B).
nonce (24 B) || ciphertext || tag (16 B)
Encryption options containing the 256-bit key.
A TransformStream that accepts Uint8Array chunks and emits encrypted output.
const key = "aa".repeat(32);const stream = createEncryptStream({ key });const writer = stream.writable.getWriter();await writer.write(new Uint8Array([1, 2, 3]));await writer.close(); Copy
const key = "aa".repeat(32);const stream = createEncryptStream({ key });const writer = stream.writable.getWriter();await writer.write(new Uint8Array([1, 2, 3]));await writer.close();
Create a TransformStream that encrypts data with XChaCha20-Poly1305.
Accumulates all input chunks, then on flush encrypts the combined plaintext and emits
nonce (24 B) || ciphertext || tag (16 B).