Encrypt binary data with AES-256-GCM, returning a single packed buffer.
Output format: nonce(12) || ciphertext. This is the convention used by the triangle-js-sdks session encryption and mark3t file encryption.
nonce(12) || ciphertext
Binary data to encrypt.
32-byte AES-256 key.
Single Uint8Array with nonce prepended to ciphertext.
Uint8Array
If key is not exactly 32 bytes.
key
const packed = aesGcmEncryptPacked(data, key);const plaintext = aesGcmDecryptPacked(packed, key); Copy
const packed = aesGcmEncryptPacked(data, key);const plaintext = aesGcmDecryptPacked(packed, key);
Encrypt binary data with AES-256-GCM, returning a single packed buffer.
Output format:
nonce(12) || ciphertext. This is the convention used by the triangle-js-sdks session encryption and mark3t file encryption.