UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

33 lines 1.59 kB
/** * Composable encryption layer for serialized data. * * Wraps/unwraps serialized payloads with AES-256-GCM encryption, * using the format prefix system to mark encrypted data. */ import { type CryptoKey } from '../encryption.js'; export type { CryptoKey }; /** * Encryption key parameter type. Accepts a resolved key, undefined (no encryption), * a promise, or a resolver that can defer fetching the key until data needs it. */ export type EncryptionKeyParam = CryptoKey | undefined | Promise<CryptoKey | undefined> | (() => Promise<CryptoKey | undefined>); export declare function resolveEncryptionKey(key: EncryptionKeyParam): Promise<CryptoKey | undefined>; /** * Encrypt a format-prefixed payload if a key is provided. * Wraps the data with the 'encr' format prefix. * * @param data - The format-prefixed serialized data * @param key - Encryption key (undefined to skip encryption) * @returns The encrypted data with 'encr' prefix, or the original data if no key */ export declare function encrypt(data: Uint8Array | unknown, key: CryptoKey | undefined): Promise<Uint8Array | unknown>; /** * Decrypt a format-prefixed payload if it's encrypted. * Strips the 'encr' format prefix and decrypts the inner payload. * * @param data - The potentially encrypted data * @param key - Encryption key (undefined to skip decryption) * @returns The decrypted inner payload, or the original data if not encrypted */ export declare function decrypt(data: Uint8Array | unknown, key: CryptoKey | undefined): Promise<Uint8Array | unknown>; //# sourceMappingURL=encryption.d.ts.map