Encrypt binary data with XChaCha20-Poly1305, returning a single packed buffer.
Output format: nonce(24) || ciphertext. Convenient for storage or transmission where a single blob is preferred.
nonce(24) || ciphertext
Binary data to encrypt.
32-byte encryption key.
Single Uint8Array with nonce prepended to ciphertext.
Uint8Array
If key is not exactly 32 bytes.
key
const packed = xchachaEncryptPacked(data, key);const plaintext = xchachaDecryptPacked(packed, key); Copy
const packed = xchachaEncryptPacked(data, key);const plaintext = xchachaDecryptPacked(packed, key);
Encrypt binary data with XChaCha20-Poly1305, returning a single packed buffer.
Output format:
nonce(24) || ciphertext. Convenient for storage or transmission where a single blob is preferred.