/** * AES-128-GCM-SIV / AES-256-GCM-SIV (RFC 8452). Nonce-misuse-resistant * authenticated AEAD with a 128-bit tag. AES-192 keys are rejected * (RFC 8452 §6, no AES-192-GCM-SIV variant exists). * * Single-shot only: each `seal` / `open` call processes one complete * message bounded by 64 KiB of plaintext. Larger messages are out of * scope for this primitive; a future streaming variant will lift the * cap via the seal/sealstream layer. * * `seal(nonce, plaintext, aad?)` returns `ciphertext || tag` (length * pt.length + 16). `open(nonce, sealed, aad?)` verifies the tag and * returns the plaintext; throws `AuthenticationError('siv')` on any * verification failure. * * Atomic, does not hold exclusive access between calls. `dispose()` * wipes the stored key from the JS-side cache. */ export declare class AESGCMSIV { private readonly _key; private _disposed; /** * @param key 16 bytes (AES-128-GCM-SIV) or 32 bytes (AES-256-GCM-SIV). * 24-byte keys are rejected, RFC 8452 §6 does not define * an AES-192-GCM-SIV variant. */ constructor(key: Uint8Array); /** * Authenticated encryption. * * @param nonce exactly 12 bytes (RFC 8452 §6 fixes nonce length) * @param plaintext any length up to 64 KiB; may be empty * @param aad any length up to 64 KiB; may be empty * @returns ciphertext concatenated with the 128-bit tag * (length = plaintext.length + 16) * * @throws RangeError if any input length violates the spec or the * buffer-bounded API. */ seal(nonce: Uint8Array, plaintext: Uint8Array, aad?: Uint8Array): Uint8Array; /** * Authenticated decryption. `sealed` is the output of a matching * `seal(nonce, plaintext, aad)` call. * * Verification routes through `constantTimeEqual` from * `../utils.js` (the dedicated `ct` WASM module). On mismatch the * WASM `sivWipeOnFail` helper zeroes the decrypted-but- * unauthenticated plaintext at CHUNK_PT_OFFSET before this method * throws, the bytes never become reachable from JS. * * @throws AuthenticationError('siv') if the tag fails to verify, or * if `sealed` is too short, or any input length violates the * spec. */ open(nonce: Uint8Array, sealed: Uint8Array, aad?: Uint8Array): Uint8Array; /** * Wipe the in-memory copy of the key. Idempotent. Subsequent calls * to `seal` / `open` throw. WASM-side state is wiped at the end of * every successful operation regardless of `dispose()`. */ dispose(): void; private _mem; private _assertAlive; private _validate; /** Push KGK + nonce + AAD into WASM memory. Common to seal/open. */ private _stage; }