@sphereon/ssi-sdk-ext.identifier-resolution 0.24.1-unstable.81 → 0.24.1-unstable.82
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.
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import { ManagedIdentifierOpts } from '../types';
|
|
1
2
|
export * from './managedIdentifierFunctions';
|
|
2
3
|
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
14
|
//# 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":"AACA,OAAO,EAA4B,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAE1E,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAE7C;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,MAAM,CAAC,EAAE,qBAAqB,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,GAAG,CAAA;CACd,GAAG,qBAAqB,CAqCxB"}
|
package/dist/functions/index.js
CHANGED
|
@@ -14,6 +14,42 @@ 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;
|
|
17
18
|
__exportStar(require("./managedIdentifierFunctions"), exports);
|
|
18
19
|
__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
55
|
//# 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":";;;;;;;;;;;;;;;;;AAGA,+DAA4C;AAC5C,gEAA6C;AAE7C;;;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk-ext.identifier-resolution",
|
|
3
|
-
"version": "0.24.1-unstable.
|
|
3
|
+
"version": "0.24.1-unstable.82+2527964",
|
|
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-unstable.
|
|
19
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.24.1-unstable.
|
|
20
|
-
"@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-unstable.
|
|
18
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.82+2527964",
|
|
19
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.24.1-unstable.82+2527964",
|
|
20
|
+
"@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-unstable.82+2527964",
|
|
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-unstable.
|
|
31
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-unstable.
|
|
32
|
-
"@sphereon/ssi-sdk-ext.key-manager": "0.24.1-unstable.
|
|
33
|
-
"@sphereon/ssi-sdk-ext.kms-local": "0.24.1-unstable.
|
|
30
|
+
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.24.1-unstable.82+2527964",
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-unstable.82+2527964",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.key-manager": "0.24.1-unstable.82+2527964",
|
|
33
|
+
"@sphereon/ssi-sdk-ext.kms-local": "0.24.1-unstable.82+2527964",
|
|
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": "2527964bfb0eec681bf27c3194faf766217a532d"
|
|
68
68
|
}
|
package/src/functions/index.ts
CHANGED
|
@@ -1,2 +1,53 @@
|
|
|
1
|
+
import { IIdentifier } from '@veramo/core'
|
|
2
|
+
import { ManagedIdentifierDidOpts, ManagedIdentifierOpts } from '../types'
|
|
3
|
+
|
|
1
4
|
export * from './managedIdentifierFunctions'
|
|
2
5
|
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
|
+
}
|