@sphereon/ssi-sdk-ext.identifier-resolution 0.28.1-feature.esm.cjs.9 → 0.28.1-feature.oyd.cmsm.improv.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/agent/IdentifierResolution.d.ts +38 -0
  2. package/dist/agent/IdentifierResolution.d.ts.map +1 -0
  3. package/dist/agent/IdentifierResolution.js +123 -0
  4. package/dist/agent/IdentifierResolution.js.map +1 -0
  5. package/dist/functions/LegacySupport.d.ts +12 -0
  6. package/dist/functions/LegacySupport.d.ts.map +1 -0
  7. package/dist/functions/LegacySupport.js +39 -0
  8. package/dist/functions/LegacySupport.js.map +1 -0
  9. package/dist/functions/externalIdentifierFunctions.d.ts +26 -0
  10. package/dist/functions/externalIdentifierFunctions.d.ts.map +1 -0
  11. package/dist/functions/externalIdentifierFunctions.js +250 -0
  12. package/dist/functions/externalIdentifierFunctions.js.map +1 -0
  13. package/dist/functions/externalOIDFIdentifier.d.ts +19 -0
  14. package/dist/functions/externalOIDFIdentifier.d.ts.map +1 -0
  15. package/dist/functions/externalOIDFIdentifier.js +106 -0
  16. package/dist/functions/externalOIDFIdentifier.js.map +1 -0
  17. package/dist/functions/index.d.ts +5 -0
  18. package/dist/functions/index.d.ts.map +1 -0
  19. package/dist/functions/index.js +21 -0
  20. package/dist/functions/index.js.map +1 -0
  21. package/dist/functions/managedIdentifierFunctions.d.ts +38 -0
  22. package/dist/functions/managedIdentifierFunctions.d.ts.map +1 -0
  23. package/dist/functions/managedIdentifierFunctions.js +359 -0
  24. package/dist/functions/managedIdentifierFunctions.js.map +1 -0
  25. package/dist/index.d.ts +7 -434
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +27 -5333
  28. package/dist/index.js.map +1 -1
  29. package/dist/tsdoc-metadata.json +1 -1
  30. package/dist/types/IIdentifierResolution.d.ts +42 -0
  31. package/dist/types/IIdentifierResolution.d.ts.map +1 -0
  32. package/dist/types/IIdentifierResolution.js +21 -0
  33. package/dist/types/IIdentifierResolution.js.map +1 -0
  34. package/dist/types/common.d.ts +20 -0
  35. package/dist/types/common.d.ts.map +1 -0
  36. package/dist/types/common.js +51 -0
  37. package/dist/types/common.js.map +1 -0
  38. package/dist/types/externalIdentifierTypes.d.ts +114 -0
  39. package/dist/types/externalIdentifierTypes.d.ts.map +1 -0
  40. package/dist/types/externalIdentifierTypes.js +44 -0
  41. package/dist/types/externalIdentifierTypes.js.map +1 -0
  42. package/dist/types/index.d.ts +5 -0
  43. package/dist/types/index.d.ts.map +1 -0
  44. package/dist/types/index.js +21 -0
  45. package/dist/types/index.js.map +1 -0
  46. package/dist/types/managedIdentifierTypes.d.ts +122 -0
  47. package/dist/types/managedIdentifierTypes.d.ts.map +1 -0
  48. package/dist/types/managedIdentifierTypes.js +63 -0
  49. package/dist/types/managedIdentifierTypes.js.map +1 -0
  50. package/package.json +22 -34
  51. package/plugin.schema.json +712 -638
  52. package/src/agent/IdentifierResolution.ts +35 -39
  53. package/src/functions/externalIdentifierFunctions.ts +14 -21
  54. package/src/functions/externalOIDFIdentifier.ts +3 -6
  55. package/src/functions/managedIdentifierFunctions.ts +6 -7
  56. package/src/index.ts +1 -1
  57. package/src/types/IIdentifierResolution.ts +1 -1
  58. package/src/types/IJwtService.d.ts +2 -3
  59. package/src/types/externalIdentifierTypes.ts +1 -1
  60. package/dist/index.cjs +0 -5336
  61. package/dist/index.cjs.map +0 -1
  62. package/dist/index.d.cts +0 -439
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.resolveExternalOIDFEntityIdIdentifier = resolveExternalOIDFEntityIdIdentifier;
36
+ const ssi_sdk_agent_config_1 = require("@sphereon/ssi-sdk.agent-config");
37
+ const u8a = __importStar(require("uint8arrays"));
38
+ /**
39
+ * Resolves an OIDF Entity ID against multiple trust anchors to establish trusted relationships
40
+ *
41
+ * @param opts Configuration options containing the identifier to resolve and trust anchors to validate against
42
+ * @param context Agent context that must include the OIDF client plugin and JWT verification capabilities
43
+ *
44
+ * @returns Promise resolving to an ExternalIdentifierOIDFEntityIdResult containing:
45
+ * - trustedAnchors: Record mapping trust anchors to their public key hexes
46
+ * - errorList: Optional record of errors encountered per trust anchor
47
+ * - jwks: Array of JWK information from the trust chain
48
+ * - trustEstablished: Boolean indicating if any trust relationships were established
49
+ *
50
+ * @throws Error if trust anchors are missing or JWT verification plugin is not enabled
51
+ */
52
+ function resolveExternalOIDFEntityIdIdentifier(opts, context) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ var _a;
55
+ let { trustAnchors, identifier } = opts;
56
+ if (!trustAnchors || trustAnchors.length === 0) {
57
+ return Promise.reject(Error('ExternalIdentifierOIDFEntityIdOpts is missing the trustAnchors'));
58
+ }
59
+ if (!(0, ssi_sdk_agent_config_1.contextHasPlugin)(context, 'jwtVerifyJwsSignature')) {
60
+ return Promise.reject(Error('For OIDFEntityId resolving the agent needs to have the JwtService plugin enabled'));
61
+ }
62
+ const trustedAnchors = new Set();
63
+ const errorList = {};
64
+ const jwkInfos = [];
65
+ let payload;
66
+ for (const trustAnchor of trustAnchors) {
67
+ const resolveResult = yield context.agent.resolveTrustChain({
68
+ entityIdentifier: identifier,
69
+ trustAnchors: [trustAnchor],
70
+ });
71
+ if (resolveResult.error || !resolveResult.trustChain) {
72
+ errorList[trustAnchor] = (_a = resolveResult.errorMessage) !== null && _a !== void 0 ? _a : 'unspecified';
73
+ }
74
+ else {
75
+ const trustChain = resolveResult.trustChain.asJsReadonlyArrayView();
76
+ if (trustChain.length === 0) {
77
+ errorList[trustAnchor] = 'Trust chain is empty';
78
+ continue;
79
+ }
80
+ const jwt = trustChain[0];
81
+ const jwtVerifyResult = yield context.agent.jwtVerifyJwsSignature({ jws: jwt });
82
+ if (jwtVerifyResult.error || jwtVerifyResult.critical) {
83
+ errorList[trustAnchor] = jwtVerifyResult.message;
84
+ continue;
85
+ }
86
+ if (jwtVerifyResult.jws.signatures.length === 0) {
87
+ errorList[trustAnchor] = 'No signature was present in the trust anchor JWS';
88
+ continue;
89
+ }
90
+ payload = JSON.parse(u8a.toString(u8a.fromString(jwtVerifyResult.jws.payload, 'base64url')));
91
+ const signature = jwtVerifyResult.jws.signatures[0];
92
+ if (signature.identifier.jwks.length === 0) {
93
+ errorList[trustAnchor] = 'No JWK was present in the trust anchor signature';
94
+ continue;
95
+ }
96
+ if (jwkInfos.length === 0) {
97
+ // We need the entity JWK only once
98
+ jwkInfos.push(...signature.identifier.jwks);
99
+ }
100
+ trustedAnchors.add(trustAnchor);
101
+ }
102
+ }
103
+ return Object.assign(Object.assign({ method: 'entity_id', trustedAnchors: Array.from(trustedAnchors) }, (Object.keys(errorList).length > 0 && { errorList })), { jwks: jwkInfos, jwtPayload: payload, trustEstablished: trustedAnchors.size > 0 });
104
+ });
105
+ }
106
+ //# sourceMappingURL=externalOIDFIdentifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalOIDFIdentifier.js","sourceRoot":"","sources":["../../src/functions/externalOIDFIdentifier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,sFAsEC;AAvFD,yEAAiE;AAEjE,iDAAkC;AAClC;;;;;;;;;;;;;GAaG;AACH,SAAsB,qCAAqC,CACzD,IAAwC,EACxC,OAAmC;;;QAEnC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;QAEvC,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC,CAAA;QAChG,CAAC;QAED,IAAI,CAAC,IAAA,uCAAgB,EAAC,OAAO,EAAE,uBAAuB,CAAC,EAAE,CAAC;YACxD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAC,CAAA;QAClH,CAAC;QAED,MAAM,cAAc,GAAuB,IAAI,GAAG,EAAiB,CAAA;QACnE,MAAM,SAAS,GAAwC,EAAE,CAAA;QACzD,MAAM,QAAQ,GAA2B,EAAE,CAAA;QAE3C,IAAI,OAA+B,CAAA;QACnC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,KAAK,C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AC,UAAU,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC3C,SAAS,CAAC,WAAW,CAAC,GAAG,kDAAkD,CAAA;oBAC3E,SAAQ;gBACV,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC1B,mCAAmC;oBACnC,QAAQ,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;gBAC7C,CAAC;gBACD,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;YACjC,CAAC;QACH,CAAC;QAED,qCACE,MAAM,EAAE,WAAW,EACnB,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IACvC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,KACvD,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,OAAO,EACnB,gBAAgB,EAAE,cAAc,CAAC,IAAI,GAAG,CAAC,IAC1C;IACH,CAAC;CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './managedIdentifierFunctions';
2
+ export * from './externalIdentifierFunctions';
3
+ export * from './externalOIDFIdentifier';
4
+ export * from './LegacySupport';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./managedIdentifierFunctions"), exports);
18
+ __exportStar(require("./externalIdentifierFunctions"), exports);
19
+ __exportStar(require("./externalOIDFIdentifier"), exports);
20
+ __exportStar(require("./LegacySupport"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,gEAA6C;AAC7C,2DAAwC;AACxC,kDAA+B"}
@@ -0,0 +1,38 @@
1
+ import { IAgentContext, IKeyManager } from '@veramo/core';
2
+ import { IIdentifierResolution, ManagedIdentifierCoseKeyOpts, ManagedIdentifierCoseKeyResult, ManagedIdentifierDidOpts, ManagedIdentifierDidResult, ManagedIdentifierOID4VCIssuerOpts, ManagedIdentifierOID4VCIssuerResult, ManagedIdentifierJwkOpts, ManagedIdentifierJwkResult, ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, ManagedIdentifierKidOpts, ManagedIdentifierKidResult, ManagedIdentifierOptsOrResult, ManagedIdentifierResult, ManagedIdentifierX5cOpts, ManagedIdentifierX5cResult } from '../types';
3
+ export declare function getManagedKidIdentifier(opts: ManagedIdentifierKidOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKidResult>;
4
+ export declare function isManagedIdentifierResult(identifier: ManagedIdentifierOptsOrResult & {
5
+ crypto?: Crypto;
6
+ }): identifier is ManagedIdentifierResult;
7
+ /**
8
+ * Allows to get a managed identifier result in case identifier options are passed in, but returns the identifier directly in case results are passed in. This means resolution can have happened before, or happens in this method
9
+ * @param identifier
10
+ * @param context
11
+ */
12
+ export declare function ensureManagedIdentifierResult(identifier: ManagedIdentifierOptsOrResult & {
13
+ crypto?: Crypto;
14
+ }, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierResult>;
15
+ /**
16
+ * This function is just a convenience function to get a common result. The user already apparently had a key, so could have called the kid version as well
17
+ * @param opts
18
+ * @param _context
19
+ */
20
+ export declare function getManagedKeyIdentifier(opts: ManagedIdentifierKeyOpts, _context?: IAgentContext<any>): Promise<ManagedIdentifierKeyResult>;
21
+ /**
22
+ * This function is just a convenience function to get a common result. The user already apparently had a key, so could have called the kid version as well
23
+ * @param opts
24
+ * @param context
25
+ */
26
+ export declare function getManagedCoseKeyIdentifier(opts: ManagedIdentifierCoseKeyOpts, context: IAgentContext<any>): Promise<ManagedIdentifierCoseKeyResult>;
27
+ export declare function getManagedDidIdentifier(opts: ManagedIdentifierDidOpts, context: IAgentContext<any>): Promise<ManagedIdentifierDidResult>;
28
+ export declare function getManagedJwkIdentifier(opts: ManagedIdentifierJwkOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierJwkResult>;
29
+ export declare function getManagedX5cIdentifier(opts: ManagedIdentifierX5cOpts & {
30
+ crypto?: Crypto;
31
+ }, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierX5cResult>;
32
+ export declare function getManagedOID4VCIssuerIdentifier(opts: ManagedIdentifierOID4VCIssuerOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierOID4VCIssuerResult>;
33
+ export declare function getManagedIdentifier(opts: ManagedIdentifierOptsOrResult & {
34
+ crypto?: Crypto;
35
+ }, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierResult>;
36
+ export declare function managedIdentifierToKeyResult(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IIdentifierResolution & IKeyManager>): Promise<ManagedIdentifierKeyResult>;
37
+ export declare function managedIdentifierToJwk(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IIdentifierResolution & IKeyManager>): Promise<ManagedIdentifierJwkResult>;
38
+ //# sourceMappingURL=managedIdentifierFunctions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managedIdentifierFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/managedIdentifierFunctions.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAqB,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5E,OAAO,EACL,qBAAqB,EAWrB,4BAA4B,EAC5B,8BAA8B,EAC9B,wBAAwB,EACxB,0BAA0B,EAC1B,iCAAiC,EACjC,mCAAmC,EACnC,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,UAAU,CAAA;AAEjB,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,wBAAwB,EAC9B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,0BAA0B,CAAC,CAsCrC;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,6BAA6B,GAAG;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GACA,UAAU,IAAI,uBAAuB,CAEvC;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,6BAA6B,GAAG;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAGlC;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAuBhJ;AAED;;;;GAIG;AACH,wBAAsB,2B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g, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getManagedKidIdentifier = getManagedKidIdentifier;
13
+ exports.isManagedIdentifierResult = isManagedIdentifierResult;
14
+ exports.ensureManagedIdentifierResult = ensureManagedIdentifierResult;
15
+ exports.getManagedKeyIdentifier = getManagedKeyIdentifier;
16
+ exports.getManagedCoseKeyIdentifier = getManagedCoseKeyIdentifier;
17
+ exports.getManagedDidIdentifier = getManagedDidIdentifier;
18
+ exports.getManagedJwkIdentifier = getManagedJwkIdentifier;
19
+ exports.getManagedX5cIdentifier = getManagedX5cIdentifier;
20
+ exports.getManagedOID4VCIssuerIdentifier = getManagedOID4VCIssuerIdentifier;
21
+ exports.getManagedIdentifier = getManagedIdentifier;
22
+ exports.managedIdentifierToKeyResult = managedIdentifierToKeyResult;
23
+ exports.managedIdentifierToJwk = managedIdentifierToJwk;
24
+ const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
25
+ const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
26
+ const ssi_sdk_ext_x509_utils_1 = require("@sphereon/ssi-sdk-ext.x509-utils");
27
+ const ssi_sdk_agent_config_1 = require("@sphereon/ssi-sdk.agent-config");
28
+ const pkijs_1 = require("pkijs");
29
+ const types_1 = require("../types");
30
+ function getManagedKidIdentifier(opts, context) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
33
+ const method = 'kid';
34
+ let key = undefined;
35
+ let issuer = undefined;
36
+ let kid = undefined;
37
+ if (!(0, ssi_sdk_agent_config_1.contextHasKeyManager)(context)) {
38
+ return Promise.reject(Error(`Cannot get Key/JWK identifier if KeyManager plugin is not enabled!`));
39
+ }
40
+ else if (opts.identifier.startsWith('did:')) {
41
+ const did = opts.identifier.split('#')[0];
42
+ const didIdentifier = yield getManagedDidIdentifier(Object.assign(Object.assign({}, opts), { method: 'did', identifier: did }), context);
43
+ key = didIdentifier.key;
44
+ issuer = didIdentifier.issuer;
45
+ kid = (_d = (_a = opts === null || opts === void 0 ? void 0 : opts.kid) !== null && _a !== void 0 ? _a : (_c = (_b = key.meta) === null || _b === void 0 ? void 0 : _b.verificationMethod) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : didIdentifier.kid;
46
+ }
47
+ if (!key) {
48
+ key = yield context.agent.keyManagerGet({ kid: (_e = opts.kmsKeyRef) !== null && _e !== void 0 ? _e : opts.identifier });
49
+ }
50
+ const jwk = (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, key.type, { key });
51
+ const jwkThumbprint = (_g = (_f = key.meta) === null || _f === void 0 ? void 0 : _f.jwkThumbprint) !== null && _g !== void 0 ? _g : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
52
+ if (!kid) {
53
+ kid = (_m = (_l = (_h = opts.kid) !== null && _h !== void 0 ? _h : (_k = (_j = key.meta) === null || _j === void 0 ? void 0 : _j.verificationMethod) === null || _k === void 0 ? void 0 : _k.id) !== null && _l !== void 0 ? _l : key.kid) !== null && _m !== void 0 ? _m : jwkThumbprint;
54
+ }
55
+ if (!issuer) {
56
+ issuer = (_o = opts.issuer) !== null && _o !== void 0 ? _o : kid; // The different identifiers should set the value. Defaults to the kid
57
+ }
58
+ return {
59
+ method,
60
+ key,
61
+ identifier: opts.identifier,
62
+ jwk,
63
+ jwkThumbprint,
64
+ kid,
65
+ clientId: opts.clientId,
66
+ clientIdScheme: opts.clientIdScheme,
67
+ issuer,
68
+ kmsKeyRef: key.kid,
69
+ opts,
70
+ };
71
+ });
72
+ }
73
+ function isManagedIdentifierResult(identifier) {
74
+ return 'key' in identifier && 'kmsKeyRef' in identifier && 'method' in identifier && 'opts' in identifier && 'jwkThumbprint' in identifier;
75
+ }
76
+ /**
77
+ * Allows to get a managed identifier result in case identifier options are passed in, but returns the identifier directly in case results are passed in. This means resolution can have happened before, or happens in this method
78
+ * @param identifier
79
+ * @param context
80
+ */
81
+ function ensureManagedIdentifierResult(identifier, context) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const { lazyDisabled = false } = identifier;
84
+ return !lazyDisabled && isManagedIdentifierResult(identifier) ? identifier : yield getManagedIdentifier(identifier, context);
85
+ });
86
+ }
87
+ /**
88
+ * This function is just a convenience function to get a common result. The user already apparently had a key, so could have called the kid version as well
89
+ * @param opts
90
+ * @param _context
91
+ */
92
+ function getManagedKeyIdentifier(opts, _context) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ var _a, _b, _c, _d, _e, _f, _g;
95
+ const method = 'key';
96
+ const key = opts.identifier;
97
+ if (opts.kmsKeyRef && opts.kmsKeyRef !== key.kid) {
98
+ return Promise.reject(Error(`Cannot get a managed key object by providing a key and a kmsKeyRef that are different.}`));
99
+ }
100
+ const jwk = (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, key.type, { key });
101
+ const jwkThumbprint = (_b = (_a = key.meta) === null || _a === void 0 ? void 0 : _a.jwkThumbprint) !== null && _b !== void 0 ? _b : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
102
+ const kid = (_f = (_c = opts.kid) !== null && _c !== void 0 ? _c : (_e = (_d = key.meta) === null || _d === void 0 ? void 0 : _d.verificationMethod) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : jwkThumbprint;
103
+ const issuer = (_g = opts.issuer) !== null && _g !== void 0 ? _g : kid; // The different identifiers should set the value. Defaults to the kid
104
+ return {
105
+ method,
106
+ key,
107
+ identifier: key,
108
+ jwk,
109
+ jwkThumbprint,
110
+ kid,
111
+ issuer,
112
+ kmsKeyRef: key.kid,
113
+ clientId: opts.clientId,
114
+ clientIdScheme: opts.clientIdScheme,
115
+ opts,
116
+ };
117
+ });
118
+ }
119
+ /**
120
+ * This function is just a convenience function to get a common result. The user already apparently had a key, so could have called the kid version as well
121
+ * @param opts
122
+ * @param context
123
+ */
124
+ function getManagedCoseKeyIdentifier(opts, context) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ var _a, _b, _c;
127
+ const method = 'cose_key';
128
+ const coseKey = opts.identifier;
129
+ if (!(0, ssi_sdk_agent_config_1.contextHasKeyManager)(context)) {
130
+ return Promise.reject(Error(`Cannot get Cose Key identifier if KeyManager plugin is not enabled!`));
131
+ }
132
+ const jwk = (0, ssi_sdk_ext_key_utils_1.coseKeyToJwk)(coseKey);
133
+ const jwkThumbprint = (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
134
+ const key = yield context.agent.keyManagerGet({ kid: (_a = opts.kmsKeyRef) !== null && _a !== void 0 ? _a : jwkThumbprint });
135
+ const kid = (_c = (_b = opts.kid) !== null && _b !== void 0 ? _b : coseKey.kid) !== null && _c !== void 0 ? _c : jwkThumbprint;
136
+ const issuer = opts.issuer;
137
+ return {
138
+ method,
139
+ key,
140
+ identifier: opts.identifier,
141
+ jwk,
142
+ jwkThumbprint,
143
+ kid,
144
+ issuer,
145
+ kmsKeyRef: key.kid,
146
+ clientId: opts.clientId,
147
+ clientIdScheme: opts.clientIdScheme,
148
+ opts,
149
+ };
150
+ });
151
+ }
152
+ function getManagedDidIdentifier(opts, context) {
153
+ return __awaiter(this, void 0, void 0, function* () {
154
+ var _a, _b, _c, _d, _e, _f, _g;
155
+ const method = 'did';
156
+ if (!(0, ssi_sdk_agent_config_1.contextHasDidManager)(context)) {
157
+ return Promise.reject(Error(`Cannot get DID identifier if DID Manager plugin is not enabled!`));
158
+ }
159
+ let identifier;
160
+ if (typeof opts.identifier === 'string') {
161
+ identifier = yield context.agent.didManagerGet({ did: opts.identifier.split('#')[0] });
162
+ }
163
+ else {
164
+ identifier = opts.identifier;
165
+ }
166
+ const did = identifier.did;
167
+ const keys = identifier === null || identifier === void 0 ? void 0 : identifier.keys; // fixme: We really want to return the vmRelationship keys here actually
168
+ const extendedKey = yield (0, ssi_sdk_ext_did_utils_1.getFirstKeyWithRelation)(Object.assign(Object.assign({}, opts), { identifier, vmRelationship: (_a = opts.vmRelationship) !== null && _a !== void 0 ? _a : 'verificationMethod' }), context);
169
+ const key = extendedKey;
170
+ const controllerKeyId = identifier.controllerKeyId;
171
+ const jwk = (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, key.type, { key });
172
+ const jwkThumbprint = (_c = (_b = key.meta) === null || _b === void 0 ? void 0 : _b.jwkThumbprint) !== null && _c !== void 0 ? _c : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
173
+ let kid = (_d = opts.kid) !== null && _d !== void 0 ? _d : (_f = (_e = extendedKey.meta) === null || _e === void 0 ? void 0 : _e.verificationMethod) === null || _f === void 0 ? void 0 : _f.id;
174
+ if (!kid.startsWith(did)) {
175
+ // Make sure we create a fully qualified kid
176
+ const hash = kid.startsWith('#') ? '' : '#';
177
+ kid = `${did}${hash}${kid}`;
178
+ }
179
+ const issuer = (_g = opts.issuer) !== null && _g !== void 0 ? _g : did;
180
+ return {
181
+ method,
182
+ key,
183
+ did,
184
+ kmsKeyRef: key.kid,
185
+ jwk,
186
+ jwkThumbprint,
187
+ controllerKeyId,
188
+ kid,
189
+ keys,
190
+ issuer,
191
+ identifier,
192
+ clientId: opts.clientId,
193
+ clientIdScheme: opts.clientIdScheme,
194
+ opts,
195
+ };
196
+ });
197
+ }
198
+ function getManagedJwkIdentifier(opts, context) {
199
+ return __awaiter(this, void 0, void 0, function* () {
200
+ var _a, _b, _c, _d;
201
+ const method = 'jwk';
202
+ const { kid, issuer } = opts;
203
+ if (!(0, ssi_sdk_agent_config_1.contextHasKeyManager)(context)) {
204
+ return Promise.reject(Error(`Cannot get Key/JWK identifier if KeyManager plugin is not enabled!`));
205
+ }
206
+ const key = yield context.agent.keyManagerGet({ kid: (_a = opts.kmsKeyRef) !== null && _a !== void 0 ? _a : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk: opts.identifier }) });
207
+ const jwk = (_b = opts.identifier) !== null && _b !== void 0 ? _b : (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, key.type, { key });
208
+ const jwkThumbprint = (_d = (_c = key.meta) === null || _c === void 0 ? void 0 : _c.jwkThumbprint) !== null && _d !== void 0 ? _d : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
209
+ // we explicitly do not set the kid and issuer, meaning it can remain null. Normally you do not provide a kid and issuer with Jwks.
210
+ return {
211
+ method,
212
+ key,
213
+ kmsKeyRef: key.kid,
214
+ identifier: jwk,
215
+ jwk,
216
+ jwkThumbprint,
217
+ kid,
218
+ issuer,
219
+ clientId: opts.clientId,
220
+ clientIdScheme: opts.clientIdScheme,
221
+ opts,
222
+ };
223
+ });
224
+ }
225
+ function getManagedX5cIdentifier(opts, context) {
226
+ return __awaiter(this, void 0, void 0, function* () {
227
+ var _a;
228
+ const { kid, issuer } = opts;
229
+ const method = 'x5c';
230
+ const x5c = opts.identifier;
231
+ if (x5c.length === 0) {
232
+ return Promise.reject(`Cannot resolve x5c when an empty x5c is passed in`);
233
+ }
234
+ else if (!(0, ssi_sdk_agent_config_1.contextHasKeyManager)(context)) {
235
+ return Promise.reject(Error(`Cannot get X5c identifier if KeyManager plugin is not enabled!`));
236
+ }
237
+ const cryptoImpl = (0, ssi_sdk_ext_key_utils_1.globalCrypto)(false, opts.crypto);
238
+ const certificate = (0, ssi_sdk_ext_x509_utils_1.pemOrDerToX509Certificate)(x5c[0]);
239
+ const cryptoEngine = new pkijs_1.CryptoEngine({ name: 'identifier_resolver_managed', crypto: cryptoImpl });
240
+ (0, pkijs_1.setEngine)(cryptoEngine.name, cryptoEngine);
241
+ const pk = yield certificate.getPublicKey(undefined, cryptoEngine);
242
+ const jwk = (yield cryptoEngine.subtle.exportKey('jwk', pk));
243
+ const jwkThumbprint = (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
244
+ const key = yield context.agent.keyManagerGet({ kid: (_a = opts.kmsKeyRef) !== null && _a !== void 0 ? _a : jwkThumbprint });
245
+ // we explicitly do not set the kid and issuer, meaning it can remain null. Normally you do not provide a kid and issuer with x5c.
246
+ return {
247
+ method,
248
+ x5c,
249
+ identifier: x5c,
250
+ certificate,
251
+ jwk,
252
+ jwkThumbprint,
253
+ key,
254
+ kmsKeyRef: key.kid,
255
+ kid,
256
+ issuer,
257
+ clientId: opts.clientId,
258
+ clientIdScheme: opts.clientIdScheme,
259
+ opts,
260
+ };
261
+ });
262
+ }
263
+ function getManagedOID4VCIssuerIdentifier(opts, context) {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ const { identifier } = opts;
266
+ const method = 'oid4vci-issuer';
267
+ // FIXME: We need to eventually determine the JWK based on the issuer. Using a dummy JWK for now
268
+ const jwk = {
269
+ kty: 'RSA',
270
+ kid: 'dummy-jwk-for-vci-issuer-signing',
271
+ use: 'sig',
272
+ n: 'pjdss8ZaDfEH6K6U7GeW2nxDqR4IP049fk1fK0lndimbMMVBdPv_hSpm8T8EtBDxrUdi1OHZfMhUixGaut-3nQ4GG9nM249oxhCtxqqNvEXrmQRGqczyLxuh-fKn9Fg--hS9UpazHpfVAFnB5aCfXoNhPuI8oByyFKMKaOVgHNqP5NBEqabiLftZD3W_lsFCPGuzr4Vp0YS7zS2hDYScC2oOMu4rGU1LcMZf39p3153Cq7bS2Xh6Y-vw5pwzFYZdjQxDn8x8BG3fJ6j8TGLXQsbKH1218_HcUJRvMwdpbUQG5nvA2GXVqLqdwp054Lzk9_B_f1lV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F--Sq9LOrTE9QV988SJy_yUrAjcZ5MmECk',
279
+ qi: 'ldHXIrEmMZVaNwGzDF9WG8sHj2mOZmQpw9yrjLK9hAsmsNr5LTyqWAqJIYZSwPTYWhY4nu2O0EY9G9uYiqewXfCKw_UngrJt8Xwfq1Zruz0YY869zPN4GiE9-9rzdZB33RBw8kIOquY3MK74FMwCihYx_LiU2YTHkaoJ3ncvtvg',
280
+ };
281
+ const jwkThumbprint = (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
282
+ const key = {
283
+ kid: 'dummy-key-for-vci-issuer-signing',
284
+ kms: 'local',
285
+ type: 'RSA',
286
+ publicKeyHex: '9a3f75b2e4d8b91128fc6e9a8f6782e5a4f1cba3718e58b5d0a789d6e5f52b3a',
287
+ };
288
+ return {
289
+ method,
290
+ identifier,
291
+ jwk,
292
+ jwkThumbprint,
293
+ key, // FIXME: We need construct a key as soon as we have the external VCI Issuer resolution
294
+ kmsKeyRef: identifier, // FIXME: We need use kmsKeyRef as soon as we have the external VCI Issuer resolution
295
+ issuer: identifier.replace('/.well-known/openid-credential-issuer', ''),
296
+ clientId: opts.clientId,
297
+ clientIdScheme: opts.clientIdScheme,
298
+ opts,
299
+ };
300
+ });
301
+ }
302
+ function getManagedIdentifier(opts, context) {
303
+ return __awaiter(this, void 0, void 0, function* () {
304
+ let resolutionResult;
305
+ if (isManagedIdentifierResult(opts)) {
306
+ opts;
307
+ }
308
+ if ((0, types_1.isManagedIdentifierKidOpts)(opts)) {
309
+ resolutionResult = yield getManagedKidIdentifier(opts, context);
310
+ }
311
+ else if ((0, types_1.isManagedIdentifierDidOpts)(opts)) {
312
+ resolutionResult = yield getManagedDidIdentifier(opts, context);
313
+ }
314
+ else if ((0, types_1.isManagedIdentifierJwkOpts)(opts)) {
315
+ resolutionResult = yield getManagedJwkIdentifier(opts, context);
316
+ }
317
+ else if ((0, types_1.isManagedIdentifierX5cOpts)(opts)) {
318
+ resolutionResult = yield getManagedX5cIdentifier(opts, context);
319
+ }
320
+ else if ((0, types_1.isManagedIdentifierKeyOpts)(opts)) {
321
+ resolutionResult = yield getManagedKeyIdentifier(opts, context);
322
+ }
323
+ else if ((0, types_1.isManagedIdentifierCoseKeyOpts)(opts)) {
324
+ resolutionResult = yield getManagedCoseKeyIdentifier(opts, context);
325
+ }
326
+ else if ((0, types_1.isManagedIdentifierOID4VCIssuerOpts)(opts)) {
327
+ resolutionResult = yield getManagedOID4VCIssuerIdentifier(opts, context);
328
+ }
329
+ else {
330
+ return Promise.reject(Error(`Could not determine identifier method. Please provide explicitly`));
331
+ }
332
+ const { key } = resolutionResult;
333
+ if ((!key && !(0, types_1.isManagedIdentifierOID4VCIssuerOpts)(opts)) ||
334
+ ((0, types_1.isManagedIdentifierDidOpts)(opts) && (0, types_1.isManagedIdentifierDidResult)(resolutionResult) && !resolutionResult.identifier)) {
335
+ console.log(`Cannot find identifier`, opts.identifier);
336
+ return Promise.reject(`Cannot find identifier ${opts.identifier}`);
337
+ }
338
+ return resolutionResult;
339
+ });
340
+ }
341
+ function managedIdentifierToKeyResult(identifier, context) {
342
+ return __awaiter(this, void 0, void 0, function* () {
343
+ const resolved = yield ensureManagedIdentifierResult(identifier, context);
344
+ if ((0, types_1.isManagedIdentifierKeyResult)(resolved)) {
345
+ return resolved;
346
+ }
347
+ return Object.assign(Object.assign({}, resolved), { method: 'key', identifier: resolved.key });
348
+ });
349
+ }
350
+ function managedIdentifierToJwk(identifier, context) {
351
+ return __awaiter(this, void 0, void 0, function* () {
352
+ const resolved = yield ensureManagedIdentifierResult(identifier, context);
353
+ if ((0, types_1.isManagedIdentifierJwkResult)(resolved)) {
354
+ return resolved;
355
+ }
356
+ return Object.assign(Object.assign({}, resolved), { method: 'jwk', identifier: resolved.jwk });
357
+ });
358
+ }
359
+ //# sourceMappingURL=managedIdentifierFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managedIdentifierFunctions.js","sourceRoot":"","sources":["../../src/functions/managedIdentifierFunctions.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