import type { KeyValueStore } from '../common/index.js'; import type { IDCrypto } from '../crypto/index.js'; import { CryptoKey } from '../crypto/index.js'; export type AppDataBackup = { /** * A timestamp to record when the backup was made. */ dateCreated: string; /** * The size of the backup data. */ size: number; /** * Encrypted vault contents. */ data: string; }; export type AppDataStatus = { /** * Boolean indicating whether the data was successful. */ initialized: boolean; /** * The timestamp of the last backup. */ lastBackup: string | undefined; /** * The timestamp of the last restore. */ lastRestore: string | undefined; }; export type AppData = { [key: string]: any; }; export interface AppDataStore { /** * Returns a promise that resolves to a string, which is the App DID. */ getDid(): Promise; /** * Returns a promise that resolves to a CryptoKey object, which * represents the public key associated with the App DID. */ getPublicKey(): Promise; /** * Returns a promise that resolves to a CryptoKey object, which * represents the private key associated with the App DID. */ getPrivateKey(): Promise; /** * Returns a promise that resolves to a AppDataStatus object, which * provides information about the current status of the AppData instance. */ getStatus(): Promise; /** * Initializes the AppDataStore and returns a Promise that resolves * to a boolean indicating whether the operation was successful. */ initialize(options: { passphrase: string; keyPair: IDCrypto.CryptoKeyPair; }): Promise; /** * Creates an encrypted backup of the current state of `AppData` and * returns a Promise that resolves to an `AppDataBackup` object. */ backup(options: { passphrase: string; }): Promise; /** * Restores `AppData` to the state in the provided `AppDataBackup` object. * It requires a passphrase to decrypt the backup and returns a Promise that * resolves to a boolean indicating whether the restore was successful. */ restore(options: { backup: AppDataBackup; passphrase: string; }): Promise; /** * Locks the `AppDataStore`, secured by a passphrase * that must be entered to unlock. */ lock(): Promise; /** * Attempts to unlock the `AppDataStore` with the provided * passphrase. It returns a Promise that resolves to a * boolean indicating whether the unlock was successful. */ unlock(options: { passphrase: string; }): Promise; /** * Attempts to change the passphrase of the `AppDataStore`. * It requires the old passphrase for verification and returns * a Promise that resolves to a boolean indicating whether the * passphrase change was successful. */ changePassphrase(options: { oldPassphrase: string; newPassphrase: string; }): Promise; } export type AppDataVaultOptions = { keyDerivationWorkFactor?: number; store?: KeyValueStore; }; export declare class AppDataVault implements AppDataStore { private _keyDerivationWorkFactor; private _store; private _vaultUnlockKey; constructor(options?: AppDataVaultOptions); backup(_options: { passphrase: string; }): Promise; changePassphrase(_options: { oldPassphrase: string; newPassphrase: string; }): Promise; private generateVaultUnlockKey; getDid(): Promise; getPublicKey(): Promise; getPrivateKey(): Promise; getStatus(): Promise; initialize(options: { keyPair: IDCrypto.CryptoKeyPair; passphrase: string; }): Promise; lock(): Promise; restore(_options: { backup: AppDataBackup; passphrase: string; }): Promise; setStatus(options: Partial): Promise; unlock(options: { passphrase: string; }): Promise; } //# sourceMappingURL=app-data-store.d.ts.map