UNPKG

ndwallet-core

Version:

Core cryptographic library for NDWallet browser environments

28 lines (27 loc) 1.08 kB
/** * Generate a random salt * @returns Uint8Array containing the salt */ export declare function generateRandomSalt(): Uint8Array; /** * Derive a key from password and salt using PBKDF2 * @param password - The password * @param salt - The salt to use for PBKDF2 * @returns Promise resolving to a CryptoKey */ export declare function derivePbkdf2EncryptionKey(password: string, salt: string): Promise<CryptoKey>; /** * Derive a specific encryption key from the master key using HKDF * @param masterKey - Master key derived from passkey * @param context - Context string to derive different keys for different purposes * @returns Promise resolving to a CryptoKey that can be used for encryption/decryption */ export declare function deriveHkdfEncryptionKey(masterKey: CryptoKey, context: string): Promise<CryptoKey>; export declare function encryptData(data: string, key: CryptoKey): Promise<{ iv: number[]; data: number[]; }>; export declare function decryptData(encryptedData: { iv: number[]; data: number[]; }, key: CryptoKey): Promise<string>;