@sphereon/ssi-sdk-ext.identifier-resolution 0.24.1-next.84 → 0.24.1-next.93

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.
@@ -14,7 +14,8 @@ export declare class IdentifierResolution implements IAgentPlugin {
14
14
  crypto?: Crypto;
15
15
  });
16
16
  /**
17
- * Main method for managed identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
17
+ * Main method for managed identifiers. We always go through this method (also the other methods below) as we want to
18
+ * integrate a plugin for anomaly detection. Having a single method helps
18
19
  * @param args
19
20
  * @param context
20
21
  * @private
@@ -22,6 +23,7 @@ export declare class IdentifierResolution implements IAgentPlugin {
22
23
  private identifierGetManaged;
23
24
  private identifierGetManagedByDid;
24
25
  private identifierGetManagedByKid;
26
+ private identifierGetManagedByKey;
25
27
  private identifierGetManagedByJwk;
26
28
  private identifierGetManagedByX5c;
27
29
  private identifierResolveExternal;
@@ -1 +1 @@
1
- {"version":3,"file":"IdentifierResolution.d.ts","sourceRoot":"","sources":["../../src/agent/IdentifierResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAA4B,MAAM,cAAc,CAAA;AAGpF,OAAO,EAOL,qBAAqB,EAWtB,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAEhC,QAAQ,CAAC,MAAM,MAAgC;IAC/C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAYtC;IAED;;OAEG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAItC;;;;;OAKG;YACW,oBAAoB;YAIpB,yBAAyB;YAOzB,yBAAyB;YAIzB,yBAAyB;YAIzB,yBAAyB;YAIzB,yBAAyB;YAIzB,8BAA8B;YAI9B,8BAA8B;CAG7C"}
1
+ {"version":3,"file":"IdentifierResolution.d.ts","sourceRoot":"","sources":["../../src/agent/IdentifierResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAA4B,MAAM,cAAc,CAAA;AAGpF,OAAO,EAOL,qBAAqB,EAWtB,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAEhC,QAAQ,CAAC,MAAM,MAAgC;IAC/C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAatC;IAED;;OAEG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAItC;;;;;;OAMG;YACW,oBAAoB;YAIpB,yBAAyB;YAOzB,yBAAyB;YAIzB,yBAAyB;YAIzB,yBAAyB;YAIzB,yBAAyB;YAIzB,yBAAyB;YAIzB,8BAA8B;YAI9B,8BAA8B;CAG7C"}
@@ -28,6 +28,7 @@ class IdentifierResolution {
28
28
  identifierManagedGetByKid: this.identifierGetManagedByKid.bind(this),
29
29
  identifierManagedGetByJwk: this.identifierGetManagedByJwk.bind(this),
30
30
  identifierManagedGetByX5c: this.identifierGetManagedByX5c.bind(this),
31
+ identifierManagedGetByKey: this.identifierGetManagedByKey.bind(this),
31
32
  identifierExternalResolve: this.identifierResolveExternal.bind(this),
32
33
  identifierExternalResolveByDid: this.identifierExternalResolveByDid.bind(this),
33
34
  identifierExternalResolveByX5c: this.identifierExternalResolveByX5c.bind(this),
@@ -36,7 +37,8 @@ class IdentifierResolution {
36
37
  this._crypto = (_a = opts === null || opts === void 0 ? void 0 : opts.crypto) !== null && _a !== void 0 ? _a : global.crypto;
37
38
  }
38
39
  /**
39
- * Main method for managed identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
40
+ * Main method for managed identifiers. We always go through this method (also the other methods below) as we want to
41
+ * integrate a plugin for anomaly detection. Having a single method helps
40
42
  * @param args
41
43
  * @param context
42
44
  * @private
@@ -56,6 +58,11 @@ class IdentifierResolution {
56
58
  return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'kid' }), context));
57
59
  });
58
60
  }
61
+ identifierGetManagedByKey(args, context) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'key' }), context));
64
+ });
65
+ }
59
66
  identifierGetManagedByJwk(args, context) {
60
67
  return __awaiter(this, void 0, void 0, function* () {
61
68
  return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'jwk' }), context));
@@ -1 +1 @@
1
- {"version":3,"file":"IdentifierResolution.js","sourceRoot":"","sources":["../../src/agent/IdentifierResolution.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0BAA2B;AAC3B,4CAA8E;AAqB9E;;GAEG;AACH,MAAa,oBAAoB;IAkB/B;;OAEG;IACH,YAAY,IAA0B;;QAlB7B,WAAM,GAAG,UAAM,CAAC,sBAAsB,CAAA;QACtC,YAAO,GAA0B;YACxC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1D,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;YACpE,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;YACpE,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;YACpE,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;YAEpE,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;YACpE,8BAA8B,EAAE,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9E,8BAA8B,EAAE,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC;YAE9E,qGAAqG;SACtG,CAA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mC;;YACvG,OAAO,MAAM,IAAA,qCAAyB,kCAAM,IAAI,KAAE,MAAM,EAAE,IAAI,CAAC,OAAO,KAAI,OAAO,CAAC,CAAA;QACpF,CAAC;KAAA;IAEa,8BAA8B,CAAC,IAA+B,EAAE,OAA2B;;YACvG,OAAO,CAAC,MAAM,IAAI,CAAC,yBAAyB,iCAAM,IAAI,KAAE,MAAM,EAAE,KAAK,KAAI,OAAO,CAAC,CAAgC,CAAA;QACnH,CAAC;KAAA;IAEa,8BAA8B,CAAC,IAA+B,EAAE,OAA2B;;YACvG,OAAO,CAAC,MAAM,IAAI,CAAC,yBAAyB,iCAAM,IAAI,KAAE,MAAM,EAAE,KAAK,KAAI,OAAO,CAAC,CAAgC,CAAA;QACnH,CAAC;KAAA;CACF;AAvED,oDAuEC"}
@@ -1,6 +1,19 @@
1
+ import { IRequiredContext } from '@sphereon/ssi-sdk-ext.did-provider-jwk';
1
2
  import { IAgentContext, IKeyManager } from '@veramo/core';
2
- import { ManagedIdentifierDidOpts, ManagedIdentifierDidResult, ManagedIdentifierJwkOpts, ManagedIdentifierJwkResult, ManagedIdentifierKidOpts, ManagedIdentifierKidResult, ManagedIdentifierOpts, ManagedIdentifierResult, ManagedIdentifierX5cOpts, ManagedIdentifierX5cResult } from '../types';
3
+ import { ManagedIdentifierDidOpts, ManagedIdentifierDidResult, ManagedIdentifierJwkOpts, ManagedIdentifierJwkResult, ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, ManagedIdentifierKidOpts, ManagedIdentifierKidResult, ManagedIdentifierOpts, ManagedIdentifierOptsOrResult, ManagedIdentifierResult, ManagedIdentifierX5cOpts, ManagedIdentifierX5cResult } from '../types';
3
4
  export declare function getManagedKidIdentifier(opts: ManagedIdentifierKidOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKidResult>;
5
+ /**
6
+ * 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
7
+ * @param identifier
8
+ * @param context
9
+ */
10
+ export declare function ensureManagedIdentifierResult(identifier: ManagedIdentifierOptsOrResult, context: IRequiredContext): Promise<ManagedIdentifierResult>;
11
+ /**
12
+ * 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
13
+ * @param opts
14
+ * @param _context
15
+ */
16
+ export declare function getManagedKeyIdentifier(opts: ManagedIdentifierKeyOpts, _context?: IAgentContext<any>): Promise<ManagedIdentifierKeyResult>;
4
17
  export declare function getManagedDidIdentifier(opts: ManagedIdentifierDidOpts, context: IAgentContext<any>): Promise<ManagedIdentifierDidResult>;
