UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

40 lines (39 loc) 1.1 kB
import { KeyUse } from './KeyUseFactory'; import { KeyType } from './KeyTypeFactory'; import IKeyContainer, { CryptographicKey } from './IKeyContainer'; /** * Represents a Key container in JWK format. * A key container will hold different versions of JWK keys. * Each key in the key container is the same type and usage */ export default class KeyContainer implements IKeyContainer { private keysInContainer; /** * Create instance of @class KeyContainer */ constructor(key: CryptographicKey); /** * Return all keys in the container */ readonly keys: CryptographicKey[]; /** * Key type */ readonly kty: KeyType; /** * Intended use */ readonly use: KeyUse | undefined; /** * Algorithm intended for use with this key */ readonly alg: string | undefined; /** * Algorithm intended for use with this key */ add(key: CryptographicKey): void; /** * Get the default key from the key container */ getKey<T = CryptographicKey>(): T; }