/** * Web Crypto API Utilities * Core encryption/decryption functions using Web Crypto API */ import type { EncryptionAlgorithm, EncryptionKey, EncryptedFieldMetadata, KeyFormat } from '@plyaz/types/api'; /** * Check if Web Crypto API is available */ export declare function isCryptoAvailable(): boolean; /** * Generate a random IV (Initialization Vector) */ export declare function generateIV(algorithm: EncryptionAlgorithm): Uint8Array; /** * Convert base64 string to Uint8Array */ export declare function base64ToBytes(base64: string): Uint8Array; /** * Convert Uint8Array to base64 string */ export declare function bytesToBase64(bytes: Uint8Array): string; /** * Import encryption key from various formats */ export declare function importKey(key: CryptoKey | string | JsonWebKey, algorithm: EncryptionAlgorithm, format?: KeyFormat): Promise; /** * Encrypt data using the specified algorithm * * @param data - Data to encrypt (will be JSON stringified if not a string) * @param encryptionKey - Encryption key configuration * @returns Encrypted data with metadata */ export declare function encrypt(data: string | number | boolean | object | null, encryptionKey: EncryptionKey): Promise; /** * Decrypt encrypted field metadata * * @param encrypted - Encrypted field metadata or base64 string * @param encryptionKey - Encryption key configuration * @returns Decrypted data */ export declare function decrypt(encrypted: EncryptedFieldMetadata | string, encryptionKey: EncryptionKey): Promise; /** * Check if a value is encrypted field metadata */ export declare function isEncryptedMetadata(value: unknown): value is EncryptedFieldMetadata; /** * Generate a random encryption key (for development/testing) * DO NOT use in production - use proper key management */ export declare function generateRandomKey(): Uint8Array; /** * Export a CryptoKey to base64 (for storage) * WARNING: Only use in secure contexts with proper key management */ export declare function exportKeyToBase64(key: CryptoKey): Promise; //# sourceMappingURL=crypto.d.ts.map