@sphereon/ssi-sdk-ext.identifier-resolution 0.24.1-unstable.93 → 0.25.1-feature.SDK.41.oidf.support.11
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 +5 -0
- package/dist/agent/IdentifierResolution.d.ts.map +1 -1
- package/dist/agent/IdentifierResolution.js +31 -1
- 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/externalIdentifierFunctions.d.ts +17 -1
- package/dist/functions/externalIdentifierFunctions.d.ts.map +1 -1
- package/dist/functions/externalIdentifierFunctions.js +89 -6
- package/dist/functions/externalIdentifierFunctions.js.map +1 -1
- package/dist/functions/externalOIDFIdentifier.d.ts +19 -0
- package/dist/functions/externalOIDFIdentifier.d.ts.map +1 -0
- package/dist/functions/externalOIDFIdentifier.js +84 -0
- package/dist/functions/externalOIDFIdentifier.js.map +1 -0
- package/dist/functions/index.d.ts +2 -11
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +2 -36
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/managedIdentifierFunctions.d.ts +17 -3
- package/dist/functions/managedIdentifierFunctions.d.ts.map +1 -1
- package/dist/functions/managedIdentifierFunctions.js +134 -12
- package/dist/functions/managedIdentifierFunctions.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/IIdentifierResolution.d.ts +14 -3
- package/dist/types/IIdentifierResolution.d.ts.map +1 -1
- package/dist/types/IIdentifierResolution.js +18 -0
- package/dist/types/IIdentifierResolution.js.map +1 -1
- package/dist/types/common.d.ts +4 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +21 -10
- package/dist/types/common.js.map +1 -1
- package/dist/types/externalIdentifierTypes.d.ts +38 -6
- package/dist/types/externalIdentifierTypes.d.ts.map +1 -1
- package/dist/types/externalIdentifierTypes.js +16 -7
- package/dist/types/externalIdentifierTypes.js.map +1 -1
- package/dist/types/managedIdentifierTypes.d.ts +43 -15
- package/dist/types/managedIdentifierTypes.d.ts.map +1 -1
- package/dist/types/managedIdentifierTypes.js +24 -11
- package/dist/types/managedIdentifierTypes.js.map +1 -1
- package/package.json +13 -12
- package/plugin.schema.json +2652 -281
- package/src/agent/IdentifierResolution.ts +71 -11
- package/src/functions/LegacySupport.ts +54 -0
- package/src/functions/externalIdentifierFunctions.ts +101 -6
- package/src/functions/externalOIDFIdentifier.ts +95 -0
- package/src/functions/index.ts +2 -51
- package/src/functions/managedIdentifierFunctions.ts +162 -14
- package/src/types/IIdentifierResolution.ts +47 -3
- package/src/types/IJwtService.d.ts +226 -0
- package/src/types/common.ts +14 -2
- package/src/types/externalIdentifierTypes.ts +76 -12
- package/src/types/managedIdentifierTypes.ts +78 -16
|
@@ -24,10 +24,15 @@ export declare class IdentifierResolution implements IAgentPlugin {
|
|
|
24
24
|
private identifierGetManagedByDid;
|
|
25
25
|
private identifierGetManagedByKid;
|
|
26
26
|
private identifierGetManagedByKey;
|
|
27
|
+
private identifierGetManagedByCoseKey;
|
|
28
|
+
private identifierGetManagedByOID4VCIssuer;
|
|
27
29
|
private identifierGetManagedByJwk;
|
|
28
30
|
private identifierGetManagedByX5c;
|
|
29
31
|
private identifierResolveExternal;
|
|
30
32
|
private identifierExternalResolveByDid;
|
|
31
33
|
private identifierExternalResolveByX5c;
|
|
34
|
+
private identifierExternalResolveByCoseKey;
|
|
35
|
+
private identifierExternalResolveByJwk;
|
|
36
|
+
private identifierExternalResolveByOIDFEntityId;
|
|
32
37
|
}
|
|
33
38
|
//# sourceMappingURL=IdentifierResolution.d.ts.map
|
|
@@ -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,
|
|
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,EAWL,qBAAqB,EAiBtB,MAAM,UAAU,CAAA;AAGjB;;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,CAkBtC;IAED;;OAEG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAItC;;;;;;OAMG;YACW,oBAAoB;YAOpB,yBAAyB;YAOzB,yBAAyB;YAOzB,yBAAyB;YAOzB,6BAA6B;YAO7B,kCAAkC;YAOlC,yBAAyB;YAOzB,yBAAyB;YAOzB,yBAAyB;YAIzB,8BAA8B;YAI9B,8BAA8B;YAI9B,kCAAkC;YAOlC,8BAA8B;YAI9B,uCAAuC;CAGtD"}
|
|
@@ -29,9 +29,14 @@ class IdentifierResolution {
|
|
|
29
29
|
identifierManagedGetByJwk: this.identifierGetManagedByJwk.bind(this),
|
|
30
30
|
identifierManagedGetByX5c: this.identifierGetManagedByX5c.bind(this),
|
|
31
31
|
identifierManagedGetByKey: this.identifierGetManagedByKey.bind(this),
|
|
32
|
+
identifierManagedGetByCoseKey: this.identifierGetManagedByCoseKey.bind(this),
|
|
33
|
+
identifierManagedGetByOID4VCIssuer: this.identifierGetManagedByOID4VCIssuer.bind(this),
|
|
32
34
|
identifierExternalResolve: this.identifierResolveExternal.bind(this),
|
|
33
35
|
identifierExternalResolveByDid: this.identifierExternalResolveByDid.bind(this),
|
|
34
36
|
identifierExternalResolveByX5c: this.identifierExternalResolveByX5c.bind(this),
|
|
37
|
+
identifierExternalResolveByJwk: this.identifierExternalResolveByJwk.bind(this),
|
|
38
|
+
identifierExternalResolveByCoseKey: this.identifierExternalResolveByCoseKey.bind(this),
|
|
39
|
+
identifierExternalResolveByOIDFEntityId: this.identifierExternalResolveByOIDFEntityId.bind(this),
|
|
35
40
|
// todo: JWKSet, oidc-discovery, oid4vci-issuer etc. Anything we already can resolve and need keys of
|
|
36
41
|
};
|
|
37
42
|
this._crypto = (_a = opts === null || opts === void 0 ? void 0 : opts.crypto) !== null && _a !== void 0 ? _a : global.crypto;
|
|
@@ -45,7 +50,7 @@ class IdentifierResolution {
|
|
|
45
50
|
*/
|
|
46
51
|
identifierGetManaged(args, context) {
|
|
47
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
return yield (0, functions_1.
|
|
53
|
+
return yield (0, functions_1.ensureManagedIdentifierResult)(Object.assign(Object.assign({}, args), { crypto: this._crypto }), context);
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
identifierGetManagedByDid(args, context) {
|
|
@@ -63,6 +68,16 @@ class IdentifierResolution {
|
|
|
63
68
|
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'key' }), context));
|
|
64
69
|
});
|
|
65
70
|
}
|
|
71
|
+
identifierGetManagedByCoseKey(args, context) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'cose_key' }), context));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
identifierGetManagedByOID4VCIssuer(args, context) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'oid4vci-issuer' }), context));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
66
81
|
identifierGetManagedByJwk(args, context) {
|
|
67
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
83
|
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'jwk' }), context));
|
|
@@ -88,6 +103,21 @@ class IdentifierResolution {
|
|
|
88
103
|
return (yield this.identifierResolveExternal(Object.assign(Object.assign({}, args), { method: 'x5c' }), context));
|
|
89
104
|
});
|
|
90
105
|
}
|
|
106
|
+
identifierExternalResolveByCoseKey(args, context) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
return (yield this.identifierResolveExternal(Object.assign(Object.assign({}, args), { method: 'cose_key' }), context));
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
identifierExternalResolveByJwk(args, context) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
return (yield this.identifierResolveExternal(Object.assign(Object.assign({}, args), { method: 'jwk' }), context));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
identifierExternalResolveByOIDFEntityId(args, context) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
return (yield this.identifierResolveExternal(Object.assign(Object.assign({}, args), { method: 'entity_id' }), context));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
91
121
|
}
|
|
92
122
|
exports.IdentifierResolution = IdentifierResolution;
|
|
93
123
|
//# sourceMappingURL=IdentifierResolution.js.map
|
|
@@ -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":";;;;;;;;;;;;AACA,0BAAqG;AACrG,4CAAuF;AAgCvF;;GAEG;AACH,MAAa,oBAAoB;IAwB/B;;OAEG;IACH,YAAY,IAA0B;;QAxB7B,WAAM,GAAG,UAAM,CAAC,sBAAsB,CAAA;QACtC,YAAO,GAA0B;YACxC,oBAAoB,EAAE,IAAI,CAAC,o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* 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,CAyChC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.legacyKeyRefsToIdentifierOpts = legacyKeyRefsToIdentifierOpts;
|
|
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, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
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 = (_h = (_f = (_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 : (_e = opts.didOpts) === null || _e === void 0 ? void 0 : _e.kid) !== null && _f !== void 0 ? _f : (_g = opts.didOpts.idOpts) === null || _g === void 0 ? void 0 : _g.kid) !== null && _h !== void 0 ? _h : (typeof ((_j = opts.didOpts) === null || _j === void 0 ? void 0 : _j.idOpts.identifier) === 'object' ? ((_k = opts.didOpts) === null || _k === void 0 ? void 0 : _k.idOpts.identifier).keys[0].kid : undefined);
|
|
14
|
+
if (!kmsKeyRef) {
|
|
15
|
+
throw Error('Key ref is needed for access token signer');
|
|
16
|
+
}
|
|
17
|
+
let identifier = ((_m = (_l = opts.didOpts) === null || _l === void 0 ? void 0 : _l.identifier) !== null && _m !== void 0 ? _m : (_p = (_o = opts.didOpts) === null || _o === void 0 ? void 0 : _o.idOpts) === null || _p === void 0 ? void 0 : _p.identifier);
|
|
18
|
+
return {
|
|
19
|
+
kmsKeyRef: (_q = opts.keyRef) !== null && _q !== void 0 ? _q : kmsKeyRef,
|
|
20
|
+
identifier: identifier !== null && identifier !== void 0 ? identifier : kmsKeyRef,
|
|
21
|
+
issuer: opts.iss,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const idOpts = opts.idOpts;
|
|
26
|
+
if (opts.keyRef && !idOpts.kmsKeyRef) {
|
|
27
|
+
// legacy way
|
|
28
|
+
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`);
|
|
29
|
+
idOpts.kmsKeyRef = opts.keyRef;
|
|
30
|
+
}
|
|
31
|
+
if (opts.iss && !idOpts.issuer) {
|
|
32
|
+
// legacy way
|
|
33
|
+
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`);
|
|
34
|
+
idOpts.issuer = opts.iss;
|
|
35
|
+
}
|
|
36
|
+
return idOpts;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=LegacySupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegacySupport.js","sourceRoot":"","sources":["../../src/functions/LegacySupport.ts"],"names":[],"mappings":";;AAOA,sEA8CC;AAlDD;;;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,MAAA,MAAA,IAAI,CAAC,MAAM,mCACX,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,0CAAE,SAAS,mCAC/B,MAAA,IAAI,CAAC,OAAO,0CAAE,GAAG,mCACjB,MAAA,IAAI,CAAC,OAAO,CAAC,MAAM,0CAAE,GAAG,mCACxB,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,IAAI,UAAU,GAAG,CAAC,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,UAAU,mCAAI,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,0CAAE,UAAU,CAA4B,CAAA;QAE1G,OAAO;YACL,SAAS,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,SAAS;YACnC,UAAU,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,SAAS;YACnC,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"}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { IAgentContext, IDIDManager, IResolver } from '@veramo/core';
|
|
2
|
-
import { ExternalIdentifierDidOpts, ExternalIdentifierDidResult, ExternalIdentifierOpts, ExternalIdentifierResult, ExternalIdentifierX5cOpts, ExternalIdentifierX5cResult } from '../types';
|
|
2
|
+
import { ExternalIdentifierCoseKeyOpts, ExternalIdentifierCoseKeyResult, ExternalIdentifierDidOpts, ExternalIdentifierDidResult, ExternalIdentifierJwkOpts, ExternalIdentifierJwkResult, ExternalIdentifierOpts, ExternalIdentifierResult, ExternalIdentifierX5cOpts, ExternalIdentifierX5cResult } from '../types';
|
|
3
3
|
export declare function resolveExternalIdentifier(opts: ExternalIdentifierOpts & {
|
|
4
4
|
crypto?: Crypto;
|
|
5
5
|
}, context: IAgentContext<any>): Promise<ExternalIdentifierResult>;
|
|
6
6
|
export declare function resolveExternalX5cIdentifier(opts: ExternalIdentifierX5cOpts & {
|
|
7
7
|
crypto?: Crypto;
|
|
8
8
|
}, context: IAgentContext<IResolver & IDIDManager>): Promise<ExternalIdentifierX5cResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves a JWK. Normally this is just returning the JWK, but in case the JWK contains a x5c the chain is validated
|
|
11
|
+
* @param opts
|
|
12
|
+
* @param context
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveExternalJwkIdentifier(opts: ExternalIdentifierJwkOpts & {
|
|
15
|
+
x5c?: ExternalIdentifierX5cOpts;
|
|
16
|
+
}, context: IAgentContext<any>): Promise<ExternalIdentifierJwkResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves a JWK. Normally this is just returning the JWK, but in case the JWK contains a x5c the chain is validated
|
|
19
|
+
* @param opts
|
|
20
|
+
* @param context
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveExternalCoseKeyIdentifier(opts: ExternalIdentifierCoseKeyOpts & {
|
|
23
|
+
x5c?: ExternalIdentifierX5cOpts;
|
|
24
|
+
}, context: IAgentContext<any>): Promise<ExternalIdentifierCoseKeyResult>;
|
|
9
25
|
export declare function resolveExternalDidIdentifier(opts: ExternalIdentifierDidOpts, context: IAgentContext<IResolver & IDIDManager>): Promise<ExternalIdentifierDidResult>;
|
|
10
26
|
//# sourceMappingURL=externalIdentifierFunctions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalIdentifierFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/externalIdentifierFunctions.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGpE,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAE3B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"externalIdentifierFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/externalIdentifierFunctions.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGpE,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAE3B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAU5B,MAAM,UAAU,CAAA;AAIjB,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,sBAAsB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAC1B,OAAO,CAAC,wBAAwB,CAAC,CAoBnC;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,GAAG;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,SAAS,GAAG,WAAW,CAAC,GAC9C,OAAO,CAAC,2BAA2B,CAAC,CA4EtC;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,GAAG;IAChC,GAAG,CAAC,EAAE,yBAAyB,CAAA;CAChC,EACD,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAuBtC;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CACpD,IAAI,EAAE,6BAA6B,GAAG;IACpC,GAAG,CAAC,EAAE,yBAAyB,CAAA;CAChC,EACD,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAC1B,OAAO,CAAC,+BAA+B,CAAC,CAyB1C;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,aAAa,CAAC,SAAS,GAAG,WAAW,CAAC,GAC9C,OAAO,CAAC,2BAA2B,CAAC,CAqDtC"}
|
|
@@ -9,7 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.resolveExternalIdentifier = resolveExternalIdentifier;
|
|
13
|
+
exports.resolveExternalX5cIdentifier = resolveExternalX5cIdentifier;
|
|
14
|
+
exports.resolveExternalJwkIdentifier = resolveExternalJwkIdentifier;
|
|
15
|
+
exports.resolveExternalCoseKeyIdentifier = resolveExternalCoseKeyIdentifier;
|
|
16
|
+
exports.resolveExternalDidIdentifier = resolveExternalDidIdentifier;
|
|
13
17
|
const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
14
18
|
const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
15
19
|
const ssi_sdk_ext_x509_utils_1 = require("@sphereon/ssi-sdk-ext.x509-utils");
|
|
@@ -18,6 +22,7 @@ const ssi_types_1 = require("@sphereon/ssi-types");
|
|
|
18
22
|
const utils_1 = require("@veramo/utils");
|
|
19
23
|
const pkijs_1 = require("pkijs");
|
|
20
24
|
const types_1 = require("../types");
|
|
25
|
+
const _1 = require(".");
|
|
21
26
|
function resolveExternalIdentifier(opts, context) {
|
|
22
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
28
|
let method;
|
|
@@ -27,6 +32,15 @@ function resolveExternalIdentifier(opts, context) {
|
|
|
27
32
|
else if ((0, types_1.isExternalIdentifierX5cOpts)(opts)) {
|
|
28
33
|
return resolveExternalX5cIdentifier(opts, context);
|
|
29
34
|
}
|
|
35
|
+
else if ((0, types_1.isExternalIdentifierJwkOpts)(opts)) {
|
|
36
|
+
return resolveExternalJwkIdentifier(opts, context);
|
|
37
|
+
}
|
|
38
|
+
else if ((0, types_1.isExternalIdentifierCoseKeyOpts)(opts)) {
|
|
39
|
+
return resolveExternalCoseKeyIdentifier(opts, context);
|
|
40
|
+
}
|
|
41
|
+
else if ((0, types_1.isExternalIdentifierOIDFEntityIdOpts)(opts)) {
|
|
42
|
+
return (0, _1.resolveExternalOIDFEntityIdIdentifier)(opts, context);
|
|
43
|
+
}
|
|
30
44
|
else if ((0, types_1.isExternalIdentifierKidOpts)(opts)) {
|
|
31
45
|
method = 'kid';
|
|
32
46
|
}
|
|
@@ -39,7 +53,6 @@ function resolveExternalIdentifier(opts, context) {
|
|
|
39
53
|
throw Error(`External resolution method ${method} is not yet implemented`);
|
|
40
54
|
});
|
|
41
55
|
}
|
|
42
|
-
exports.resolveExternalIdentifier = resolveExternalIdentifier;
|
|
43
56
|
function resolveExternalX5cIdentifier(opts, context) {
|
|
44
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
58
|
var _a, _b, _c, _d;
|
|
@@ -49,7 +62,7 @@ function resolveExternalX5cIdentifier(opts, context) {
|
|
|
49
62
|
const verify = (_a = opts.verify) !== null && _a !== void 0 ? _a : true;
|
|
50
63
|
const x5c = opts.identifier.map((derOrPem) => (derOrPem.includes('CERTIFICATE') ? (0, ssi_sdk_ext_x509_utils_1.PEMToDer)(derOrPem) : derOrPem));
|
|
51
64
|
if (x5c.length === 0) {
|
|
52
|
-
return Promise.reject('Empty certification chain is
|
|
65
|
+
return Promise.reject('Empty certification chain is not allowed');
|
|
53
66
|
}
|
|
54
67
|
const certificates = x5c.map(ssi_sdk_ext_x509_utils_1.pemOrDerToX509Certificate);
|
|
55
68
|
let verificationResult;
|
|
@@ -69,6 +82,7 @@ function resolveExternalX5cIdentifier(opts, context) {
|
|
|
69
82
|
chain: opts.identifier,
|
|
70
83
|
trustAnchors: (_c = opts.trustAnchors) !== null && _c !== void 0 ? _c : [],
|
|
71
84
|
verificationTime: opts.verificationTime,
|
|
85
|
+
opts,
|
|
72
86
|
});
|
|
73
87
|
}
|
|
74
88
|
if (verificationResult.certificateChain) {
|
|
@@ -77,6 +91,7 @@ function resolveExternalX5cIdentifier(opts, context) {
|
|
|
77
91
|
jwk: cert.publicKeyJWK,
|
|
78
92
|
kid: cert.subject.dn.DN,
|
|
79
93
|
jwkThumbprint: (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk: cert.publicKeyJWK }),
|
|
94
|
+
publicKeyHex: (0, ssi_sdk_ext_did_utils_1.jwkTtoPublicKeyHex)(cert.publicKeyJWK),
|
|
80
95
|
};
|
|
81
96
|
});
|
|
82
97
|
}
|
|
@@ -94,6 +109,7 @@ function resolveExternalX5cIdentifier(opts, context) {
|
|
|
94
109
|
jwk,
|
|
95
110
|
kid: (0, ssi_sdk_ext_x509_utils_1.getSubjectDN)(cert).DN,
|
|
96
111
|
jwkThumbprint: (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk }),
|
|
112
|
+
publicKeyHex: (0, ssi_sdk_ext_did_utils_1.jwkTtoPublicKeyHex)(jwk),
|
|
97
113
|
};
|
|
98
114
|
})));
|
|
99
115
|
}
|
|
@@ -113,7 +129,70 @@ function resolveExternalX5cIdentifier(opts, context) {
|
|
|
113
129
|
};
|
|
114
130
|
});
|
|
115
131
|
}
|
|
116
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Resolves a JWK. Normally this is just returning the JWK, but in case the JWK contains a x5c the chain is validated
|
|
134
|
+
* @param opts
|
|
135
|
+
* @param context
|
|
136
|
+
*/
|
|
137
|
+
function resolveExternalJwkIdentifier(opts, context) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
if (!(0, types_1.isExternalIdentifierJwkOpts)(opts)) {
|
|
140
|
+
return Promise.reject('External JWK Identifier args need to be provided');
|
|
141
|
+
}
|
|
142
|
+
const jwk = opts.identifier;
|
|
143
|
+
let x5c = undefined;
|
|
144
|
+
if (jwk.x5c) {
|
|
145
|
+
x5c = yield resolveExternalX5cIdentifier(Object.assign(Object.assign({}, opts.x5c), { identifier: jwk.x5c }), context);
|
|
146
|
+
}
|
|
147
|
+
const jwkThumbprint = (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
|
|
148
|
+
return {
|
|
149
|
+
method: 'jwk',
|
|
150
|
+
jwk,
|
|
151
|
+
jwks: [
|
|
152
|
+
{
|
|
153
|
+
jwk,
|
|
154
|
+
jwkThumbprint,
|
|
155
|
+
kid: jwk.kid,
|
|
156
|
+
publicKeyHex: (0, ssi_sdk_ext_did_utils_1.jwkTtoPublicKeyHex)(jwk),
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
x5c,
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Resolves a JWK. Normally this is just returning the JWK, but in case the JWK contains a x5c the chain is validated
|
|
165
|
+
* @param opts
|
|
166
|
+
* @param context
|
|
167
|
+
*/
|
|
168
|
+
function resolveExternalCoseKeyIdentifier(opts, context) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
if (!(0, types_1.isExternalIdentifierCoseKeyOpts)(opts)) {
|
|
171
|
+
return Promise.reject('External Cose Key args need to be provided');
|
|
172
|
+
}
|
|
173
|
+
// TODO: We need to do cbor conversion here as well.
|
|
174
|
+
const coseKey = opts.identifier;
|
|
175
|
+
let x5c = undefined;
|
|
176
|
+
if (coseKey.x5chain) {
|
|
177
|
+
x5c = yield resolveExternalX5cIdentifier(Object.assign(Object.assign({}, opts.x5c), { identifier: coseKey.x5chain }), context);
|
|
178
|
+
}
|
|
179
|
+
const jwk = (0, ssi_sdk_ext_key_utils_1.coseKeyToJwk)(coseKey);
|
|
180
|
+
const jwkThumbprint = (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
|
|
181
|
+
return {
|
|
182
|
+
method: 'cose_key',
|
|
183
|
+
coseKey,
|
|
184
|
+
jwks: [
|
|
185
|
+
{
|
|
186
|
+
jwk,
|
|
187
|
+
jwkThumbprint,
|
|
188
|
+
kid: coseKey.kid,
|
|
189
|
+
publicKeyHex: (0, ssi_sdk_ext_did_utils_1.jwkTtoPublicKeyHex)(jwk),
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
x5c,
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
}
|
|
117
196
|
function resolveExternalDidIdentifier(opts, context) {
|
|
118
197
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
198
|
var _a;
|
|
@@ -145,7 +224,12 @@ function resolveExternalDidIdentifier(opts, context) {
|
|
|
145
224
|
? Array.from(new Set(Object.values(didJwks)
|
|
146
225
|
.filter((jwks) => (0, utils_1.isDefined)(jwks) && jwks.length > 0)
|
|
147
226
|
.flatMap((jwks) => jwks))).map((jwk) => {
|
|
148
|
-
return {
|
|
227
|
+
return {
|
|
228
|
+
jwk,
|
|
229
|
+
jwkThumbprint: (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk }),
|
|
230
|
+
kid: jwk.kid,
|
|
231
|
+
publicKeyHex: (0, ssi_sdk_ext_did_utils_1.jwkTtoPublicKeyHex)(jwk),
|
|
232
|
+
};
|
|
149
233
|
})
|
|
150
234
|
: [];
|
|
151
235
|
if (didResolutionResult === null || didResolutionResult === void 0 ? void 0 : didResolutionResult.didDocument) {
|
|
@@ -163,5 +247,4 @@ function resolveExternalDidIdentifier(opts, context) {
|
|
|
163
247
|
};
|
|
164
248
|
});
|
|
165
249
|
}
|
|
166
|
-
exports.resolveExternalDidIdentifier = resolveExternalDidIdentifier;
|
|
167
250
|
//# sourceMappingURL=externalIdentifierFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalIdentifierFunctions.js","sourceRoot":"","sources":["../../src/functions/externalIdentifierFunctions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"externalIdentifierFunctions.js","sourceRoot":"","sources":["../../src/functions/external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AAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBACZ,OAAO;oBACL,GAAG;oBACH,aAAa,EAAE,IAAA,8CAAsB,EAAC,EAAE,GAAG,EAAE,CAAC;oBAC9C,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,YAAY,EAAE,IAAA,0CAAkB,EAAC,GAAG,CAAC;iBACtC,CAAA;YACH,CAAC,CAAC;YACJ,CAAC,CAAC,EAAE,CAAA;QAEN,IAAI,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,WAAW,EAAE,CAAC;YACrC,qFAAqF;YACrF,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAA;QAC3C,CAAC;QACD,OAAO;YACL,MAAM,EAAE,KAAK;YACb,GAAG;YACH,IAAI;YACJ,OAAO;YACP,WAAW;YACX,mBAAmB;YACnB,SAAS;SACV,CAAA;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExternalIdentifierOIDFEntityIdOpts, ExternalIdentifierOIDFEntityIdResult } from '../types';
|
|
2
|
+
import { IAgentContext } from '@veramo/core';
|
|
3
|
+
import { IOIDFClient } from '@sphereon/ssi-sdk.oidf-client';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves an OIDF Entity ID against multiple trust anchors to establish trusted relationships
|
|
6
|
+
*
|
|
7
|
+
* @param opts Configuration options containing the identifier to resolve and trust anchors to validate against
|
|
8
|
+
* @param context Agent context that must include the OIDF client plugin and JWT verification capabilities
|
|
9
|
+
*
|
|
10
|
+
* @returns Promise resolving to an ExternalIdentifierOIDFEntityIdResult containing:
|
|
11
|
+
* - trustedAnchors: Record mapping trust anchors to their public key hexes
|
|
12
|
+
* - errorList: Optional record of errors encountered per trust anchor
|
|
13
|
+
* - jwks: Array of JWK information from the trust chain
|
|
14
|
+
* - trustEstablished: Boolean indicating if any trust relationships were established
|
|
15
|
+
*
|
|
16
|
+
* @throws Error if trust anchors are missing or JWT verification plugin is not enabled
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveExternalOIDFEntityIdIdentifier(opts: ExternalIdentifierOIDFEntityIdOpts, context: IAgentContext<IOIDFClient>): Promise<ExternalIdentifierOIDFEntityIdResult>;
|
|
19
|
+
//# sourceMappingURL=externalOIDFIdentifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalOIDFIdentifier.d.ts","sourceRoot":"","sources":["../../src/functions/externalOIDFIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kCAAkC,EAClC,oCAAoC,EAGrC,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAK3D;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qCAAqC,CACzD,IAAI,EAAE,kCAAkC,EACxC,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,oCAAoC,CAAC,CAgE/C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.resolveExternalOIDFEntityIdIdentifier = resolveExternalOIDFEntityIdIdentifier;
|
|
13
|
+
const ssi_sdk_agent_config_1 = require("@sphereon/ssi-sdk.agent-config");
|
|
14
|
+
/**
|
|
15
|
+
* Resolves an OIDF Entity ID against multiple trust anchors to establish trusted relationships
|
|
16
|
+
*
|
|
17
|
+
* @param opts Configuration options containing the identifier to resolve and trust anchors to validate against
|
|
18
|
+
* @param context Agent context that must include the OIDF client plugin and JWT verification capabilities
|
|
19
|
+
*
|
|
20
|
+
* @returns Promise resolving to an ExternalIdentifierOIDFEntityIdResult containing:
|
|
21
|
+
* - trustedAnchors: Record mapping trust anchors to their public key hexes
|
|
22
|
+
* - errorList: Optional record of errors encountered per trust anchor
|
|
23
|
+
* - jwks: Array of JWK information from the trust chain
|
|
24
|
+
* - trustEstablished: Boolean indicating if any trust relationships were established
|
|
25
|
+
*
|
|
26
|
+
* @throws Error if trust anchors are missing or JWT verification plugin is not enabled
|
|
27
|
+
*/
|
|
28
|
+
function resolveExternalOIDFEntityIdIdentifier(opts, context) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
var _a;
|
|
31
|
+
let { trustAnchors, identifier } = opts;
|
|
32
|
+
if (!trustAnchors || trustAnchors.length === 0) {
|
|
33
|
+
return Promise.reject(Error('ExternalIdentifierOIDFEntityIdOpts is missing the trustAnchors'));
|
|
34
|
+
}
|
|
35
|
+
if (!(0, ssi_sdk_agent_config_1.contextHasPlugin)(context, 'jwtVerifyJwsSignature')) {
|
|
36
|
+
return Promise.reject(Error('For OIDFEntityId resolving the agent needs to have the JwtService plugin enabled'));
|
|
37
|
+
}
|
|
38
|
+
const trustedAnchors = {};
|
|
39
|
+
const errorList = {};
|
|
40
|
+
const jwkInfos = [];
|
|
41
|
+
for (const trustAnchor of trustAnchors) {
|
|
42
|
+
const resolveResult = yield context.agent.resolveTrustChain({
|
|
43
|
+
entityIdentifier: identifier,
|
|
44
|
+
trustAnchors: [trustAnchor]
|
|
45
|
+
});
|
|
46
|
+
if (resolveResult.error || !resolveResult.trustChain) {
|
|
47
|
+
errorList[trustAnchor] = (_a = resolveResult.errorMessage) !== null && _a !== void 0 ? _a : 'unspecified';
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const trustChain = resolveResult.trustChain.asJsReadonlyArrayView();
|
|
51
|
+
let authorityJWK = undefined;
|
|
52
|
+
for (const [i, jwt] of [...trustChain].reverse().entries()) {
|
|
53
|
+
const isLast = i === trustChain.length - 1;
|
|
54
|
+
const verifyArgs = { jws: jwt };
|
|
55
|
+
if (authorityJWK && !isLast) {
|
|
56
|
+
verifyArgs.jwk = authorityJWK;
|
|
57
|
+
}
|
|
58
|
+
const jwtVerifyResult = yield context.agent.jwtVerifyJwsSignature(verifyArgs);
|
|
59
|
+
if (jwtVerifyResult.error || jwtVerifyResult.critical) {
|
|
60
|
+
errorList[trustAnchor] = jwtVerifyResult.message;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
if (jwtVerifyResult.jws.signatures.length === 0) {
|
|
64
|
+
errorList[trustAnchor] = 'No signature was present in the trust anchor JWS';
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
const signature = jwtVerifyResult.jws.signatures[0];
|
|
68
|
+
if (signature.identifier.jwks.length === 0) {
|
|
69
|
+
errorList[trustAnchor] = 'No JWK was present in the trust anchor signature';
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
const jwkInfo = signature.identifier.jwks[0];
|
|
73
|
+
if (!authorityJWK) {
|
|
74
|
+
authorityJWK = jwkInfo.jwk;
|
|
75
|
+
jwkInfos.push(jwkInfo);
|
|
76
|
+
trustedAnchors[trustAnchor] = signature.publicKeyHex; // When we have multiple hits from different trust anchor authorities the caller can infer which signature came from which trust anchor
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Object.assign(Object.assign({ method: 'entity_id', trustedAnchors }, (Object.keys(errorList).length > 0 && { errorList })), { jwks: jwkInfos, trustEstablished: Object.keys(trustedAnchors).length > 0 });
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=externalOIDFIdentifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalOIDFIdentifier.js","sourceRoot":"","sources":["../../src/functions/externalOIDFIdentifier.ts"],"names":[],"mappings":";;;;;;;;;;;AA2BA,sFAmEC;AArFD,yEAAiE;AAIjE;;;;;;;;;;;;;GAaG;AACH,SAAsB,qCAAqC,CACzD,IAAwC,EACxC,OAAmC;;;QAEnC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;QAEvC,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC,CAAA;QAChG,CAAC;QAED,IAAI,CAAC,IAAA,uCAAgB,EAAC,OAAO,EAAE,uBAAuB,CAAC,EAAE,CAAC;YACxD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAC,CAAA;QAClH,CAAC;QAED,MAAM,cAAc,GAAwC,EAAE,CAAA;QAC9D,MAAM,SAAS,GAAwC,EAAE,CAAA;QACzD,MAAM,QAAQ,GAA2B,EAAE,CAAA;QAE3C,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;gBAC1D,gBAAgB,EAAE,UAAU;gBAC5B,YAAY,EAAE,CAAC,WAAW,CAAC;aAC5B,CAAC,CAAA;YAEF,IAAI,aAAa,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;gBACrD,SAAS,CAAC,WAAW,CAAC,GAAG,MAAA,aAAa,CAAC,YAAY,mCAAI,aAAa,CAAA;YACtE,CAAC;iBAAM,CAAC;gBACN,MAAM,UAAU,GAA0B,aAAa,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAA;gB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C,IAAI,CAAC,OAAO,CAAC,CAAA;wBACtB,cAAc,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,YAAY,CAAA,CAAC,yIAAyI;oBAChM,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,qCACE,MAAM,EAAE,WAAW,EACnB,cAAc,IACX,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,KACvD,IAAI,EAAE,QAAQ,EACd,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,GAAG,CAAC,IACzD;IACH,CAAC;CAAA"}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { ManagedIdentifierOpts } from '../types';
|
|
2
1
|
export * from './managedIdentifierFunctions';
|
|
3
2
|
export * from './externalIdentifierFunctions';
|
|
4
|
-
|
|
5
|
-
*
|
|
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 './externalOIDFIdentifier';
|
|
4
|
+
export * from './LegacySupport';
|
|
14
5
|
//# 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,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA"}
|
package/dist/functions/index.js
CHANGED
|
@@ -14,42 +14,8 @@ 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
|
-
|
|
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("./externalOIDFIdentifier"), exports);
|
|
20
|
+
__exportStar(require("./LegacySupport"), exports);
|
|
55
21
|
//# 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,2DAAwC;AACxC,kDAA+B"}
|