/** * Cryptographic utilities for encryption, hashing, and secure random generation. * Uses AES-256-GCM for reversible encryption and SHA-256 for one-way indexes. */ /** * Encrypts plaintext with AES-256-GCM using a random IV and auth tag. * @param plaintext UTF-8 string to encrypt * @returns Base64 payload containing IV, auth tag, and ciphertext */ export declare function encrypt(plaintext: string): string; /** * Decrypts a payload produced by encrypt(). * @param ciphertext Base64 string with IV, auth tag, and ciphertext * @returns Original UTF-8 plaintext * @throws When the auth tag is invalid or the key does not match */ export declare function decrypt(ciphertext: string): string; /** * Produces a SHA-256 hash of a normalized string for database uniqueness indexes. * @param value Raw value; lowercased and trimmed before hashing * @returns Hex-encoded SHA-256 digest */ export declare function hashForIndex(value: string): string; /** * Normalizes a phone number to digits only, then hashes for uniqueness index. * @param phone Phone string with optional formatting characters * @returns Hex-encoded SHA-256 digest of digit-only form */ export declare function hashForPhone(phone: string): string; /** * Hashes a token (e.g. refresh token) for secure storage without reversible encryption. * @param token Raw token string * @returns Hex-encoded SHA-256 digest */ export declare function hashToken(token: string): string; /** * Generates cryptographically secure random bytes as a hex string. * @param bytes Number of random bytes (default 32) * @returns Hex-encoded random string */ export declare function randomHex(bytes?: number): string; /** * Encrypts a sensitive value for database storage (prefix marks ciphertext version). */ export declare function encryptSensitive(plaintext: string): string; /** * Decrypts a value stored by encryptSensitive; returns legacy plaintext as-is. */ export declare function decryptSensitive(stored: string | null | undefined): string; /** Encrypts a JSON-serializable object for database storage. */ export declare function encryptJson(data: unknown): string; /** Decrypts JSON stored via encryptJson. */ export declare function decryptJson(stored: string | null | undefined): T | null; //# sourceMappingURL=crypto.d.ts.map