/** * Bytes {@link seal} adds to a plaintext: version byte, salt, nonce and tag. Attachment records * (cloud/journal.ts) are judged by `plaintext + SEAL_OVERHEAD`: a change of the AEAD envelope must * also bump the attachment context (`attachment/v1`), so old and new clients never read each * other's good records as the wrong size and clear them. */ export declare const SEAL_OVERHEAD: number; export declare class DecryptError extends Error { constructor(message?: string); } export declare const randomKey: () => Buffer; /** Derive a named key from a parent key (no salt). Examples: home-stream, verifier. */ export declare function deriveKey(parent: Uint8Array, purpose: string): Buffer; /** AEAD-encrypt `plaintext` under `key`, bound to `context` (AAD) and `purpose` (HKDF info). */ export declare function seal(key: Uint8Array, plaintext: Uint8Array, purpose: string, context: string): Buffer; export declare function open(key: Uint8Array, envelope: Uint8Array, purpose: string, context: string): Buffer; export interface KeyPair { publicKey: Buffer; privateKey: Buffer; } export declare function generateX25519(): KeyPair; /** Encrypt to a recipient's X25519 public key. Only the holder of the private key can open it. */ export declare function sealTo(recipientPublic: Uint8Array, plaintext: Uint8Array, context: string): Buffer; export declare function openSealed(recipient: KeyPair, sealed: Uint8Array, context: string): Buffer; export declare function generateEd25519(): KeyPair; export declare function signEd25519(kp: KeyPair, message: Uint8Array): Buffer; export declare function verifyEd25519(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean; export interface KdfParams { algorithm: 'argon2id'; memoryKiB: number; iterations: number; parallelism: number; salt: string; } export declare const DEFAULT_KDF: { readonly memoryKiB: 65536; readonly iterations: 3; readonly parallelism: 1; }; export declare function newKdfParams(): KdfParams; /** * Refuse KDF parameters outside KDF_LIMITS. They come from the server, which must not be able to weaken * the passphrase stretch or make the client allocate unbounded memory. */ export declare function checkKdfParams(p: KdfParams): void; export declare function passphraseKey(passphrase: string, p: KdfParams): Promise; export declare function encodeRecoveryKey(key: Uint8Array): string; export declare function decodeRecoveryKey(text: string): Buffer; export declare function constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean; export declare const sha256Hex: (b: Uint8Array) => string; export declare const hmacSha256: (key: Uint8Array, message: Uint8Array) => Buffer; export { uuidv7 } from './uuidv7.js'; //# sourceMappingURL=crypto.d.ts.map