@sphereon/ssi-sdk-ext.identifier-resolution 0.24.1-next.96 → 0.24.1-next.98
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.
- package/dist/agent/IdentifierResolution.d.ts +1 -0
- package/dist/agent/IdentifierResolution.d.ts.map +1 -1
- package/dist/agent/IdentifierResolution.js +6 -0
- package/dist/agent/IdentifierResolution.js.map +1 -1
- package/dist/functions/LegacySupport.d.ts +12 -0
- package/dist/functions/LegacySupport.d.ts.map +1 -0
- package/dist/functions/LegacySupport.js +39 -0
- package/dist/functions/LegacySupport.js.map +1 -0
- package/dist/functions/index.d.ts +1 -11
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +1 -36
- package/dist/functions/index.js.map +1 -1
- package/dist/types/IIdentifierResolution.d.ts +11 -1
- package/dist/types/IIdentifierResolution.d.ts.map +1 -1
- package/dist/types/IIdentifierResolution.js +14 -0
- package/dist/types/IIdentifierResolution.js.map +1 -1
- package/package.json +9 -9
- package/plugin.schema.json +19 -0
- package/src/agent/IdentifierResolution.ts +9 -1
- package/src/functions/LegacySupport.ts +50 -0
- package/src/functions/index.ts +1 -51
- package/src/types/IIdentifierResolution.ts +25 -0
|
@@ -26,6 +26,7 @@ export declare class IdentifierResolution implements IAgentPlugin {
|
|
|
26
26
|
private identifierGetManagedByKey;
|
|
27
27
|
private identifierGetManagedByJwk;
|
|
28
28
|
private identifierGetManagedByX5c;
|
|
29
|
+
private identifierManagedLazyResult;
|
|
29
30
|
private identifierResolveExternal;
|
|
30
31
|
private identifierExternalResolveByDid;
|
|
31
32
|
private identifierExternalResolveByX5c;
|
|
@@ -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,
|
|
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,CActC;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,2BAA2B;YAO3B,yBAAyB;YAIzB,8BAA8B;YAI9B,8BAA8B;CAG7C"}
|
|
@@ -29,6 +29,7 @@ class IdentifierResolution {
|
|
|
29
29
|
identifierManagedGetByJwk: this.identifierGetManagedByJwk.bind(this),
|
|
30
30
|
identifierManagedGetByX5c: this.identifierGetManagedByX5c.bind(this),
|
|
31
31
|
identifierManagedGetByKey: this.identifierGetManagedByKey.bind(this),
|
|
32
|
+
identifierManagedLazyResult: this.identifierManagedLazyResult.bind(this),
|
|
32
33
|
identifierExternalResolve: this.identifierResolveExternal.bind(this),
|
|
33
34
|
identifierExternalResolveByDid: this.identifierExternalResolveByDid.bind(this),
|
|
34
35
|
identifierExternalResolveByX5c: this.identifierExternalResolveByX5c.bind(this),
|
|
@@ -73,6 +74,11 @@ class IdentifierResolution {
|
|
|
73
74
|
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'x5c' }), context));
|
|
74
75
|
});
|
|
75
76
|
}
|
|
77
|
+
identifierManagedLazyResult(identifier, context) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
return yield (0, __1.ensureManagedIdentifierResult)(identifier, context);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
76
82
|
identifierResolveExternal(args, context) {
|
|
77
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
84
|
return yield (0, functions_1.resolveExternalIdentifier)(Object.assign(Object.assign({}, args), { crypto: this._crypto }), context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentifierResolution.js","sourceRoot":"","sources":["../../src/agent/IdentifierResolution.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"IdentifierResolution.js","sourceRoot":"","sources":["../../src/agent/IdentifierResolution.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ManagedIdentifierOptsOrResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Converts legacy id opts key refs to the new ManagedIdentifierOpts
|
|
4
|
+
* @param opts
|
|
5
|
+
*/
|
|
6
|
+
export declare function legacyKeyRefsToIdentifierOpts(opts: {
|
|
7
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
8
|
+
iss?: string;
|
|
9
|
+
keyRef?: string;
|
|
10
|
+
didOpts?: any;
|
|
11
|
+
}): ManagedIdentifierOptsOrResult;
|
|
12
|
+
//# sourceMappingURL=LegacySupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegacySupport.d.ts","sourceRoot":"","sources":["../../src/functions/LegacySupport.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAElF;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,MAAM,CAAC,EAAE,6BAA6B,CAAA;IACtC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,GAAG,CAAA;CACd,GAAG,6BAA6B,CAqChC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.legacyKeyRefsToIdentifierOpts = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Converts legacy id opts key refs to the new ManagedIdentifierOpts
|
|
6
|
+
* @param opts
|
|
7
|
+
*/
|
|
8
|
+
function legacyKeyRefsToIdentifierOpts(opts) {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
|
+
if (!opts.idOpts) {
|
|
11
|
+
console.warn(`Legacy idOpts being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`);
|
|
12
|
+
// legacy way
|
|
13
|
+
let kmsKeyRef = (_d = (_a = opts.keyRef) !== null && _a !== void 0 ? _a : (_c = (_b = opts.didOpts) === null || _b === void 0 ? void 0 : _b.idOpts) === null || _c === void 0 ? void 0 : _c.kmsKeyRef) !== null && _d !== void 0 ? _d : (typeof ((_e = opts.didOpts) === null || _e === void 0 ? void 0 : _e.idOpts.identifier) === 'object' ? ((_f = opts.didOpts) === null || _f === void 0 ? void 0 : _f.idOpts.identifier).keys[0].kid : undefined);
|
|
14
|
+
if (!kmsKeyRef) {
|
|
15
|
+
throw Error('Key ref is needed for access token signer');
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
kmsKeyRef: (_g = opts.keyRef) !== null && _g !== void 0 ? _g : kmsKeyRef,
|
|
19
|
+
identifier: kmsKeyRef,
|
|
20
|
+
issuer: opts.iss,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const idOpts = opts.idOpts;
|
|
25
|
+
if (opts.keyRef && !idOpts.kmsKeyRef) {
|
|
26
|
+
// legacy way
|
|
27
|
+
console.warn(`Legacy keyRef being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`);
|
|
28
|
+
idOpts.kmsKeyRef = opts.keyRef;
|
|
29
|
+
}
|
|
30
|
+
if (opts.iss && !idOpts.issuer) {
|
|
31
|
+
// legacy way
|
|
32
|
+
console.warn(`Legacy iss being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`);
|
|
33
|
+
idOpts.issuer = opts.iss;
|
|
34
|
+
}
|
|
35
|
+
return idOpts;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.legacyKeyRefsToIdentifierOpts = legacyKeyRefsToIdentifierOpts;
|
|
39
|
+
//# sourceMappingURL=LegacySupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegacySupport.js","sourceRoot":"","sources":["../../src/functions/LegacySupport.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH,SAAgB,6BAA6B,CAAC,IAK7C;;IACC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,uRAAuR,CACxR,CAAA;QACD,aAAa;QACb,IAAI,SAAS,GACX,MAAA,MAAA,IAAI,CAAC,MAAM,mCACX,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,0CAAE,SAAS,mCAC/B,CAAC,OAAO,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC,UAAU,CAAA,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC,UAA0B,CAAA,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAClI,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAC1D,CAAC;QACD,OAAO;YACL,SAAS,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,SAAS;YACnC,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,IAAI,CAAC,GAAG;SACkB,CAAA;IACtC,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAC1B,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACrC,aAAa;YACb,OAAO,CAAC,IAAI,CACV,uRAAuR,CACxR,CAAA;YACD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAA;QAChC,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAC/B,aAAa;YACb,OAAO,CAAC,IAAI,CACV,oRAAoR,CACrR,CAAA;YACD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAA;QAC1B,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;AACH,CAAC;AA1CD,sEA0CC"}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import { ManagedIdentifierOpts } from '../types';
|
|
2
1
|
export * from './managedIdentifierFunctions';
|
|
3
2
|
export * from './externalIdentifierFunctions';
|
|
4
|
-
|
|
5
|
-
* Converts legacy id opts key refs to the new ManagedIdentifierOpts
|
|
6
|
-
* @param opts
|
|
7
|
-
*/
|
|
8
|
-
export declare function legacyKeyRefsToIdentifierOpts(opts: {
|
|
9
|
-
idOpts?: ManagedIdentifierOpts;
|
|
10
|
-
iss?: string;
|
|
11
|
-
keyRef?: string;
|
|
12
|
-
didOpts?: any;
|
|
13
|
-
}): ManagedIdentifierOpts;
|
|
3
|
+
export * from './LegacySupport';
|
|
14
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"
|
|
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,iBAAiB,CAAA"}
|
package/dist/functions/index.js
CHANGED
|
@@ -14,42 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.legacyKeyRefsToIdentifierOpts = void 0;
|
|
18
17
|
__exportStar(require("./managedIdentifierFunctions"), exports);
|
|
19
18
|
__exportStar(require("./externalIdentifierFunctions"), exports);
|
|
20
|
-
|
|
21
|
-
* Converts legacy id opts key refs to the new ManagedIdentifierOpts
|
|
22
|
-
* @param opts
|
|
23
|
-
*/
|
|
24
|
-
function legacyKeyRefsToIdentifierOpts(opts) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
26
|
-
if (!opts.idOpts) {
|
|
27
|
-
console.warn(`Legacy idOpts being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`);
|
|
28
|
-
// legacy way
|
|
29
|
-
let kmsKeyRef = (_d = (_a = opts.keyRef) !== null && _a !== void 0 ? _a : (_c = (_b = opts.didOpts) === null || _b === void 0 ? void 0 : _b.idOpts) === null || _c === void 0 ? void 0 : _c.kmsKeyRef) !== null && _d !== void 0 ? _d : (typeof ((_e = opts.didOpts) === null || _e === void 0 ? void 0 : _e.idOpts.identifier) === 'object' ? ((_f = opts.didOpts) === null || _f === void 0 ? void 0 : _f.idOpts.identifier).keys[0].kid : undefined);
|
|
30
|
-
if (!kmsKeyRef) {
|
|
31
|
-
throw Error('Key ref is needed for access token signer');
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
kmsKeyRef: (_g = opts.keyRef) !== null && _g !== void 0 ? _g : kmsKeyRef,
|
|
35
|
-
identifier: kmsKeyRef,
|
|
36
|
-
issuer: opts.iss,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const idOpts = opts.idOpts;
|
|
41
|
-
if (opts.keyRef && !idOpts.kmsKeyRef) {
|
|
42
|
-
// legacy way
|
|
43
|
-
console.warn(`Legacy keyRef being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`);
|
|
44
|
-
idOpts.kmsKeyRef = opts.keyRef;
|
|
45
|
-
}
|
|
46
|
-
if (opts.iss && !idOpts.issuer) {
|
|
47
|
-
// legacy way
|
|
48
|
-
console.warn(`Legacy iss being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`);
|
|
49
|
-
idOpts.issuer = opts.iss;
|
|
50
|
-
}
|
|
51
|
-
return idOpts;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.legacyKeyRefsToIdentifierOpts = legacyKeyRefsToIdentifierOpts;
|
|
19
|
+
__exportStar(require("./LegacySupport"), exports);
|
|
55
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,gEAA6C;AAC7C,kDAA+B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IAgentContext, IDIDManager, IKeyManager, IPluginMethodMap } from '@veramo/core';
|
|
2
2
|
import { ExternalIdentifierDidOpts, ExternalIdentifierDidResult, ExternalIdentifierOpts, ExternalIdentifierResult, ExternalIdentifierX5cOpts, ExternalIdentifierX5cResult } from './externalIdentifierTypes';
|
|
3
|
-
import { ManagedIdentifierDidOpts, ManagedIdentifierDidResult, ManagedIdentifierJwkOpts, ManagedIdentifierJwkResult, ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, ManagedIdentifierKidOpts, ManagedIdentifierKidResult, ManagedIdentifierOpts, ManagedIdentifierResult, ManagedIdentifierX5cOpts, ManagedIdentifierX5cResult } from './managedIdentifierTypes';
|
|
3
|
+
import { ManagedIdentifierDidOpts, ManagedIdentifierDidResult, ManagedIdentifierJwkOpts, ManagedIdentifierJwkResult, ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, ManagedIdentifierKidOpts, ManagedIdentifierKidResult, ManagedIdentifierOpts, ManagedIdentifierOptsOrResult, ManagedIdentifierResult, ManagedIdentifierX5cOpts, ManagedIdentifierX5cResult } from './managedIdentifierTypes';
|
|
4
|
+
export declare const identifierResolutionContextMethods: Array<string>;
|
|
4
5
|
/**
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
@@ -19,6 +20,15 @@ export interface IIdentifierResolution extends IPluginMethodMap {
|
|
|
19
20
|
identifierManagedGetByJwk(args: ManagedIdentifierJwkOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierJwkResult>;
|
|
20
21
|
identifierManagedGetByX5c(args: ManagedIdentifierX5cOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierX5cResult>;
|
|
21
22
|
identifierManagedGetByKey(args: ManagedIdentifierKeyOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKeyResult>;
|
|
23
|
+
/**
|
|
24
|
+
* 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
|
|
25
|
+
*
|
|
26
|
+
* We use the opts or result type almost everywhere, as it allows for just in time resolution whenever this method is called and afterwards we have the result, so resolution doesn't have to hit the DB, or external endpoints.
|
|
27
|
+
* Also use this method in the local agent, not using REST. If case the identifier needs to be resolved, you can always have the above methods using REST
|
|
28
|
+
* @param identifier
|
|
29
|
+
* @param context
|
|
30
|
+
*/
|
|
31
|
+
identifierManagedLazyResult(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IIdentifierResolution>): Promise<ManagedIdentifierResult>;
|
|
22
32
|
/**
|
|
23
33
|
* 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
|
|
24
34
|
* @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,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAA;
|
|
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,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAA;AAGjC,eAAO,MAAM,kCAAkC,EAAE,KAAK,CAAC,MAAM,CAW5D,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D;;;;;;;OAOG;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,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;;;;;;;OAOG;IACH,2BAA2B,CAAC,UAAU,EAAE,6BAA6B,EAAE,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;IAIvJ;;;;;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,3 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identifierResolutionContextMethods = void 0;
|
|
4
|
+
// Exposing the methods here for any REST implementation
|
|
5
|
+
exports.identifierResolutionContextMethods = [
|
|
6
|
+
'identifierManagedGet',
|
|
7
|
+
'identifierManagedGetByDid',
|
|
8
|
+
'identifierManagedGetByKid',
|
|
9
|
+
'identifierManagedGetByJwk',
|
|
10
|
+
'identifierManagedGetByX5c',
|
|
11
|
+
'identifierManagedGetByKey',
|
|
12
|
+
'identifierExternalResolve',
|
|
13
|
+
'identifierExternalResolveByDid',
|
|
14
|
+
'identifierExternalResolveByX5c',
|
|
15
|
+
'identifierManagedLazyResult',
|
|
16
|
+
];
|
|
3
17
|
//# sourceMappingURL=IIdentifierResolution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIdentifierResolution.js","sourceRoot":"","sources":["../../src/types/IIdentifierResolution.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"IIdentifierResolution.js","sourceRoot":"","sources":["../../src/types/IIdentifierResolution.ts"],"names":[],"mappings":";;;AAyBA,wDAAwD;AAC3C,QAAA,kCAAkC,GAAkB;IAC/D,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,gCAAgC;IAChC,gCAAgC;IAChC,6BAA6B;CAC9B,CAAA"}
|
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.
|
|
3
|
+
"version": "0.24.1-next.98+b2c8065",
|
|
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.
|
|
19
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.24.1-next.
|
|
20
|
-
"@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-next.
|
|
18
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-next.98+b2c8065",
|
|
19
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.24.1-next.98+b2c8065",
|
|
20
|
+
"@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-next.98+b2c8065",
|
|
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.
|
|
31
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-next.
|
|
32
|
-
"@sphereon/ssi-sdk-ext.key-manager": "0.24.1-next.
|
|
33
|
-
"@sphereon/ssi-sdk-ext.kms-local": "0.24.1-next.
|
|
30
|
+
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.24.1-next.98+b2c8065",
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-next.98+b2c8065",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.key-manager": "0.24.1-next.98+b2c8065",
|
|
33
|
+
"@sphereon/ssi-sdk-ext.kms-local": "0.24.1-next.98+b2c8065",
|
|
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": "
|
|
67
|
+
"gitHead": "b2c80655b05eec627f2f3d957cece1b6468375cf"
|
|
68
68
|
}
|
package/plugin.schema.json
CHANGED
|
@@ -1865,6 +1865,16 @@
|
|
|
1865
1865
|
"opts",
|
|
1866
1866
|
"x5c"
|
|
1867
1867
|
]
|
|
1868
|
+
},
|
|
1869
|
+
"ManagedIdentifierOptsOrResult": {
|
|
1870
|
+
"anyOf": [
|
|
1871
|
+
{
|
|
1872
|
+
"$ref": "#/components/schemas/ManagedIdentifierResult"
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
"$ref": "#/components/schemas/ManagedIdentifierOpts"
|
|
1876
|
+
}
|
|
1877
|
+
]
|
|
1868
1878
|
}
|
|
1869
1879
|
},
|
|
1870
1880
|
"methods": {
|
|
@@ -1948,6 +1958,15 @@
|
|
|
1948
1958
|
"returnType": {
|
|
1949
1959
|
"$ref": "#/components/schemas/ManagedIdentifierX5cResult"
|
|
1950
1960
|
}
|
|
1961
|
+
},
|
|
1962
|
+
"identifierManagedLazyResult": {
|
|
1963
|
+
"description": "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",
|
|
1964
|
+
"arguments": {
|
|
1965
|
+
"$ref": "#/components/schemas/ManagedIdentifierOptsOrResult"
|
|
1966
|
+
},
|
|
1967
|
+
"returnType": {
|
|
1968
|
+
"$ref": "#/components/schemas/ManagedIdentifierResult"
|
|
1969
|
+
}
|
|
1951
1970
|
}
|
|
1952
1971
|
}
|
|
1953
1972
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgentContext, IAgentPlugin, IDIDManager, IKeyManager } from '@veramo/core'
|
|
2
|
-
import { ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, schema } from '..'
|
|
2
|
+
import { ensureManagedIdentifierResult, ManagedIdentifierKeyOpts, ManagedIdentifierKeyResult, ManagedIdentifierOptsOrResult, schema } from '..'
|
|
3
3
|
import { getManagedIdentifier, resolveExternalIdentifier } from '../functions'
|
|
4
4
|
import {
|
|
5
5
|
ExternalIdentifierDidOpts,
|
|
@@ -35,6 +35,7 @@ export class IdentifierResolution implements IAgentPlugin {
|
|
|
35
35
|
identifierManagedGetByJwk: this.identifierGetManagedByJwk.bind(this),
|
|
36
36
|
identifierManagedGetByX5c: this.identifierGetManagedByX5c.bind(this),
|
|
37
37
|
identifierManagedGetByKey: this.identifierGetManagedByKey.bind(this),
|
|
38
|
+
identifierManagedLazyResult: this.identifierManagedLazyResult.bind(this),
|
|
38
39
|
|
|
39
40
|
identifierExternalResolve: this.identifierResolveExternal.bind(this),
|
|
40
41
|
identifierExternalResolveByDid: this.identifierExternalResolveByDid.bind(this),
|
|
@@ -84,6 +85,13 @@ export class IdentifierResolution implements IAgentPlugin {
|
|
|
84
85
|
return (await this.identifierGetManaged({ ...args, method: 'x5c' }, context)) as ManagedIdentifierX5cResult
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
private async identifierManagedLazyResult(
|
|
89
|
+
identifier: ManagedIdentifierOptsOrResult,
|
|
90
|
+
context: IAgentContext<IIdentifierResolution>
|
|
91
|
+
): Promise<ManagedIdentifierResult> {
|
|
92
|
+
return await ensureManagedIdentifierResult(identifier, context)
|
|
93
|
+
}
|
|
94
|
+
|
|
87
95
|
private async identifierResolveExternal(args: ExternalIdentifierOpts, context: IAgentContext<IKeyManager>): Promise<ExternalIdentifierResult> {
|
|
88
96
|
return await resolveExternalIdentifier({ ...args, crypto: this._crypto }, context)
|
|
89
97
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { IIdentifier } from '@veramo/core'
|
|
2
|
+
import { ManagedIdentifierDidOpts, ManagedIdentifierOptsOrResult } from '../types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Converts legacy id opts key refs to the new ManagedIdentifierOpts
|
|
6
|
+
* @param opts
|
|
7
|
+
*/
|
|
8
|
+
export function legacyKeyRefsToIdentifierOpts(opts: {
|
|
9
|
+
idOpts?: ManagedIdentifierOptsOrResult
|
|
10
|
+
iss?: string
|
|
11
|
+
keyRef?: string
|
|
12
|
+
didOpts?: any
|
|
13
|
+
}): ManagedIdentifierOptsOrResult {
|
|
14
|
+
if (!opts.idOpts) {
|
|
15
|
+
console.warn(
|
|
16
|
+
`Legacy idOpts being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`
|
|
17
|
+
)
|
|
18
|
+
// legacy way
|
|
19
|
+
let kmsKeyRef =
|
|
20
|
+
opts.keyRef ??
|
|
21
|
+
opts.didOpts?.idOpts?.kmsKeyRef ??
|
|
22
|
+
(typeof opts.didOpts?.idOpts.identifier === 'object' ? (opts.didOpts?.idOpts.identifier as IIdentifier).keys[0].kid : undefined)
|
|
23
|
+
if (!kmsKeyRef) {
|
|
24
|
+
throw Error('Key ref is needed for access token signer')
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
kmsKeyRef: opts.keyRef ?? kmsKeyRef,
|
|
28
|
+
identifier: kmsKeyRef,
|
|
29
|
+
issuer: opts.iss,
|
|
30
|
+
} satisfies ManagedIdentifierDidOpts
|
|
31
|
+
} else {
|
|
32
|
+
const idOpts = opts.idOpts
|
|
33
|
+
if (opts.keyRef && !idOpts.kmsKeyRef) {
|
|
34
|
+
// legacy way
|
|
35
|
+
console.warn(
|
|
36
|
+
`Legacy keyRef being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`
|
|
37
|
+
)
|
|
38
|
+
idOpts.kmsKeyRef = opts.keyRef
|
|
39
|
+
}
|
|
40
|
+
if (opts.iss && !idOpts.issuer) {
|
|
41
|
+
// legacy way
|
|
42
|
+
console.warn(
|
|
43
|
+
`Legacy iss being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`
|
|
44
|
+
)
|
|
45
|
+
idOpts.issuer = opts.iss
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return idOpts
|
|
49
|
+
}
|
|
50
|
+
}
|
package/src/functions/index.ts
CHANGED
|
@@ -1,53 +1,3 @@
|
|
|
1
|
-
import { IIdentifier } from '@veramo/core'
|
|
2
|
-
import { ManagedIdentifierDidOpts, ManagedIdentifierOpts } from '../types'
|
|
3
|
-
|
|
4
1
|
export * from './managedIdentifierFunctions'
|
|
5
2
|
export * from './externalIdentifierFunctions'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Converts legacy id opts key refs to the new ManagedIdentifierOpts
|
|
9
|
-
* @param opts
|
|
10
|
-
*/
|
|
11
|
-
export function legacyKeyRefsToIdentifierOpts(opts: {
|
|
12
|
-
idOpts?: ManagedIdentifierOpts
|
|
13
|
-
iss?: string
|
|
14
|
-
keyRef?: string
|
|
15
|
-
didOpts?: any
|
|
16
|
-
}): ManagedIdentifierOpts {
|
|
17
|
-
if (!opts.idOpts) {
|
|
18
|
-
console.warn(
|
|
19
|
-
`Legacy idOpts being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`
|
|
20
|
-
)
|
|
21
|
-
// legacy way
|
|
22
|
-
let kmsKeyRef =
|
|
23
|
-
opts.keyRef ??
|
|
24
|
-
opts.didOpts?.idOpts?.kmsKeyRef ??
|
|
25
|
-
(typeof opts.didOpts?.idOpts.identifier === 'object' ? (opts.didOpts?.idOpts.identifier as IIdentifier).keys[0].kid : undefined)
|
|
26
|
-
if (!kmsKeyRef) {
|
|
27
|
-
throw Error('Key ref is needed for access token signer')
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
kmsKeyRef: opts.keyRef ?? kmsKeyRef,
|
|
31
|
-
identifier: kmsKeyRef,
|
|
32
|
-
issuer: opts.iss,
|
|
33
|
-
} satisfies ManagedIdentifierDidOpts
|
|
34
|
-
} else {
|
|
35
|
-
const idOpts = opts.idOpts
|
|
36
|
-
if (opts.keyRef && !idOpts.kmsKeyRef) {
|
|
37
|
-
// legacy way
|
|
38
|
-
console.warn(
|
|
39
|
-
`Legacy keyRef being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`
|
|
40
|
-
)
|
|
41
|
-
idOpts.kmsKeyRef = opts.keyRef
|
|
42
|
-
}
|
|
43
|
-
if (opts.iss && !idOpts.issuer) {
|
|
44
|
-
// legacy way
|
|
45
|
-
console.warn(
|
|
46
|
-
`Legacy iss being used. Support will be dropped in the future. Consider switching to the idOpts, to have support for DIDs, JWKS, x5c etc. See https://github.com/Sphereon-Opensource/SSI-SDK-crypto-extensions/tree/feature/multi_identifier_support/packages/identifier-resolution`
|
|
47
|
-
)
|
|
48
|
-
idOpts.issuer = opts.iss
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return idOpts
|
|
52
|
-
}
|
|
53
|
-
}
|
|
3
|
+
export * from './LegacySupport'
|
|
@@ -17,11 +17,26 @@ import {
|
|
|
17
17
|
ManagedIdentifierKidOpts,
|
|
18
18
|
ManagedIdentifierKidResult,
|
|
19
19
|
ManagedIdentifierOpts,
|
|
20
|
+
ManagedIdentifierOptsOrResult,
|
|
20
21
|
ManagedIdentifierResult,
|
|
21
22
|
ManagedIdentifierX5cOpts,
|
|
22
23
|
ManagedIdentifierX5cResult,
|
|
23
24
|
} from './managedIdentifierTypes'
|
|
24
25
|
|
|
26
|
+
// Exposing the methods here for any REST implementation
|
|
27
|
+
export const identifierResolutionContextMethods: Array<string> = [
|
|
28
|
+
'identifierManagedGet',
|
|
29
|
+
'identifierManagedGetByDid',
|
|
30
|
+
'identifierManagedGetByKid',
|
|
31
|
+
'identifierManagedGetByJwk',
|
|
32
|
+
'identifierManagedGetByX5c',
|
|
33
|
+
'identifierManagedGetByKey',
|
|
34
|
+
'identifierExternalResolve',
|
|
35
|
+
'identifierExternalResolveByDid',
|
|
36
|
+
'identifierExternalResolveByX5c',
|
|
37
|
+
'identifierManagedLazyResult',
|
|
38
|
+
]
|
|
39
|
+
|
|
25
40
|
/**
|
|
26
41
|
* @public
|
|
27
42
|
*/
|
|
@@ -46,6 +61,16 @@ export interface IIdentifierResolution extends IPluginMethodMap {
|
|
|
46
61
|
|
|
47
62
|
identifierManagedGetByKey(args: ManagedIdentifierKeyOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKeyResult>
|
|
48
63
|
|
|
64
|
+
/**
|
|
65
|
+
* 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
|
|
66
|
+
*
|
|
67
|
+
* We use the opts or result type almost everywhere, as it allows for just in time resolution whenever this method is called and afterwards we have the result, so resolution doesn't have to hit the DB, or external endpoints.
|
|
68
|
+
* Also use this method in the local agent, not using REST. If case the identifier needs to be resolved, you can always have the above methods using REST
|
|
69
|
+
* @param identifier
|
|
70
|
+
* @param context
|
|
71
|
+
*/
|
|
72
|
+
identifierManagedLazyResult(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IIdentifierResolution>): Promise<ManagedIdentifierResult>
|
|
73
|
+
|
|
49
74
|
// 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
75
|
|
|
51
76
|
/**
|