/** * KDF Utility Functions * * Encoding, decoding, and cryptographic utilities for KDF operations. * Issue #1649 */ /** * Convert a base64 string to Uint8Array */ export declare function base64ToUint8Array(base64: string): Uint8Array; /** * Convert Uint8Array to base64 string */ export declare function uint8ArrayToBase64(bytes: Uint8Array): string; /** * XOR two byte arrays of equal length * * Used for combining password-derived key with LocalSecret in 2SKD. * This follows the 1Password approach of XOR combination. * * @param a - First byte array * @param b - Second byte array * @returns XOR result * @throws Error if arrays are not the same length */ export declare function xorBytes(a: Uint8Array, b: Uint8Array): Uint8Array; /** * Normalize password for key derivation * * Applies NFKD normalization and trims whitespace. * This ensures consistent key derivation across platforms. * * @param password - Raw password input * @returns Normalized password string */ export declare function normalizePassword(password: string): string; /** * Generate cryptographically secure random bytes * * @param length - Number of bytes to generate * @returns Random bytes */ export declare function generateRandomBytes(length: number): Uint8Array; /** * Generate a random salt for key derivation * * @returns 16-byte random salt as base64 string */ export declare function generateSalt(): string; /** * Constant-time comparison of two byte arrays * * Prevents timing attacks when comparing secrets. * * @param a - First byte array * @param b - Second byte array * @returns true if arrays are equal */ export declare function constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean;