/** * AES-256-GCM encrypt/decrypt matching the Rust `DiskDumper` envelope format. * * On-disk format (mirrors `edge-client/src/buffer/disk_dump.rs`): * ``` * [KEY_VERSION: 1 byte][nonce: 12 bytes][ciphertext + GCM auth tag: 16 bytes appended] * ``` * * The Rust `aes-gcm` crate appends the 16-byte GCM tag to the ciphertext. * Node's `crypto.createCipheriv('aes-256-gcm')` returns the tag separately via * `getAuthTag()`, so we manually append it to match the Rust byte layout. */ /** On-disk encrypted-blob format version (first byte of every dump file). */ export declare const KEY_VERSION = 1; /** AES-256-GCM nonce length (bytes). */ export declare const NONCE_LEN = 12; /** AES-256-GCM authentication tag length (bytes, appended to ciphertext). */ export declare const GCM_TAG_LEN = 16; /** Minimum blob size: version(1) + nonce(12) + tag(16). */ export declare const MIN_BLOB_LEN: number; /** * Encrypt `plaintext` with a 32-byte `key` using AES-256-GCM. * * Returns a Buffer in the DiskDumper format: * `[KEY_VERSION][nonce:12][ciphertext][tag:16]`. */ export declare function encrypt(key: Uint8Array, plaintext: string): Buffer; /** Result of {@link decrypt}: plaintext + whether the previous key was used. */ export interface DecryptResult { readonly plaintext: string; /** `true` if the blob was decrypted with `previousKey` (pending rotation). */ readonly usedPrevious: boolean; } /** * Decrypt a DiskDumper-format blob. Tries `currentKey` first, then * `previousKey` (rotation window). Throws on malformed data or auth failure. */ export declare function decrypt(data: Buffer, currentKey: Uint8Array, previousKey?: Uint8Array): DecryptResult;