import { IPrivateKey, IPrivateKeyExporter } from '../types'; import { IKeyEntryStorage } from './KeyEntryStorage/IKeyEntryStorage'; /** * Interface of a single entry in {@link PrivateKeyStorage}. */ export interface IPrivateKeyEntry { privateKey: IPrivateKey; meta?: { [key: string]: string; }; } /** * Class responsible for storage of private keys. */ export declare class PrivateKeyStorage { private privateKeyExporter; private keyEntryStorage; /** * Initializes a new instance of `PrivateKeyStorage`. * @param {IPrivateKeyExporter} privateKeyExporter - Object responsible for * exporting private key bytes from `IPrivateKey` objects and importing * private key bytes into `IPrivateKey` objects. * @param {IKeyEntryStorage} keyEntryStorage - Object responsible for * persistence of private keys data. */ constructor(privateKeyExporter: IPrivateKeyExporter, keyEntryStorage?: IKeyEntryStorage); /** * Persists the given `privateKey` and `meta` under the given `name`. * If an entry with the same name already exists rejects the returned * Promise with {@link PrivateKeyExistsError} error. * * @param {string} name - Name of the private key. * @param {IPrivateKey} privateKey - The private key object. * @param {Object} [meta] - Optional metadata to store with the key. * * @returns {Promise} */ store(name: string, privateKey: IPrivateKey, meta?: { [key: string]: string; }): Promise; /** * Retrieves the private key with the given `name` from persistent storage. * If private with the given name does not exist, resolves the returned * Promise with `null`. * * @param {string} name - Name of the private key to load. * @returns {Promise} */ load(name: string): Promise; /** * Removes the private key entry with the given `name` from persistent * storage. * * @param {string} name - Name of the private key to remove. * @returns {Promise} */ delete(name: string): Promise; }