UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

55 lines 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * 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 */ class KeyContainer { /** * Create instance of @class KeyContainer */ constructor(key) { this.keysInContainer = [key]; } /** * Return all keys in the container */ get keys() { return this.keysInContainer; } /** * Key type */ get kty() { return this.keysInContainer[0].kty; } /** * Intended use */ get use() { return this.keysInContainer[0].use; } /** * Algorithm intended for use with this key */ get alg() { return this.keysInContainer[0].alg; } /** * Algorithm intended for use with this key */ add(key) { // Check for valid key to add this.keysInContainer.push(key); } /** * Get the default key from the key container */ getKey() { // return last keys as reference return this.keysInContainer[this.keysInContainer.length - 1]; } } exports.default = KeyContainer; //# sourceMappingURL=KeyContainer.js.map