The 24-byte nonce makes random nonce generation safe for virtually unlimited
encryptions under the same key (~2^96 nonce space vs 2^48 for 12-byte).
This is the recommended symmetric cipher for most use cases.
Parameters
data: Uint8Array
Binary data to encrypt.
key: Uint8Array
32-byte encryption key.
Returns {ciphertext:Uint8Array;nonce:Uint8Array}
Object containing ciphertext (with 16-byte tag) and 24-byte nonce.
Encrypt binary data with XChaCha20-Poly1305.
The 24-byte nonce makes random nonce generation safe for virtually unlimited encryptions under the same key (~2^96 nonce space vs 2^48 for 12-byte). This is the recommended symmetric cipher for most use cases.