UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

79 lines 2.9 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 }); /** * context for credentialManifest */ const context = 'https://identity.foundation/schemas/credentials'; /** * type for credentialManifest */ const type = 'CredentialManifest'; /** * Class defining methods and properties for a ClaimManifest object. * based off of the CredentialManifest spec: {@link https://github.com/decentralized-identity/credential-manifest/blob/master/explainer.md} */ class CredentialManifest { /** * Constructs an instance of the CredentialManifest class from a well-formed credential manifest JSON object. */ constructor(credentialManifest) { this.endpoint = credentialManifest.endpoint; this.credential = credentialManifest.credential; this.language = credentialManifest.language; this.keeper = credentialManifest.keeper; this.version = credentialManifest.version; this.preconditions = credentialManifest.preconditions; this.inputs = credentialManifest.inputs; this.issuerOptions = credentialManifest.issuer_options; } /** * Creates a new instance of the CredentialManifest class. */ static create(credential, endpoint, language, keeper, version, preconditions, inputs, issuerOptions) { const manifest = { '@context': context, '@type': type, 'endpoint': endpoint, 'language': language, 'credential': credential, 'keeper': keeper, 'version': version, 'preconditions': preconditions, 'inputs': inputs, 'issuer_options': issuerOptions }; return new CredentialManifest(manifest); } /** * serializes the CredentialManifest to JSON. */ toJSON() { return { '@context': context, '@type': type, 'endpoint': this.endpoint, 'credential': this.credential, 'preconditions': this.preconditions, 'inputs': this.inputs, 'issuer_options': this.issuerOptions }; } /** * Get the keeper did of the CredentialManifest */ getKeeperDid() { return this.keeper; } /** * Get the input properties of the manifest */ getInputProperties() { return this.inputs; } } exports.default = CredentialManifest; //# sourceMappingURL=CredentialManifest.js.map