Crypto Lib
    Preparing search index...

    Function createDecryptStream

    • Create a TransformStream that decrypts XChaCha20-Poly1305 data.

      Accumulates all input chunks (expecting nonce || ciphertext || tag), then on flush decrypts and emits the plaintext.

      Parameters

      Returns TransformStream<unknown>

      A TransformStream that accepts encrypted Uint8Array chunks and emits plaintext.

      const key = "aa".repeat(32);
      const stream = createDecryptStream({ key });
      const writer = stream.writable.getWriter();
      await writer.write(ciphertext);
      await writer.close();