import { DBSchema, IDBPDatabase } from 'idb'; interface DefaultEncryptedPayload { iv: Uint8Array | ArrayBuffer; value: Uint8Array | ArrayBuffer; } interface EncryptedDB extends DBSchema { key: { key: string; value: CryptoKey; }; secrets: { key: string; value: EncryptedPayload; }; } type DecryptFn = (payload: EncryptedPayload) => Promise; type EncryptFn = (value: Uint8Array) => Promise; type EncryptedStoreConfig = { encrypt: EncryptFn; decrypt: DecryptFn; }; export declare class EncryptedStore { #private; private readonly db; constructor(db: IDBPDatabase>, { encrypt, decrypt }: EncryptedStoreConfig); saveSecretValue(primaryKey: string, value: Uint8Array): Promise; getSecretValue(primaryKey: string): Promise; deleteSecretValue(primaryKey: string): Promise; close(): void; wipe(): Promise; } /** * Will create a database that uses the built in encryption/decryption functions. * The master key will be created and stored inside the database * * @param dbName the name of the database to create */ export declare function createEncryptedStore(dbName: string): Promise>; /** * Will create a database that uses a custom encryption method. It needs the encrypt and decrypt function to be able to process the values stored. * It's the responsability of the consumer to store the encryption key * * @param dbName the name of the database to create * @param config contains the encrypt and decrypt methods */ export declare function createCustomEncryptedStore(dbName: string, config: EncryptedStoreConfig): Promise>; export {}; //# sourceMappingURL=encryptedStore.d.ts.map