/** * A wrapper around CryptoKey that uses non-extractable keys for security. * Keys are stored as HKDF base keys to enable ratcheting via deriveBits. */ export declare class CryptographyKey { private key; private constructor(); /** * Create a CryptographyKey from raw bytes. * The key will be imported as a non-extractable HKDF key. */ static fromBytes(keyMaterial: Uint8Array): Promise; /** * Create a CryptographyKey from an existing CryptoKey. */ static fromCryptoKey(key: CryptoKey): CryptographyKey; /** * Get the underlying CryptoKey object. */ getCryptoKey(): CryptoKey; /** * Derive bytes from this key using HKDF. * Used for encryption key derivation and ratcheting. */ deriveBits(salt: Uint8Array, info: Uint8Array, length: number): Promise>; /** * Derive a new CryptographyKey from this key using HKDF. * Used for key ratcheting. */ deriveKey(salt: Uint8Array, info: Uint8Array): Promise; /** * Get raw bytes from this key for intermediate operations like concatenation. * Uses deriveBits with empty salt/info to extract the key material. * This is needed for X3DH handshake where multiple DH secrets are concatenated. */ getBytes(length?: number): Promise>; } /** * Interface for symmetric encryption classes supported by this library. */ export interface SymmetricEncryptionInterface { encrypt(message: string | Uint8Array, key: CryptographyKey, assocData?: string): Promise; decrypt(message: string, key: CryptographyKey, assocData?: string): Promise; } /** * Default implementation for SymmetricEncryptionInterface. */ export declare class SymmetricCrypto implements SymmetricEncryptionInterface { encrypt(message: string | Uint8Array, key: CryptographyKey, assocData?: string): Promise; decrypt(message: string, key: CryptographyKey, assocData?: string): Promise; } export type KeyDerivationFunction = (ikm: Uint8Array, salt?: Uint8Array, info?: Uint8Array) => Promise>; /** * Encrypt data using AES-GCM. * Provides key commitment. * * @param {string|Uint8Array} message * @param {CryptographyKey} key * @param {string|null} assocData * @returns {string} */ export declare function encryptData(message: string | Uint8Array, key: CryptographyKey, assocData?: string): Promise; /** * Decrypt data using AES-GCM. * Asserts key commitment. * * @param {string} encrypted * @param {CryptographyKey} key * @param {string|null} assocData * @returns {string|Uint8Array} */ export declare function decryptData(encrypted: string, key: CryptographyKey, assocData?: string): Promise; /** * HKDF implementation using Web Crypto API * * @param ikm * @param salt * @param info */ export declare function blakeKdf(ikm: Uint8Array, salt?: Uint8Array | CryptographyKey, info?: Uint8Array): Promise>; /** * Derive an encryption key and a commitment hash using HKDF. * * @param {CryptographyKey} key * @param {Uint8Array} nonce * @returns {{encKeyBytes: Uint8Array, commitment: Uint8Array}} */ export declare function deriveKeys(key: CryptographyKey, nonce: Uint8Array): Promise<{ encKeyBytes: Uint8Array; commitment: Uint8Array; }>; //# sourceMappingURL=symmetric.d.ts.map