5
18
  export declare function getManagedJwkIdentifier(opts: ManagedIdentifierJwkOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierJwkResult>;
6
19
  export declare function getManagedX5cIdentifier(opts: ManagedIdentifierX5cOpts & {
@@ -1 +1 @@
1
- {"version":3,"file":"managedIdentifierFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/managedIdentifierFunctions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAe,WAAW,EAAE,MAAM,cAAc,CAAA;AAEtE,OAAO,EAML,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,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,CAmBrC;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA0C9I;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,wBAAwB,EAC9B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,0BAA0B,CAAC,CAmBrC;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,wBAAwB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,0BAA0B,CAAC,CA8BrC;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,qBAAqB,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAmBlC"}
1
+ {"version":3,"file":"managedIdentifierFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/managedIdentifierFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAKzE,OAAO,EAAE,aAAa,EAAqB,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5E,OAAO,EAOL,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,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,CAoBrC;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,6BAA6B,EACzC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,uBAAuB,CAAC,CAIlC;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAoBhJ;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAgD9I;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,wBAAwB,EAC9B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,0BAA0B,CAAC,CAoBrC;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,wBAAwB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,0BAA0B,CAAC,CA+BrC;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,qBAAqB,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAqBlC"}
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getManagedIdentifier = exports.getManagedX5cIdentifier = exports.getManagedJwkIdentifier = exports.getManagedDidIdentifier = exports.getManagedKidIdentifier = void 0;
12
+ exports.getManagedIdentifier = exports.getManagedX5cIdentifier = exports.getManagedJwkIdentifier = exports.getManagedDidIdentifier = exports.getManagedKeyIdentifier = exports.ensureManagedIdentifierResult = exports.getManagedKidIdentifier = void 0;
13
13
  const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
14
14
  const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
15
15
  const ssi_sdk_ext_x509_utils_1 = require("@sphereon/ssi-sdk-ext.x509-utils");
@@ -36,10 +36,54 @@ function getManagedKidIdentifier(opts, context) {
36
36
  kid,
37
37
  issuer,
38
38
  kmsKeyRef: key.kid,
39
+ opts,
39
40
  };
40
41
  });
41
42
  }
42
43
  exports.getManagedKidIdentifier = getManagedKidIdentifier;
44
+ /**
45
+ * 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
46
+ * @param identifier
47
+ * @param context
48
+ */
49
+ function ensureManagedIdentifierResult(identifier, context) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ return 'key' in identifier && 'kmsKeyRef' in identifier && 'method' in identifier && !('identifier' in identifier)
52
+ ? identifier
53
+ : yield context.agent.identifierManagedGet(identifier);
54
+ });
55
+ }
56
+ exports.ensureManagedIdentifierResult = ensureManagedIdentifierResult;
57
+ /**
58
+ * 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
59
+ * @param opts
60
+ * @param _context
61
+ */
62
+ function getManagedKeyIdentifier(opts, _context) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ var _a, _b, _c, _d, _e, _f, _g;
65
+ const method = 'key';
66
+ const key = opts.identifier;
67
+ if (opts.kmsKeyRef && opts.kmsKeyRef !== key.kid) {
68
+ return Promise.reject(Error(`Cannot get a managed key object by providing a key and a kmsKeyRef that are different.}`));
69
+ }
70
+ const jwk = (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, key.type, { key });
71
+ 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 });
72
+ 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;
73
+ const issuer = (_g = opts.issuer) !== null && _g !== void 0 ? _g : kid; // The different identifiers should set the value. Defaults to the kid
74
+ return {
75
+ method,
76
+ key,
77
+ jwk,
78
+ jwkThumbprint,
79
+ kid,
80
+ issuer,
81
+ kmsKeyRef: key.kid,
82
+ opts,
83
+ };
84
+ });
85
+ }
86
+ exports.getManagedKeyIdentifier = getManagedKeyIdentifier;
43
87
  function getManagedDidIdentifier(opts, context) {
44
88
  return __awaiter(this, void 0, void 0, function* () {
45
89
  var _a, _b, _c, _d, _e, _f, _g;
@@ -61,7 +105,12 @@ function getManagedDidIdentifier(opts, context) {
61
105
  const controllerKeyId = identifier.controllerKeyId;
62
106
  const jwk = (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, key.type, { key });
63
107
  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 });
64
- const 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;
108
+ 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;
109
+ if (!kid.startsWith(did)) {
110
+ // Make sure we create a fully qualified kid
111
+ const hash = kid.startsWith('#') ? '' : '#';
112
+ kid = `${did}${hash}${kid}`;
113
+ }
65
114
  const issuer = (_g = opts.issuer) !== null && _g !== void 0 ? _g : did;
66
115
  return {
67
116
  method,
@@ -75,6 +124,7 @@ function getManagedDidIdentifier(opts, context) {
75
124
  keys,
76
125
  issuer,
77
126
  identifier,
127
+ opts,
78
128
  };
79
129
  });
80
130
  }
@@ -99,6 +149,7 @@ function getManagedJwkIdentifier(opts, context) {
99
149
  jwkThumbprint,
100
150
  kid,
101
151
  issuer,
152
+ opts,
102
153
  };
103
154
  });
104
155
  }
@@ -134,6 +185,7 @@ function getManagedX5cIdentifier(opts, context) {
134
185
  kmsKeyRef: key.kid,
135
186
  kid,
136
187
  issuer,
188
+ opts,
137
189
  };
138
190
  });
139
191
  }
