UNPKG

@sphereon/did-resolver-key

Version:
23 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.keyToDidDoc = void 0; const JwkJcsBlockCodec_1 = require("../JwkJcsBlockCodec"); const index_1 = require("../index"); const keyToDidDoc = (pubKeyBytes, fingerprint, contentType) => { const did = `did:key:${fingerprint}`; const keyId = `${did}#${fingerprint}`; const publicKeyJwk = (0, JwkJcsBlockCodec_1.decode)(pubKeyBytes); return Object.assign(Object.assign({}, (contentType === index_1.DID_LD_JSON && { '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'], })), { id: did, verificationMethod: [ { id: keyId, type: 'JsonWebKey2020', controller: did, publicKeyJwk, }, ], authentication: [keyId], assertionMethod: [keyId], capabilityDelegation: [keyId], capabilityInvocation: [keyId] }); }; exports.keyToDidDoc = keyToDidDoc; exports.default = { keyToDidDoc: exports.keyToDidDoc }; //# sourceMappingURL=jwk.jcs.js.map