/**
 * XChaCha20-Poly1305 AEAD with row-bound AAD.
 *
 * Every encrypted row binds (scope, scopeId, key, keyVersion) into the AAD.
 * Swapping a row from one slot to another (e.g. via `UPDATE secrets SET key=...`)
 * invalidates the AAD and triggers an AEAD failure on decrypt — making
 * row-substitution attacks observable.
 *
 * Wire format (base64-encoded): `nonce[24] || ciphertext || tag[16]`.
 * The nonce is randomly generated per encrypt; XChaCha20's 192-bit nonce
 * makes random selection collision-safe across realistic key lifetimes.
 */
export interface AADInput {
    scope: string;
    scopeId: string;
    key: string;
    keyVersion: string;
}
export interface EncryptedRow {
    ciphertext: string;
    keyVersion: string;
}
/**
 * Encrypt `plaintext` under `masterKey` with AAD bound to `ctx`.
 * Returns base64(nonce || ciphertext || tag) and the keyVersion that was
 * baked into the AAD. Caller is responsible for storing both.
 */
export declare function encrypt(masterKey: Uint8Array, plaintext: string, ctx: AADInput): EncryptedRow;
/**
 * Decrypt a row. Throws on:
 *   - AAD mismatch (row moved between slots; key/scope/version doesn't match)
 *   - tag failure (ciphertext or nonce tampered)
 *   - wrong master key
 *   - malformed wire format (truncated, bad base64)
 *
 * The thrown error MUST NOT carry the ciphertext or any partial plaintext.
 */
export declare function decrypt(masterKey: Uint8Array, row: EncryptedRow, ctx: AADInput): string;
/**
 * Generate a fresh master key suitable for `encrypt()`. 32 random bytes.
 * Caller is responsible for base64-encoding for env-var transport and
 * persistence (see master-key.ts).
 */
export declare function generateMasterKey(): Uint8Array;