@@ -153,6 +205,9 @@ function getManagedIdentifier(opts, context) {
153
205
  else if ((0, types_1.isManagedIdentifierX5cOpts)(opts)) {
154
206
  resolutionResult = yield getManagedX5cIdentifier(opts, context);
155
207
  }
208
+ else if ((0, types_1.isManagedIdentifierKeyOpts)(opts)) {
209
+ resolutionResult = yield getManagedKeyIdentifier(opts, context);
210
+ }
156
211
  else {
157
212
  return Promise.reject(Error(`Could not determine identifier method. Please provide explicitly`));
158
213
  }
@@ -1 +1 @@
1
- {"version":3,"file":"managedIdentifierFunctions.js","sourceRoot":"","sources":["../../src/functions/managedIdentifierFunctions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAAyE;AACzE,2EAAoF;AACpF,6EAA4E;AAC5E,yEAA2F;AAE3F,iCAA+C;AAC/C,oCAgBiB;AAEjB,SAAsB,uBAAuB,CAC3C,IAA8B,EAC9B,OAAmC;;;QAEnC,MAAM,MAAM,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,IAAA,2CAAoB,EAAC,OAAO,CAAC,EAAE,CAAC;YACnC,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC,CAAA;QACpG,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QACzF,MAAM,GAAG,GAAG,IAAA,6BAAK,EAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QACtD,MAAM,aAAa,GAAG,MAAC,MAAA,GAAG,CAAC,IAAI,0CAAE,aAAwB,mCAAI,IAAA,8CAAsB,EAAC,EAAE,GAAG,EAAE,CAAC,CAAA;QAC5F,MAA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ext, IDIDManager, IKeyManager, IPluginMethodMap } from '@veramo/core';
2
2
  import { ExternalIdentifierDidOpts, ExternalIdentifierDidResult, ExternalIdentifierOpts, ExternalIdentifierResult, ExternalIdentifierX5cOpts, ExternalIdentifierX5cResult } from './externalIdentifierTypes';
3
- import { ManagedIdentifierDidOpts, ManagedIdentifierDidResult, ManagedIdentifierJwkOpts, ManagedIdentifierJwkResult, ManagedIdentifierKidOpts, ManagedIdentifierKidResult, ManagedIdentifierOpts, ManagedIdentifierResult, ManagedIdentifierX5cOpts, ManagedIdentifierX5cResult } from './managedIdentifierTypes';
3
+ import { ManagedIdentifierDidOpts, ManagedIdentifierDidResult, ManagedIdentifierJwkOpts, ManagedIdentifierJwkResult, ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, ManagedIdentifierKidOpts, ManagedIdentifierKidResult, ManagedIdentifierOpts, ManagedIdentifierResult, ManagedIdentifierX5cOpts, ManagedIdentifierX5cResult } from './managedIdentifierTypes';
4
4
  /**
5
5
  * @public
6
6
  */
7
7
  export interface IIdentifierResolution extends IPluginMethodMap {
8
8
  /**
9
9
  * Main method for managed identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
10
+ *
11
+ * The end result of all these methods is a common baseline response that allows to use a key from the registered KMS systems. It also provides kid and iss(uer) values that can be used in a JWT/JWS for instance
10
12
  * @param args
11
13
  * @param context
12
14
  * @public
@@ -16,6 +18,7 @@ export interface IIdentifierResolution extends IPluginMethodMap {
16
18
  identifierManagedGetByKid(args: ManagedIdentifierKidOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKidResult>;
17
19
  identifierManagedGetByJwk(args: ManagedIdentifierJwkOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierJwkResult>;
18
20
  identifierManagedGetByX5c(args: ManagedIdentifierX5cOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierX5cResult>;
21
+ identifierManagedGetByKey(args: ManagedIdentifierKeyOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKeyResult>;
19
22
  /**
20
23
  * Main method for external identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
21
24
  * @param args
@@ -1 +1 @@
1
- {"version":3,"file":"IIdentifierResolution.d.ts","sourceRoot":"","sources":["../../src/types/IIdentifierResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAA;AAEjC;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D;;;;;OAKG;IACH,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;IAExH,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAEjJ,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAEnI,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAEnI,yBAAyB,CAAC,IAAI,EAAE,w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,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAEjJ,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAEnI,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAEnI,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAEnI,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAInI;;;;;OAKG;IACH,yBAAyB,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAA;IAEvH,8BAA8B,CAAC,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAA;IAElI,8BAA8B,CAAC,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAA;CACnI"}
@@ -1,5 +1,5 @@
1
1
  import { JWK } from '@sphereon/ssi-sdk-ext.key-utils';
2
- import { IIdentifier } from '@veramo/core';
2
+ import { IIdentifier, IKey } from '@veramo/core';
3
3
  import { ExternalIdentifierType } from './externalIdentifierTypes';
4
4
  import { ManagedIdentifierType } from './managedIdentifierTypes';
5
5
  export interface JwkInfo {
@@ -12,5 +12,6 @@ export declare function isJwkIdentifier(identifier: ManagedIdentifierType | Exte
12
12
  export declare function isOidcDiscoveryIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string;
13
13
  export declare function isJwksUrlIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string;
14
14
  export declare function isKidIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string;
15
+ export declare function isKeyIdentifier(identifier: ManagedIdentifierType): identifier is IKey;
15
16
  export declare function isX5cIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string[];
16
17
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,GAAG,CAAA;IACR,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,UAAU,IAAI,WAAW,GAAG,MAAM,CAE9H;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,UAAU,IAAI,WAAW,CAEnH;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,UAAU,IAAI,GAAG,CAE7G;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,UAAU,IAAI,MAAM,CAE1H;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,UAAU,IAAI,MAAM,CAEpH;AAED,wBAAgB,eAAe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qB,GAAG,sBAAsB,GAAG,UAAU,IAAI,MAAM,EAAE,CAElH"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isX5cIdentifier = exports.isKidIdentifier = exports.isJwksUrlIdentifier = exports.isOidcDiscoveryIdentifier = exports.isJwkIdentifier = exports.isIIdentifier = exports.isDidIdentifier = void 0;
3
+ exports.isX5cIdentifier = exports.isKeyIdentifier = exports.isKidIdentifier = exports.isJwksUrlIdentifier = exports.isOidcDiscoveryIdentifier = exports.isJwkIdentifier = exports.isIIdentifier = exports.isDidIdentifier = void 0;
4
4
  function isDidIdentifier(identifier) {
5
5
  return isIIdentifier(identifier) || (typeof identifier === 'string' && identifier.startsWith('did:'));
6
6
  }
@@ -25,6 +25,14 @@ function isKidIdentifier(identifier) {
25
25
  return typeof identifier === 'string' && !identifier.startsWith('did:');
26
26
  }
27
27
  exports.isKidIdentifier = isKidIdentifier;
28
+ function isKeyIdentifier(identifier) {
29
+ return (typeof identifier === 'string' &&
30
+ !Array.isArray(identifier) &&
31
+ typeof identifier === 'object' &&
32
+ `kid` in identifier &&
33
+ 'publicKeyHex' in identifier);
34
+ }
35
+ exports.isKeyIdentifier = isKeyIdentifier;
28
36
  function isX5cIdentifier(identifier) {
29
37
  return Array.isArray(identifier) && identifier.length > 0; // todo: Do we want to do additional validation? We know it must be DER and thus hex for instance
30
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":";;;AAUA,SAAgB,eAAe,CAAC,UAA0D;IACxF,OAAO,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;AACvG,CAAC;AAFD,0CAEC;AAED,SAAgB,aAAa,CAAC,UAA0D;IACtF,OAAO,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,KAAK,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,MAAM,GAAG,CAAC,CAAA,CAAC,iGAAiG;AAC7J,CAAC;AAFD,0CAEC"}
@@ -4,10 +4,10 @@ import { JwkInfo } from './common';
4
4
  /**
5
5
  * Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains
6
6
  *
7
- * The functions below can be used to check the type, and they also provide the proper runtime types
7
+ * The functions below can be used to check the type, and they also provide the proper 'runtime' types
8
8
  */
9
- export type ManagedIdentifierType = IIdentifier | string | string[] | JWK;
10
- export type ManagedIdentifierOpts = (ManagedIdentifierJwkOpts | ManagedIdentifierX5cOpts | ManagedIdentifierDidOpts | ManagedIdentifierKidOpts) & ManagedIdentifierOptsBase;
9
+ export type ManagedIdentifierType = IIdentifier | string | string[] | JWK | IKey;
10
+ export type ManagedIdentifierOpts = (ManagedIdentifierJwkOpts | ManagedIdentifierX5cOpts | ManagedIdentifierDidOpts | ManagedIdentifierKidOpts | ManagedIdentifierKeyOpts) & ManagedIdentifierOptsBase;
11
11
  export type ManagedIdentifierOptsBase = {
12
12
  method?: ManagedIdentifierMethod;
13
13
  identifier: ManagedIdentifierType;
@@ -30,6 +30,11 @@ export type ManagedIdentifierKidOpts = Omit<ManagedIdentifierOptsBase, 'method'>
30
30
  identifier: string;
31
31
  };
32
32
  export declare function isManagedIdentifierKidOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKidOpts;
33
+ export type ManagedIdentifierKeyOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
34
+ method?: 'key';
35
+ identifier: IKey;
36
+ };
37
+ export declare function isManagedIdentifierKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKidOpts;
33
38
  export type ManagedIdentifierJwkOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
34
39
  method?: 'jwk';
35
40
  identifier: JWK;
@@ -45,14 +50,16 @@ export interface ManagedJwkInfo extends JwkInfo {
45
50
  }
46
51
  export interface IManagedIdentifierResultBase extends ManagedJwkInfo {
47
52
  method: ManagedIdentifierMethod;
53
+ opts: ManagedIdentifierOpts;
48
54
  key: IKey;
49
55
  kid?: string;
50
56
  issuer?: string;
51
57
  }
52
58
  export declare function isManagedIdentifierDidResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierDidResult;
53
- export declare function isManagedIdentifierX5cResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierDidResult;
59
+ export declare function isManagedIdentifierX5cResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierX5cResult;
54
60
  export declare function isManagedIdentifierJwkResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierJwkResult;
55
61
  export declare function isManagedIdentifierKidResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierKidResult;
62
+ export declare function isManagedIdentifierKeyResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierKeyResult;
56
63
  export interface ManagedIdentifierDidResult extends IManagedIdentifierResultBase {
57
64
  method: 'did';
58
65
  identifier: IIdentifier;
@@ -71,11 +78,17 @@ export interface ManagedIdentifierKidResult extends IManagedIdentifierResultBase
71
78
  issuer: string;
72
79
  kid: string;
73
80
  }
81
+ export interface ManagedIdentifierKeyResult extends IManagedIdentifierResultBase {
82
+ method: 'key';
83
+ issuer: string;
84
+ kid: string;
85
+ }
74
86
  export interface ManagedIdentifierX5cResult extends IManagedIdentifierResultBase {
75
87
  method: 'x5c';
76
88
  x5c: string[];
77
89
  certificate: any;
78
90
  }
79
- export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid';
80
- export type ManagedIdentifierResult = IManagedIdentifierResultBase & (ManagedIdentifierX5cResult | ManagedIdentifierDidResult | ManagedIdentifierJwkResult | ManagedIdentifierKidResult);
91
+ export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'key';
92
+ export type ManagedIdentifierResult = IManagedIdentifierResultBase & (ManagedIdentifierX5cResult | ManagedIdentifierDidResult | ManagedIdentifierJwkResult | ManagedIdentifierKidResult | ManagedIdentifierKeyResult);
93
+ export type ManagedIdentifierOptsOrResult = ManagedIdentifierResult | ManagedIdentifierOpts;
81
94
  //# sourceMappingURL=managedIdentifierTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"managedIdentifierTypes.d.ts","sourceRoot":"","sources":["../../src/types/managedIdentifierTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAsE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEtG;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAW,MAAM,GAAkB,MAAM,EAAE,GAAW,GAAG,CAAA;AAExG,MAAM,MAAM,qBAAqB,GAAG,CAAC,wBAAwB,GAAG,wBAAwB,GAAG,wBAAwB,GAAG,wBAAwB,CAAC,GAC7I,yBAAyB,CAAA;AAE3B,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,CAAC,EAAE,uBAAuB,CAAA;IAChC,UAAU,EAAE,qBAAqB,CAAA;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,yBAAyB,EAAE,QAAQ,CAAC,GAAG;IACjF,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,UAAU,EAAE,WAAW,GAAG,MAAM,CAAA;IAChC,OAAO,CAAC,EAAE,QAAQ,CAAA;IAClB,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,kBAAkB,CAAA;CACpC,CAAA;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI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
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isManagedIdentifierKidResult = exports.isManagedIdentifierJwkResult = exports.isManagedIdentifierX5cResult = exports.isManagedIdentifierDidResult = exports.isManagedIdentifierX5cOpts = exports.isManagedIdentifierJwkOpts = exports.isManagedIdentifierKidOpts = exports.isManagedIdentifierDidOpts = void 0;
3
+ exports.isManagedIdentifierKeyResult = exports.isManagedIdentifierKidResult = exports.isManagedIdentifierJwkResult = exports.isManagedIdentifierX5cResult = exports.isManagedIdentifierDidResult = exports.isManagedIdentifierX5cOpts = exports.isManagedIdentifierJwkOpts = exports.isManagedIdentifierKeyOpts = exports.isManagedIdentifierKidOpts = exports.isManagedIdentifierDidOpts = void 0;
4
4
  const common_1 = require("./common");
5
5
  function isManagedIdentifierDidOpts(opts) {
6
6
  const { identifier } = opts;
@@ -12,6 +12,11 @@ function isManagedIdentifierKidOpts(opts) {
12
12
  return ('method' in opts && opts.method === 'kid') || (0, common_1.isKidIdentifier)(identifier);
13
13
  }
14
14
  exports.isManagedIdentifierKidOpts = isManagedIdentifierKidOpts;
15
+ function isManagedIdentifierKeyOpts(opts) {
16
+ const { identifier } = opts;
17
+ return ('method' in opts && opts.method === 'key') || (0, common_1.isKeyIdentifier)(identifier);
18
+ }
19
+ exports.isManagedIdentifierKeyOpts = isManagedIdentifierKeyOpts;
15
20
  function isManagedIdentifierJwkOpts(opts) {
16
21
  const { identifier } = opts;
17
22
  return ('method' in opts && opts.method === 'jwk') || (0, common_1.isJwkIdentifier)(identifier);
@@ -38,4 +43,8 @@ function isManagedIdentifierKidResult(object) {
38
43
  return object && typeof object === 'object' && 'method' in object && object.method === 'kid';
39
44
  }
40
45
  exports.isManagedIdentifierKidResult = isManagedIdentifierKidResult;
46
+ function isManagedIdentifierKeyResult(object) {
47
+ return object && typeof object === 'object' && 'method' in object && object.method === 'key';
48
+ }
49
+ exports.isManagedIdentifierKeyResult = isManagedIdentifierKeyResult;
41
50
  //# sourceMappingURL=managedIdentifierTyp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CAAC,MAAM,KAAK,KAAK,CAAA;AAChG,CAAC;AAFD,oEAEC;AAED,SAAgB,4BAA4B,CAAC,MAAoC;IAC/E,OAAO,MAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAA;AAChG,CAAC;AAFD,oEAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk-ext.identifier-resolution",
3
- "version": "0.24.1-next.84+bd95927",
3
+ "version": "0.24.1-next.93+d271292",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,9 +15,9 @@
15
15
  "generate-plugin-schema": "sphereon dev generate-plugin-schema"
16
16
  },
17
17
  "dependencies": {
18
- "@sphereon/ssi-sdk-ext.did-utils": "0.24.1-next.84+bd95927",
19
- "@sphereon/ssi-sdk-ext.key-utils": "0.24.1-next.84+bd95927",
20
- "@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-next.84+bd95927",
18
+ "@sphereon/ssi-sdk-ext.did-utils": "0.24.1-next.93+d271292",
19
+ "@sphereon/ssi-sdk-ext.key-utils": "0.24.1-next.93+d271292",
20
+ "@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-next.93+d271292",
21
21
  "@sphereon/ssi-sdk.agent-config": "0.29.1-unstable.75",
22
22
  "@sphereon/ssi-types": "0.29.1-unstable.75",
23
23
  "@veramo/core": "4.2.0",
@@ -27,10 +27,10 @@
27
27
  "uint8arrays": "^3.1.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@sphereon/ssi-sdk-ext.did-provider-jwk": "0.24.1-next.84+bd95927",
31
- "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-next.84+bd95927",
32
- "@sphereon/ssi-sdk-ext.key-manager": "0.24.1-next.84+bd95927",
33
- "@sphereon/ssi-sdk-ext.kms-local": "0.24.1-next.84+bd95927",
30
+ "@sphereon/ssi-sdk-ext.did-provider-jwk": "0.24.1-next.93+d271292",
31
+ "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-next.93+d271292",
32
+ "@sphereon/ssi-sdk-ext.key-manager": "0.24.1-next.93+d271292",
33
+ "@sphereon/ssi-sdk-ext.kms-local": "0.24.1-next.93+d271292",
34
34
  "@sphereon/ssi-sdk.dev": "0.29.1-unstable.75",
35
35
  "@veramo/data-store": "4.2.0",
36
36
  "@veramo/did-manager": "4.2.0",
@@ -64,5 +64,5 @@
64
64
  "X.509 Certificates",
65
65
  "ARF"
66
66
  ],
67
- "gitHead": "bd9592747486563be3919b8cb53ea8ae41ccfc94"
67
+ "gitHead": "d2712929c883f3f2e4dfce30b7b448c573f0b529"
68
68
  }
@@ -117,10 +117,19 @@
117
117
  "kty": {
118
118
  "type": "string"
119
119
  },
120
- "alg": {
120
+ "crv": {
121
121
  "type": "string"
122
122
  },
123
- "crv": {
123
+ "x": {
124
+ "type": "string"
125
+ },
126
+ "y": {
127
+ "type": "string"
128
+ },
129
+ "e": {
130
+ "type": "string"
131
+ },
132
+ "n": {
124
133
  "type": "string"
125
134
  },
126
135
  "d": {
@@ -132,9 +141,6 @@
132
141
  "dq": {
133
142
  "type": "string"
134
143
  },
135
- "e": {
136
- "type": "string"
137
- },
138
144
  "ext": {
139
145
  "type": "boolean"
140
146
  },
@@ -150,9 +156,6 @@
150
156
  "kid": {
151
157
  "type": "string"
152
158
  },
153
- "n": {
154
- "type": "string"
155
- },
156
159
  "oth": {
157
160
  "type": "array",
158
161
  "items": {
@@ -182,12 +185,6 @@
182
185
  "use": {
183
186
  "type": "string"
184
187
  },
185
- "x": {
186
- "type": "string"
187
- },
188
- "y": {
189
- "type": "string"
190
- },
191
188
  "x5c": {
192
189
  "type": "array",
193
190
  "items": {
@@ -208,10 +205,10 @@
208
205
  "description": "JWK \"x5u\" (X.509 URL) Parameter."
209
206
  }
210
207
  },
208
+ "additionalProperties": {},
211
209
  "required": [
212
210
  "kty"
213
- ],
214
- "additionalProperties": {}
211
+ ]
215
212
  },
216
213
  "DIDDocumentSection": {
217
214
  "type": "string",
@@ -1071,6 +1068,30 @@
1071
1068
  "required": [
1072
1069
  "identifier"
1073
1070
  ]
1071
+ },
1072
+ {
1073
+ "type": "object",
1074
+ "properties": {
1075
+ "method": {
1076
+ "type": "string",
1077
+ "const": "key"
1078
+ },
1079
+ "identifier": {
1080
+ "$ref": "#/components/schemas/ManagedIdentifierType"
1081
+ },
1082
+ "kmsKeyRef": {
1083
+ "type": "string"
1084
+ },
1085
+ "issuer": {
1086
+ "type": "string"
1087
+ },
1088
+ "kid": {
1089
+ "type": "string"
1090
+ }
1091
+ },
1092
+ "required": [
1093
+ "identifier"
1094
+ ]
1074
1095
  }
1075
1096
  ]
1076
1097
  },
@@ -1090,9 +1111,12 @@
1090
1111
  },
1091
1112
  {
1092
1113
  "$ref": "#/components/schemas/JWK"
1114
+ },
1115
+ {
1116
+ "$ref": "#/components/schemas/IKey"
1093
1117
  }
1094
1118
  ],
1095
- "description": "Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains\n\nThe functions below can be used to check the type, and they also provide the proper runtime types"
1119
+ "description": "Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains\n\nThe functions below can be used to check the type, and they also provide the proper 'runtime' types"
1096
1120
  },
1097
1121
  "IIdentifier": {
1098
1122
  "type": "object",
@@ -1269,6 +1293,9 @@
1269
1293
  "method": {
1270
1294
  "$ref": "#/components/schemas/ManagedIdentifierMethod"
1271
1295
  },
1296
+ "opts": {
1297
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1298
+ },
1272
1299
  "key": {
1273
1300
  "$ref": "#/components/schemas/IKey"
1274
1301
  },
@@ -1293,6 +1320,7 @@
1293
1320
  "key",
1294
1321
  "kmsKeyRef",
1295
1322
  "method",
1323
+ "opts",
1296
1324
  "x5c"
1297
1325
  ]
1298
1326
  },
