UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

41 lines 1.55 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); /** * Implementation of an OpenID Connect * self-issued id token. * @implements ICredential */ class SelfIssuedCredential { /** * Constructs a new instance of a self-issued * credential for the specified identifier. * @param issuer of the credential. * @param recipient either a string or identifier identifying the * intended recipient of the credential. */ constructor(issuer, recipient) { /** * Array to hold claims to be included in the credential */ this.claims = []; this.issuedBy = issuer; this.issuedTo = recipient; this.issuedAt = new Date(Date.now()); // Add the identifier as the did claim this.addClaim({ name: 'did', value: issuer.id }); } /** * Adds the specified claim to the credential. * @param claim claim to add to credential. */ addClaim(claim) { // Add the claim to the credential this.claims.push(claim); } } exports.default = SelfIssuedCredential; //# sourceMappingURL=SelfIssuedCredential.js.map