UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

63 lines (54 loc) 2.01 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License in the project root for license information. *--------------------------------------------------------------------------------------------*/ import IKeyContainer from '../keys/IKeyContainer'; import { KeyType } from '../keys/KeyTypeFactory'; /** * Define an item in the key store list */ export interface KeyStoreListItem { /** * The kid's of the key versions */ kids: string[]; /** * The key type of the key version */ kty: KeyType; } /** * Define different types for the algorithm parameter */ export type CryptoAlgorithm = RsaPssParams | EcdsaParams | Algorithm; /** * Interface defining methods and properties to * be implemented by specific key stores. */ export default interface IKeyStore { /** * Returns the key container associated with the specified * key reference. * @param keyIdentifier for which to return the key. * @param [publicKeyOnly] True if only the public key is needed. */ get (keyReference: string, publicKeyOnly?: boolean): Promise<IKeyContainer>; /** * Returns the key associated with the specified * key reference. * @param keyIdentifier for which to return the key. * @param [publicKeyOnly] True if only the public key is needed. */ // get (keyReference: string, kid: string, publicKeyOnly?: boolean): Promise<CryptographicKey>; /** * Saves the specified key container to the key store using * the key reference. * @param keyReference Reference for the key being saved. * @param key being saved to the key store. */ save (keyReference: string, key: IKeyContainer | string): Promise<void>; /** * Lists all key references with their corresponding key ids */ list (): Promise<{ [name: string]: KeyStoreListItem }>; }