verifiablecredentials-crypto-sdk-typescript-keystore
Version:
Package for managing keys in a key store.
32 lines (31 loc) • 1.22 kB
TypeScript
import { IKeyContainer, CryptographicKey } from 'verifiablecredentials-crypto-sdk-typescript-keys';
import IKeyStore, { KeyStoreListItem } from './IKeyStore';
import KeyStoreOptions from './KeyStoreOptions';
import { KeyReference } from '.';
/**
* Class defining methods and properties for a light KeyStore
*/
export default class KeyStoreInMemory implements IKeyStore {
private store;
/**
* Returns the key container associated with the specified
* key identifier.
* @param keyReference for which to return the key.
* @param [options] Options for retrieving.
*/
get(keyReference: KeyReference, options?: KeyStoreOptions): Promise<IKeyContainer>;
private publicKeysOnly;
/**
* Lists all keys with their corresponding key ids
*/
list(): Promise<{
[name: string]: KeyStoreListItem;
}>;
/**
* Saves the specified key to the key store using
* the key identifier.
* @param keyIdentifier for the key being saved.
* @param key being saved to the key store. If the key is a string it will be base64url encoded.
*/
save(keyIdentifier: KeyReference, key: CryptographicKey | string, _options?: KeyStoreOptions): Promise<void>;
}