@@ -1311,6 +1339,9 @@
1311
1339
  "method": {
1312
1340
  "$ref": "#/components/schemas/ManagedIdentifierMethod"
1313
1341
  },
1342
+ "opts": {
1343
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1344
+ },
1314
1345
  "key": {
1315
1346
  "$ref": "#/components/schemas/IKey"
1316
1347
  },
@@ -1349,7 +1380,45 @@
1349
1380
  "keys",
1350
1381
  "kid",
1351
1382
  "kmsKeyRef",
1352
- "method"
1383
+ "method",
1384
+ "opts"
1385
+ ]
1386
+ },
1387
+ {
1388
+ "type": "object",
1389
+ "properties": {
1390
+ "jwk": {
1391
+ "$ref": "#/components/schemas/JWK"
1392
+ },
1393
+ "jwkThumbprint": {
1394
+ "type": "string"
1395
+ },
1396
+ "kmsKeyRef": {
1397
+ "type": "string"
1398
+ },
1399
+ "method": {
1400
+ "$ref": "#/components/schemas/ManagedIdentifierMethod"
1401
+ },
1402
+ "opts": {
1403
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1404
+ },
1405
+ "key": {
1406
+ "$ref": "#/components/schemas/IKey"
1407
+ },
1408
+ "kid": {
1409
+ "type": "string"
1410
+ },
1411
+ "issuer": {
1412
+ "type": "string"
1413
+ }
1414
+ },
1415
+ "required": [
1416
+ "jwk",
1417
+ "jwkThumbprint",
1418
+ "key",
1419
+ "kmsKeyRef",
1420
+ "method",
1421
+ "opts"
1353
1422
  ]
1354
1423
  },
1355
1424
  {
@@ -1367,6 +1436,9 @@
1367
1436
  "method": {
1368
1437
  "$ref": "#/components/schemas/ManagedIdentifierMethod"
1369
1438
  },
1439
+ "opts": {
1440
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1441
+ },
1370
1442
  "key": {
1371
1443
  "$ref": "#/components/schemas/IKey"
1372
1444
  },
@@ -1378,11 +1450,14 @@
1378
1450
  }
1379
1451
  },
1380
1452
  "required": [
1453
+ "issuer",
1381
1454
  "jwk",
1382
1455
  "jwkThumbprint",
1383
1456
  "key",
1457
+ "kid",
1384
1458
  "kmsKeyRef",
1385
- "method"
1459
+ "method",
1460
+ "opts"
1386
1461
  ]
1387
1462
  },
1388
1463
  {
@@ -1400,6 +1475,9 @@
1400
1475
  "method": {
1401
1476
  "$ref": "#/components/schemas/ManagedIdentifierMethod"
1402
1477
  },
1478
+ "opts": {
1479
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1480
+ },
1403
1481
  "key": {
1404
1482
  "$ref": "#/components/schemas/IKey"
1405
1483
  },
@@ -1417,7 +1495,8 @@
1417
1495
  "key",
1418
1496
  "kid",
1419
1497
  "kmsKeyRef",
1420
- "method"
1498
+ "method",
1499
+ "opts"
1421
1500
  ]
1422
1501
  }
1423
1502
  ]
@@ -1428,7 +1507,8 @@
1428
1507
  "did",
1429
1508
  "jwk",
1430
1509
  "x5c",
1431
- "kid"
1510
+ "kid",
1511
+ "key"
1432
1512
  ]
1433
1513
  },
1434
1514
  "ManagedIdentifierDidOpts": {
@@ -1486,6 +1566,9 @@
1486
1566
  "type": "string",
1487
1567
  "const": "did"
1488
1568
  },
1569
+ "opts": {
1570
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1571
+ },
1489
1572
  "key": {
1490
1573
  "$ref": "#/components/schemas/IKey"
1491
1574
  },
@@ -1524,7 +1607,8 @@
1524
1607
  "keys",
1525
1608
  "kid",
1526
1609
  "kmsKeyRef",
1527
- "method"
1610
+ "method",
1611
+ "opts"
1528
1612
  ]
1529
1613
  },
1530
1614
  "ManagedIdentifierJwkOpts": {
@@ -1567,6 +1651,9 @@
1567
1651
  "type": "string",
1568
1652
  "const": "jwk"
1569
1653
  },
1654
+ "opts": {
1655
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1656
+ },
1570
1657
  "key": {
1571
1658
  "$ref": "#/components/schemas/IKey"
1572
1659
  },
@@ -1582,7 +1669,72 @@
1582
1669
  "jwkThumbprint",
1583
1670
  "key",
1584
1671
  "kmsKeyRef",
1585
- "method"
1672
+ "method",
1673
+ "opts"
1674
+ ]
1675
+ },
1676
+ "ManagedIdentifierKeyOpts": {
1677
+ "type": "object",
1678
+ "properties": {
1679
+ "method": {
1680
+ "type": "string",
1681
+ "const": "key"
1682
+ },
1683
+ "identifier": {
1684
+ "$ref": "#/components/schemas/ManagedIdentifierType"
1685
+ },
1686
+ "kmsKeyRef": {
1687
+ "type": "string"
1688
+ },
1689
+ "issuer": {
1690
+ "type": "string"
1691
+ },
1692
+ "kid": {
1693
+ "type": "string"
1694
+ }
1695
+ },
1696
+ "required": [
1697
+ "identifier"
1698
+ ]
1699
+ },
1700
+ "ManagedIdentifierKeyResult": {
1701
+ "type": "object",
1702
+ "properties": {
1703
+ "jwk": {
1704
+ "$ref": "#/components/schemas/JWK"
1705
+ },
1706
+ "jwkThumbprint": {
1707
+ "type": "string"
1708
+ },
1709
+ "kmsKeyRef": {
1710
+ "type": "string"
1711
+ },
1712
+ "method": {
1713
+ "type": "string",
1714
+ "const": "key"
1715
+ },
1716
+ "opts": {
1717
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1718
+ },
1719
+ "key": {
1720
+ "$ref": "#/components/schemas/IKey"
1721
+ },
1722
+ "kid": {
1723
+ "type": "string"
1724
+ },
1725
+ "issuer": {
1726
+ "type": "string"
1727
+ }
1728
+ },
1729
+ "required": [
1730
+ "issuer",
1731
+ "jwk",
1732
+ "jwkThumbprint",
1733
+ "key",
1734
+ "kid",
1735
+ "kmsKeyRef",
1736
+ "method",
1737
+ "opts"
1586
1738
  ]
1587
1739
  },
1588
1740
  "ManagedIdentifierKidOpts": {
@@ -1625,6 +1777,9 @@
1625
1777
  "type": "string",
1626
1778
  "const": "kid"
1627
1779
  },
1780
+ "opts": {
1781
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1782
+ },
1628
1783
  "key": {
1629
1784
  "$ref": "#/components/schemas/IKey"
1630
1785
  },
@@ -1642,7 +1797,8 @@
1642
1797
  "key",
1643
1798
  "kid",
1644
1799
  "kmsKeyRef",
1645
- "method"
1800
+ "method",
1801
+ "opts"
1646
1802
  ]
1647
1803
  },
1648
1804
  "ManagedIdentifierX5cOpts": {
@@ -1685,6 +1841,9 @@
1685
1841
  "type": "string",
1686
1842
  "const": "x5c"
1687
1843
  },
1844
+ "opts": {
1845
+ "$ref": "#/components/schemas/ManagedIdentifierOpts"
1846
+ },
1688
1847
  "key": {
1689
1848
  "$ref": "#/components/schemas/IKey"
1690
1849
  },
@@ -1709,6 +1868,7 @@
1709
1868
  "key",
1710
1869
  "kmsKeyRef",
1711
1870
  "method",
1871
+ "opts",
1712
1872
  "x5c"
1713
1873
  ]
1714
1874
  }
@@ -1768,6 +1928,15 @@
1768
1928
  "$ref": "#/components/schemas/ManagedIdentifierJwkResult"
1769
1929
  }
1770
1930
  },
1931
+ "identifierManagedGetByKey": {
1932
+ "description": "",
1933
+ "arguments": {
1934
+ "$ref": "#/components/schemas/ManagedIdentifierKeyOpts"
1935
+ },
1936
+ "returnType": {
1937
+ "$ref": "#/components/schemas/ManagedIdentifierKeyResult"
1938
+ }
1939
+ },
1771
1940
  "identifierManagedGetByKid": {
1772
1941
  "description": "",
1773
1942
  "arguments": {
@@ -1,5 +1,5 @@
1
1
  import { IAgentContext, IAgentPlugin, IDIDManager, IKeyManager } from '@veramo/core'
2
- import { schema } from '..'
2
+ import { ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, schema } from '..'
3
3
  import { getManagedIdentifier, resolveExternalIdentifier } from '../functions'
4
4
  import {
5
5
  ExternalIdentifierDidOpts,
@@ -34,6 +34,7 @@ export class IdentifierResolution implements IAgentPlugin {
34
34
  identifierManagedGetByKid: this.identifierGetManagedByKid.bind(this),
35
35
  identifierManagedGetByJwk: this.identifierGetManagedByJwk.bind(this),
36
36
  identifierManagedGetByX5c: this.identifierGetManagedByX5c.bind(this),
37
+ identifierManagedGetByKey: this.identifierGetManagedByKey.bind(this),
37
38
 
38
39
  identifierExternalResolve: this.identifierResolveExternal.bind(this),
39
40
  identifierExternalResolveByDid: this.identifierExternalResolveByDid.bind(this),
@@ -50,7 +51,8 @@ export class IdentifierResolution implements IAgentPlugin {
50
51
  }
51
52
 
52
53
  /**
53
- * Main method for managed identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
54
+ * Main method for managed identifiers. We always go through this method (also the other methods below) as we want to
55
+ * integrate a plugin for anomaly detection. Having a single method helps
54
56
  * @param args
55
57
  * @param context
56
58
  * @private
@@ -70,6 +72,10 @@ export class IdentifierResolution implements IAgentPlugin {
70
72
  return (await this.identifierGetManaged({ ...args, method: 'kid' }, context)) as ManagedIdentifierKidResult
71
73
  }
72
74
 
75
+ private async identifierGetManagedByKey(args: ManagedIdentifierKeyOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKeyResult> {
76
+ return (await this.identifierGetManaged({ ...args, method: 'key' }, context)) as ManagedIdentifierKeyResult
77
+ }
78
+
73
79
  private async identifierGetManagedByJwk(args: ManagedIdentifierJwkOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierJwkResult> {
74
80
  return (await this.identifierGetManaged({ ...args, method: 'jwk' }, context)) as ManagedIdentifierJwkResult
75
81
  }
@@ -1,22 +1,27 @@
1
+ import { IRequiredContext } from '@sphereon/ssi-sdk-ext.did-provider-jwk'
1
2
  import { getFirstKeyWithRelation } from '@sphereon/ssi-sdk-ext.did-utils'
2
3
  import { calculateJwkThumbprint, JWK, toJwk } from '@sphereon/ssi-sdk-ext.key-utils'
3
4
  import { pemOrDerToX509Certificate } from '@sphereon/ssi-sdk-ext.x509-utils'
4
5
  import { contextHasDidManager, contextHasKeyManager } from '@sphereon/ssi-sdk.agent-config'
5
- import { IAgentContext, IIdentifier, IKeyManager } from '@veramo/core'
6
+ import { IAgentContext, IIdentifier, IKey, IKeyManager } from '@veramo/core'
6
7
  import { CryptoEngine, setEngine } from 'pkijs'
7
8
  import {
8
9
  isManagedIdentifierDidOpts,
9
10
  isManagedIdentifierDidResult,
10
11
  isManagedIdentifierJwkOpts,
12
+ isManagedIdentifierKeyOpts,
11
13
  isManagedIdentifierKidOpts,
12
14
  isManagedIdentifierX5cOpts,
13
15
  ManagedIdentifierDidOpts,
14
16
  ManagedIdentifierDidResult,
15
17
  ManagedIdentifierJwkOpts,
16
18
  ManagedIdentifierJwkResult,
19
+ ManagedIdentifierKeyOpts,
20
+ ManagedIdentifierKeyResult,
17
21
  ManagedIdentifierKidOpts,
18
22
  ManagedIdentifierKidResult,
19
23
  ManagedIdentifierOpts,
24
+ ManagedIdentifierOptsOrResult,
20
25
  ManagedIdentifierResult,
21
26
  ManagedIdentifierX5cOpts,
22
27
  ManagedIdentifierX5cResult,
@@ -43,9 +48,51 @@ export async function getManagedKidIdentifier(
43
48
  kid,
44
49
  issuer,
45
50
  kmsKeyRef: key.kid,
51
+ opts,
46
52
  } satisfies ManagedIdentifierKidResult
47
53
  }
48
54
 
55
+ /**
56
+ * 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
57
+ * @param identifier
58
+ * @param context
59
+ */
60
+ export async function ensureManagedIdentifierResult(
61
+ identifier: ManagedIdentifierOptsOrResult,
62
+ context: IRequiredContext
63
+ ): Promise<ManagedIdentifierResult> {
64
+ return 'key' in identifier && 'kmsKeyRef' in identifier && 'method' in identifier && !('identifier' in identifier)
65
+ ? identifier
66
+ : await context.agent.identifierManagedGet(identifier)
67
+ }
68
+
69
+ /**
70
+ * 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
71
+ * @param opts
72
+ * @param _context
73
+ */
74
+ export async function getManagedKeyIdentifier(opts: ManagedIdentifierKeyOpts, _context?: IAgentContext<any>): Promise<ManagedIdentifierKeyResult> {
75
+ const method = 'key'
76
+ const key: IKey = opts.identifier
77
+ if (opts.kmsKeyRef && opts.kmsKeyRef !== key.kid) {
78
+ return Promise.reject(Error(`Cannot get a managed key object by providing a key and a kmsKeyRef that are different.}`))
79
+ }
80
+ const jwk = toJwk(key.publicKeyHex, key.type, { key })
81
+ const jwkThumbprint = (key.meta?.jwkThumbprint as string) ?? calculateJwkThumbprint({ jwk })
82
+ const kid = opts.kid ?? (key.meta?.verificationMethod?.id as string) ?? jwkThumbprint
83
+ const issuer = opts.issuer ?? kid // The different identifiers should set the value. Defaults to the kid
84
+ return {
85
+ method,
86
+ key,
87
+ jwk,
88
+ jwkThumbprint,
89
+ kid,
90
+ issuer,
91
+ kmsKeyRef: key.kid,
92
+ opts,
93
+ } satisfies ManagedIdentifierKeyResult
94
+ }
95
+
49
96
  export async function getManagedDidIdentifier(opts: ManagedIdentifierDidOpts, context: IAgentContext<any>): Promise<ManagedIdentifierDidResult> {
50
97
  const method = 'did'
51
98
  if (!contextHasDidManager(context)) {
@@ -73,7 +120,12 @@ export async function getManagedDidIdentifier(opts: ManagedIdentifierDidOpts, co
73
120
  const controllerKeyId = identifier.controllerKeyId
74
121
  const jwk = toJwk(key.publicKeyHex, key.type, { key })
75
122
  const jwkThumbprint = key.meta?.jwkThumbprint ?? calculateJwkThumbprint({ jwk })
76
- const kid = opts.kid ?? extendedKey.meta?.verificationMethod?.id
123
+ let kid = opts.kid ?? extendedKey.meta?.verificationMethod?.id
124
+ if (!kid.startsWith(did)) {
125
+ // Make sure we create a fully qualified kid
126
+ const hash = kid.startsWith('#') ? '' : '#'
127
+ kid = `${did}${hash}${kid}`
128
+ }
77
129
  const issuer = opts.issuer ?? did
78
130
  return {
79
131
  method,
@@ -87,6 +139,7 @@ export async function getManagedDidIdentifier(opts: ManagedIdentifierDidOpts, co
87
139
  keys,
88
140
  issuer,
89
141
  identifier,
142
+ opts,
90
143
  }
91
144
  }
92
145
 
@@ -111,6 +164,7 @@ export async function getManagedJwkIdentifier(
111
164
  jwkThumbprint,
112
165
  kid,
113
166
  issuer,
167
+ opts,
114
168
  } satisfies ManagedIdentifierJwkResult
115
169
  }
116
170
 
@@ -148,6 +202,7 @@ export async function getManagedX5cIdentifier(
148
202
  kmsKeyRef: key.kid,
149
203
  kid,
150
204
  issuer,
205
+ opts,
151
206
  } satisfies ManagedIdentifierX5cResult
152
207
  }
153
208
 
@@ -166,6 +221,8 @@ export async function getManagedIdentifier(
166
221
  resolutionResult = await getManagedJwkIdentifier(opts, context)
167
222
  } else if (isManagedIdentifierX5cOpts(opts)) {
168
223
  resolutionResult = await getManagedX5cIdentifier(opts, context)
224
+ } else if (isManagedIdentifierKeyOpts(opts)) {
225
+ resolutionResult = await getManagedKeyIdentifier(opts, context)
169
226
  } else {
170
227
  return Promise.reject(Error(`Could not determine identifier method. Please provide explicitly`))
171
228
  }
@@ -12,6 +12,8 @@ import {
12
12
  ManagedIdentifierDidResult,
13
13
  ManagedIdentifierJwkOpts,
14
14
  ManagedIdentifierJwkResult,
15
+ ManagedIdentifierKeyOpts,
16
+ ManagedIdentifierKeyResult,
15
17
  ManagedIdentifierKidOpts,
16
18
  ManagedIdentifierKidResult,
17
19
  ManagedIdentifierOpts,
@@ -26,6 +28,8 @@ import {
26
28
  export interface IIdentifierResolution extends IPluginMethodMap {
27
29
  /**
28
30
  * Main method for managed identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
31
+ *
32
+ * The end result of all these methods is a common baseline response that allows to use a key from the registered KMS systems. It also provides kid and iss(uer) values that can be used in a JWT/JWS for instance
29
33
  * @param args
30
34
  * @param context
31
35
  * @public
@@ -40,6 +44,10 @@ export interface IIdentifierResolution extends IPluginMethodMap {
40
44
 
41
45
  identifierManagedGetByX5c(args: ManagedIdentifierX5cOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierX5cResult>
42
46
 
47
+ identifierManagedGetByKey(args: ManagedIdentifierKeyOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKeyResult>
48
+
49
+ // TODO: We can create a custom managed identifier method allowing developers to register a callback function to get their implementation hooked up. Needs more investigation as it would also impact the KMS
50
+
43
51
  /**
44
52
  * Main method for external identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
45
53
  * @param args
@@ -1,5 +1,5 @@
1
1
  import { JWK } from '@sphereon/ssi-sdk-ext.key-utils'
2
- import { IIdentifier } from '@veramo/core'
2
+ import { IIdentifier, IKey } from '@veramo/core'
3
3
  import { ExternalIdentifierType } from './externalIdentifierTypes'
4
4
  import { ManagedIdentifierType } from './managedIdentifierTypes'
5
5
 
@@ -32,6 +32,16 @@ export function isKidIdentifier(identifier: ManagedIdentifierType | ExternalIden
32
32
  return typeof identifier === 'string' && !identifier.startsWith('did:')
33
33
  }
34
34
 
35
+ export function isKeyIdentifier(identifier: ManagedIdentifierType): identifier is IKey {
36
+ return (
37
+ typeof identifier === 'string' &&
38
+ !Array.isArray(identifier) &&
39
+ typeof identifier === 'object' &&
40
+ `kid` in identifier &&
41
+ 'publicKeyHex' in identifier
42
+ )
43
+ }
44
+
35
45
  export function isX5cIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string[] {
36
46
  return Array.isArray(identifier) && identifier.length > 0 // todo: Do we want to do additional validation? We know it must be DER and thus hex for instance
37
47
  }
@@ -1,21 +1,27 @@
1
1
  import { JWK } from '@sphereon/ssi-sdk-ext.key-utils'
2
2
  import { DIDDocumentSection, IIdentifier, IKey, TKeyType } from '@veramo/core'
3
- import { isDidIdentifier, isJwkIdentifier, isKidIdentifier, isX5cIdentifier, JwkInfo } from './common'
3
+ import { isDidIdentifier, isJwkIdentifier, isKeyIdentifier, isKidIdentifier, isX5cIdentifier, JwkInfo } from './common'
4
4
 
5
5
  /**
6
6
  * Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains
7
7
  *
8
- * The functions below can be used to check the type, and they also provide the proper runtime types
8
+ * The functions below can be used to check the type, and they also provide the proper 'runtime' types
9
9
  */
10
- export type ManagedIdentifierType = IIdentifier /*did*/ | string /*did or kid*/ | string[] /*x5c*/ | JWK
11
-
12
- export type ManagedIdentifierOpts = (ManagedIdentifierJwkOpts | ManagedIdentifierX5cOpts | ManagedIdentifierDidOpts | ManagedIdentifierKidOpts) &
10
+ export type ManagedIdentifierType = IIdentifier /*did*/ | string /*did or kid*/ | string[] /*x5c*/ | JWK | IKey
11
+
12
+ export type ManagedIdentifierOpts = (
13
+ | ManagedIdentifierJwkOpts
14
+ | ManagedIdentifierX5cOpts
15
+ | ManagedIdentifierDidOpts
16
+ | ManagedIdentifierKidOpts
17
+ | ManagedIdentifierKeyOpts
18
+ ) &
13
19
  ManagedIdentifierOptsBase
14
20
 
15
21
  export type ManagedIdentifierOptsBase = {
16
22
  method?: ManagedIdentifierMethod // If provided always takes precedences otherwise it will be inferred from the identifier
17
23
  identifier: ManagedIdentifierType
18
- kmsKeyRef?: string
24
+ kmsKeyRef?: string // The key reference for the KMS system. If provided this value will be used to determine the appropriate key. Otherwise it will be inferred
19
25
  issuer?: string // can be used when a specific issuer needs to end up, for instance when signing JWTs. Will be returned or inferred if not provided
20
26
  kid?: string // can be used when a specific kid value needs to be used. For instance when signing JWTs. Will be returned or inferred if not provided
21
27
  }
@@ -45,6 +51,16 @@ export function isManagedIdentifierKidOpts(opts: ManagedIdentifierOptsBase): opt
45
51
  return ('method' in opts && opts.method === 'kid') || isKidIdentifier(identifier)
46
52
  }
47
53
 
54
+ export type ManagedIdentifierKeyOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
55
+ method?: 'key'
56
+ identifier: IKey
57
+ }
58
+
59
+ export function isManagedIdentifierKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKidOpts {
60
+ const { identifier } = opts
61
+ return ('method' in opts && opts.method === 'key') || isKeyIdentifier(identifier)
62
+ }
63
+
48
64
  export type ManagedIdentifierJwkOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
49
65
  method?: 'jwk'
50
66
  identifier: JWK
@@ -71,6 +87,7 @@ export interface ManagedJwkInfo extends JwkInfo {
71
87
 
72
88
  export interface IManagedIdentifierResultBase extends ManagedJwkInfo {
73
89
  method: ManagedIdentifierMethod
90
+ opts: ManagedIdentifierOpts
74
91
  key: IKey
75
92
  kid?: string
76
93
  issuer?: string
@@ -80,7 +97,7 @@ export function isManagedIdentifierDidResult(object: IManagedIdentifierResultBas
80
97
  return object!! && typeof object === 'object' && 'method' in object && object.method === 'did'
81
98
  }
82
99
 
83
- export function isManagedIdentifierX5cResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierDidResult {
100
+ export function isManagedIdentifierX5cResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierX5cResult {
84
101
  return object!! && typeof object === 'object' && 'method' in object && object.method === 'x5c'
85
102
  }
86
103
 
@@ -92,6 +109,10 @@ export function isManagedIdentifierKidResult(object: IManagedIdentifierResultBas
92
109
  return object!! && typeof object === 'object' && 'method' in object && object.method === 'kid'
93
110
  }
94
111
 
112
+ export function isManagedIdentifierKeyResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierKeyResult {
113
+ return object!! && typeof object === 'object' && 'method' in object && object.method === 'key'
114
+ }
115
+
95
116
  export interface ManagedIdentifierDidResult extends IManagedIdentifierResultBase {
96
117
  method: 'did'
97
118
  identifier: IIdentifier
@@ -114,13 +135,21 @@ export interface ManagedIdentifierKidResult extends IManagedIdentifierResultBase
114
135
  kid: string
115
136
  }
116
137
 
138
+ export interface ManagedIdentifierKeyResult extends IManagedIdentifierResultBase {
139
+ method: 'key'
140
+ issuer: string
141
+ kid: string
142
+ }
143
+
117
144
  export interface ManagedIdentifierX5cResult extends IManagedIdentifierResultBase {
118
145
  method: 'x5c'
119
146
  x5c: string[]
120
147
  certificate: any // Certificate(JSON_, but trips schema generator. Probably want to create our own DTO
121
148
  }
122
149
 
123
- export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid'
150
+ export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'key'
124
151
 
125
152
  export type ManagedIdentifierResult = IManagedIdentifierResultBase &
126
- (ManagedIdentifierX5cResult | ManagedIdentifierDidResult | ManagedIdentifierJwkResult | ManagedIdentifierKidResult)
153
+ (ManagedIdentifierX5cResult | ManagedIdentifierDidResult | ManagedIdentifierJwkResult | ManagedIdentifierKidResult | ManagedIdentifierKeyResult)
154
+
155
+ export type ManagedIdentifierOptsOrResult = ManagedIdentifierResult | ManagedIdentifierOpts