/** * @bunkor/crypto - Utility Functions * * Common cryptographic operations and helpers */ /** * Generate a cryptographically secure random string * @param length Length in bytes * @returns Base64-encoded random string */ export declare function generateRandomString(length?: number): string; /** * Generate a cryptographically secure random hex string * @param length Length in bytes * @returns Hex-encoded random string */ export declare function generateRandomHex(length?: number): string; /** * Convert Uint8Array to base64 */ export declare function arrayBufferToBase64(buffer: Uint8Array | ArrayBuffer): string; /** * Convert base64 string to Uint8Array */ export declare function base64ToArrayBuffer(base64: string): Uint8Array; /** * Convert Uint8Array to hex string */ export declare function arrayBufferToHex(buffer: Uint8Array | ArrayBuffer): string; /** * Convert hex string to Uint8Array */ export declare function hexToArrayBuffer(hex: string): Uint8Array; /** * Calculate SHA-256 hash of data * @param data Data to hash * @returns Hex-encoded hash */ export declare function sha256(data: string | ArrayBuffer | Uint8Array): Promise; /** * Validate password strength * @returns Object with validity and message if invalid */ export declare function validatePassword(password: string): { valid: boolean; message?: string; }; /** * Calculate password strength (0-100) */ export declare function calculatePasswordStrength(password: string): number; /** * Format bytes for display */ export declare function formatBytes(bytes: number, decimals?: number): string; /** * Generate a deterministic key from a seed (for testing/reproducibility) * WARNING: Do not use for production security-critical operations */ export declare function deriveKeyFromSeed(seed: string, keyLength?: number): Promise; /** * Secure string comparison (timing-safe) * Prevents timing attacks when comparing sensitive strings */ export declare function secureCompare(a: string, b: string): boolean; /** * Safely clear sensitive data from memory * Note: JavaScript doesn't guarantee memory clearing, but this helps */ export declare function clearSensitiveData(data: Uint8Array | ArrayBuffer): void; /** * Check if Web Crypto API is available */ export declare function isWebCryptoAvailable(): boolean; /** * Check browser encryption support */ export declare function checkEncryptionSupport(): { webCrypto: boolean; aesGcm: boolean; aesCbc: boolean; aesStr: boolean; rsaOaep: boolean; pbkdf2: boolean; }; /** * Get browser encryption capabilities summary */ export declare function getEncryptionCapabilities(): string; //# sourceMappingURL=crypto-utils.d.ts.map