@sphereon/ssi-sdk.sd-jwt 0.29.0 → 0.29.1-next.103
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/action-handler.d.ts +3 -3
- package/dist/action-handler.d.ts.map +1 -1
- package/dist/action-handler.js +68 -40
- package/dist/action-handler.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/trustAnchors.d.ts +3 -0
- package/dist/trustAnchors.d.ts.map +1 -0
- package/dist/trustAnchors.js +20 -0
- package/dist/trustAnchors.js.map +1 -0
- package/dist/types.d.ts +20 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -1
- package/package.json +12 -9
- package/src/__tests__/sd-jwt.test.ts +2 -2
- package/src/action-handler.ts +71 -44
- package/src/index.ts +0 -5
- package/src/trustAnchors.ts +19 -0
- package/src/types.ts +30 -3
- package/dist/ssi-sdk.sd-jwt.d.ts +0 -261
- package/dist/tsdoc-metadata.json +0 -11
- package/plugin.schema.json +0 -254
package/dist/action-handler.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SignKeyArgs, SignKeyResult } from './index';
|
|
1
2
|
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
|
|
2
3
|
import { IAgentPlugin } from '@veramo/core';
|
|
3
4
|
import { SdJWTImplementation, ICreateSdJwtVcArgs, ICreateSdJwtVcResult, ICreateSdJwtPresentationArgs, ICreateSdJwtPresentationResult, IRequiredContext, ISDJwtPlugin, IVerifySdJwtVcArgs, IVerifySdJwtVcResult, IVerifySdJwtPresentationArgs, IVerifySdJwtPresentationResult } from './types';
|
|
@@ -7,7 +8,6 @@ import { SdJWTImplementation, ICreateSdJwtVcArgs, ICreateSdJwtVcResult, ICreateS
|
|
|
7
8
|
*/
|
|
8
9
|
export declare class SDJwtPlugin implements IAgentPlugin {
|
|
9
10
|
private algorithms;
|
|
10
|
-
readonly schema: any;
|
|
11
11
|
constructor(algorithms: SdJWTImplementation);
|
|
12
12
|
readonly methods: ISDJwtPlugin;
|
|
13
13
|
/**
|
|
@@ -19,11 +19,11 @@ export declare class SDJwtPlugin implements IAgentPlugin {
|
|
|
19
19
|
createSdJwtVc(args: ICreateSdJwtVcArgs, context: IRequiredContext): Promise<ICreateSdJwtVcResult>;
|
|
20
20
|
/**
|
|
21
21
|
* Get the key to sign the SD-JWT
|
|
22
|
-
* @param
|
|
22
|
+
* @param args - consists of twp arguments: identifier like a did and other forms of identifiers and vmRelationship which represents the purpose of the key
|
|
23
23
|
* @param context - agent instance
|
|
24
24
|
* @returns the key to sign the SD-JWT
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
getSignKey(args: SignKeyArgs, context: IRequiredContext): Promise<SignKeyResult>;
|
|
27
27
|
/**
|
|
28
28
|
* Create a signed SD-JWT presentation.
|
|
29
29
|
* @param args - Arguments necessary for the creation of a SD-JWT presentation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-handler.d.ts","sourceRoot":"","sources":["../src/action-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action-handler.d.ts","sourceRoot":"","sources":["../src/action-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAA;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAC5B,8BAA8B,EAC9B,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAC5B,8BAA8B,EAE/B,MAAM,SAAS,CAAA;AAOhB;;;GAGG;AACH,qBAAa,WAAY,YAAW,YAAY;IAClC,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,mBAAmB;IAGnD,QAAQ,CAAC,OAAO,EAAE,YAAY,CAK7B;IAED;;;;;OAKG;IACG,aAAa,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuBvG;;;;;OAKG;IACG,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IA6BtF;;;;;OAKG;IACG,uBAAuB,CAAC,IAAI,EAAE,4BAA4B,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,8BAA8B,CAAC;IA6BrI;;;;;OAKG;IACG,aAAa,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAWvG;;;;;;;;OAQG;IACH,OAAO,CAAC,QAAQ;IAQhB;;;;;;;OAOG;IACG,MAAM,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAuC/F;;;;;OAKG;IACG,uBAAuB,CAAC,IAAI,EAAE,4BAA4B,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAgBrI,OAAO,CAAC,mBAAmB;CAY5B"}
|
package/dist/action-handler.js
CHANGED
|
@@ -14,12 +14,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SDJwtPlugin = void 0;
|
|
16
16
|
const debug_1 = __importDefault(require("debug"));
|
|
17
|
-
const index_1 = require("./index");
|
|
18
17
|
const core_1 = require("@sd-jwt/core");
|
|
19
18
|
const sd_jwt_vc_1 = require("@sd-jwt/sd-jwt-vc");
|
|
20
19
|
const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
20
|
+
const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
21
|
+
const trustAnchors_1 = require("./trustAnchors");
|
|
22
|
+
const debug = (0, debug_1.default)('@sphereon/ssi-sdk.sd-jwt');
|
|
23
23
|
/**
|
|
24
24
|
* @beta
|
|
25
25
|
* SD-JWT plugin for Veramo
|
|
@@ -27,7 +27,6 @@ const debug = (0, debug_1.default)('sd-jwt');
|
|
|
27
27
|
class SDJwtPlugin {
|
|
28
28
|
constructor(algorithms) {
|
|
29
29
|
this.algorithms = algorithms;
|
|
30
|
-
this.schema = index_1.schema.ISDJwtPlugin;
|
|
31
30
|
// map the methods your plugin is declaring to their implementation
|
|
32
31
|
this.methods = {
|
|
33
32
|
createSdJwtVc: this.createSdJwtVc.bind(this),
|
|
@@ -48,7 +47,7 @@ class SDJwtPlugin {
|
|
|
48
47
|
if (!issuer) {
|
|
49
48
|
throw new Error('credential.issuer must not be empty');
|
|
50
49
|
}
|
|
51
|
-
const { alg, key } = yield this.getSignKey(issuer, context);
|
|
50
|
+
const { alg, key } = yield this.getSignKey({ identifier: issuer, vmRelationship: 'assertionMethod' }, context);
|
|
52
51
|
//TODO: let the user also insert a method to sign the data
|
|
53
52
|
const signer = (data) => __awaiter(this, void 0, void 0, function* () { return context.agent.keyManagerSign({ keyRef: key.kid, data }); });
|
|
54
53
|
const sdjwt = new sd_jwt_vc_1.SDJwtVcInstance({
|
|
@@ -64,27 +63,42 @@ class SDJwtPlugin {
|
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
65
|
* Get the key to sign the SD-JWT
|
|
67
|
-
* @param
|
|
66
|
+
* @param args - consists of twp arguments: identifier like a did and other forms of identifiers and vmRelationship which represents the purpose of the key
|
|
68
67
|
* @param context - agent instance
|
|
69
68
|
* @returns the key to sign the SD-JWT
|
|
70
69
|
*/
|
|
71
|
-
getSignKey(
|
|
70
|
+
getSignKey(args, context) {
|
|
72
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
|
|
74
|
-
const identifier =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const { identifier, vmRelationship } = Object.assign({}, args);
|
|
74
|
+
if (identifier.startsWith('did:')) {
|
|
75
|
+
const didIdentifier = yield context.agent.didManagerGet({
|
|
76
|
+
did: identifier.split('#')[0],
|
|
77
|
+
});
|
|
78
|
+
const key = yield (0, ssi_sdk_ext_did_utils_1.getFirstKeyWithRelation)({ identifier: didIdentifier, vmRelationship: vmRelationship }, context);
|
|
79
|
+
if (!key) {
|
|
80
|
+
throw new Error(`No key found with the given id: ${identifier}`);
|
|
81
|
+
}
|
|
82
|
+
const alg = this.getKeyTypeAlgorithm(key.type);
|
|
83
|
+
debug(`Signing key ${key.publicKeyHex} found for identifier ${identifier}`);
|
|
84
|
+
return { alg, key };
|
|
80
85
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
else {
|
|
87
|
+
const key = yield context.agent.keyManagerGet({ kid: identifier });
|
|
88
|
+
if (!key) {
|
|
89
|
+
throw new Error(`No key found with the identifier ${identifier}`);
|
|
90
|
+
}
|
|
91
|
+
const alg = this.getKeyTypeAlgorithm(key.type);
|
|
92
|
+
if (((_a = key.meta) === null || _a === void 0 ? void 0 : _a.x509) && key.meta.x509.x5c) {
|
|
93
|
+
return { alg, key: { kid: key.kid, x5c: key.meta.x509.x5c } };
|
|
94
|
+
}
|
|
95
|
+
else if ((_b = key.meta) === null || _b === void 0 ? void 0 : _b.jwkThumbprint) {
|
|
96
|
+
return { alg, key: { kid: key.kid, jwkThumbprint: key.meta.jwkThumbprint } };
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return { alg, key: { kid: key.kid } };
|
|
100
|
+
}
|
|
84
101
|
}
|
|
85
|
-
const alg = this.getKeyTypeAlgorithm(key.type);
|
|
86
|
-
debug(`Signing key ${key.publicKeyHex} found for issuer ${issuer}`);
|
|
87
|
-
return { alg, key };
|
|
88
102
|
});
|
|
89
103
|
}
|
|
90
104
|
/**
|
|
@@ -98,21 +112,19 @@ class SDJwtPlugin {
|
|
|
98
112
|
var _a;
|
|
99
113
|
const cred = yield core_1.SDJwt.fromEncode(args.presentation, this.algorithms.hasher);
|
|
100
114
|
const claims = yield cred.getClaims(this.algorithms.hasher);
|
|
101
|
-
let
|
|
115
|
+
let holder;
|
|
102
116
|
// we primarly look for a cnf field, if it's not there we look for a sub field. If this is also not given, we throw an error since we can not sign it.
|
|
103
117
|
if ((_a = claims.cnf) === null || _a === void 0 ? void 0 : _a.jwk) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
//doesn't apply to did:jwk only, as you can represent any DID key as a JWK. So whenever you encounter a JWK it doesn't mean it had to come from a did:jwk in the system. It just can always be represented as a did:jwk
|
|
107
|
-
holderDID = `did:jwk:${(0, utils_1.encodeJoseBlob)(key)}#0`;
|
|
118
|
+
const jwk = claims.cnf.jwk;
|
|
119
|
+
holder = (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk: jwk });
|
|
108
120
|
}
|
|
109
121
|
else if (claims.sub) {
|
|
110
|
-
|
|
122
|
+
holder = claims.sub;
|
|
111
123
|
}
|
|
112
124
|
else {
|
|
113
125
|
throw new Error('invalid_argument: credential does not include a holder reference');
|
|
114
126
|
}
|
|
115
|
-
const { alg, key } = yield this.getSignKey(
|
|
127
|
+
const { alg, key } = yield this.getSignKey({ identifier: holder, vmRelationship: 'assertionMethod' }, context);
|
|
116
128
|
const signer = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
117
129
|
return context.agent.keyManagerSign({ keyRef: key.kid, data });
|
|
118
130
|
});
|
|
@@ -171,22 +183,38 @@ class SDJwtPlugin {
|
|
|
171
183
|
var _a, _b;
|
|
172
184
|
const decodedVC = yield sdjwt.decode(`${data}.${signature}`);
|
|
173
185
|
const issuer = decodedVC.jwt.payload.iss;
|
|
174
|
-
|
|
175
|
-
|
|
186
|
+
const header = decodedVC.jwt.header;
|
|
187
|
+
const x5c = header === null || header === void 0 ? void 0 : header.x5c;
|
|
188
|
+
let jwk = undefined;
|
|
189
|
+
if (issuer.includes('did:')) {
|
|
190
|
+
const didDoc = yield context.agent.resolveDid({ didUrl: issuer });
|
|
191
|
+
if (!didDoc) {
|
|
192
|
+
throw new Error('invalid_issuer: issuer did not resolve to a did document');
|
|
193
|
+
}
|
|
194
|
+
//TODO SDK-20: This should be checking for an assertionMethod and not just an verificationMethod with an id
|
|
195
|
+
const didDocumentKey = (_b = (_a = didDoc.didDocument) === null || _a === void 0 ? void 0 : _a.verificationMethod) === null || _b === void 0 ? void 0 : _b.find((key) => key.id);
|
|
196
|
+
if (!didDocumentKey) {
|
|
197
|
+
throw new Error('invalid_issuer: issuer did document does not include referenced key');
|
|
198
|
+
}
|
|
199
|
+
//FIXME SDK-21: in case it's another did method, the value of the key can be also encoded as a base64url
|
|
200
|
+
// needs more checks. some DID methods do not expose the keys as publicKeyJwk
|
|
201
|
+
jwk = didDocumentKey.publicKeyJwk;
|
|
176
202
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
203
|
+
if (x5c) {
|
|
204
|
+
const certificateValidationResult = yield context.agent.verifyCertificateChain({
|
|
205
|
+
chain: x5c,
|
|
206
|
+
trustAnchors: [trustAnchors_1.funkeTestCA, trustAnchors_1.sphereonCA],
|
|
207
|
+
});
|
|
208
|
+
if (certificateValidationResult.error || !(certificateValidationResult === null || certificateValidationResult === void 0 ? void 0 : certificateValidationResult.certificateChain)) {
|
|
209
|
+
throw new Error('Certificate chain validation failed');
|
|
210
|
+
}
|
|
211
|
+
const certInfo = certificateValidationResult.certificateChain[0];
|
|
212
|
+
jwk = certInfo.publicKeyJWK;
|
|
180
213
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (!didDocumentKey) {
|
|
184
|
-
throw new Error('invalid_issuer: issuer did document does not include referenced key');
|
|
214
|
+
if (!jwk) {
|
|
215
|
+
throw new Error('No valid public key found for signature verification');
|
|
185
216
|
}
|
|
186
|
-
|
|
187
|
-
//needs more checks. some DID methods do not expose the keys as publicKeyJwk
|
|
188
|
-
const key = didDocumentKey.publicKeyJwk;
|
|
189
|
-
return this.algorithms.verifySignature(data, signature, key);
|
|
217
|
+
return this.algorithms.verifySignature(data, signature, jwk);
|
|
190
218
|
});
|
|
191
219
|
}
|
|
192
220
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-handler.js","sourceRoot":"","sources":["../src/action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;
|
|
1
|
+
{"version":3,"file":"action-handler.js","sourceRoot":"","sources":["../src/action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AAGzB,uCAAyC;AACzC,iDAAmE;AAkBnE,2EAAyE;AACzE,2EAA6E;AAC7E,iDAAwD;AAExD,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,0BAA0B,CAAC,CAAA;AAC/C;;;GAGG;AACH,MAAa,WAAW;IACtB,YAAoB,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;QAEnD,mEAAmE;QAC1D,YAAO,GAAiB;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5C,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC;YAChE,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5C,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC;SACjE,CAAA;IARqD,CAAC;IAUvD;;;;;OAKG;IACG,aAAa,CAAC,IAAwB,EAAE,OAAyB;;YACrE,MAAM,MAAM,GAAG,IAAI,CAAC,iBAA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E,UAAU;aACvB,CAAC,CAAA;YACF,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;YAE/F,OAAO,EAAE,gBAAgB,EAAE,CAAA;QAC7B,CAAC;KAAA;IAEO,mBAAmB,CAAC,OAAe;QACzC,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,SAAS;gBACZ,OAAO,OAAO,CAAA;YAChB,KAAK,WAAW;gBACd,OAAO,QAAQ,CAAA;YACjB,KAAK,WAAW;gBACd,OAAO,OAAO,CAAA;YAChB;gBACE,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAA;QACtD,CAAC;IACH,CAAC;CACF;AAjOD,kCAiOC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -14,12 +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.SDJwtPlugin =
|
|
18
|
-
/**
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
const schema = require('../plugin.schema.json');
|
|
22
|
-
exports.schema = schema;
|
|
17
|
+
exports.SDJwtPlugin = void 0;
|
|
23
18
|
var action_handler_1 = require("./action-handler");
|
|
24
19
|
Object.defineProperty(exports, "SDJwtPlugin", { enumerable: true, get: function () { return action_handler_1.SDJwtPlugin; } });
|
|
25
20
|
__exportStar(require("./types"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAA8C;AAArC,6GAAA,WAAW,OAAA;AACpB,0CAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trustAnchors.d.ts","sourceRoot":"","sources":["../src/trustAnchors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAGK,CAAA;AAE7B,eAAO,MAAM,UAAU,QAaM,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sphereonCA = exports.funkeTestCA = void 0;
|
|
4
|
+
exports.funkeTestCA = '-----BEGIN CERTIFICATE-----\n' +
|
|
5
|
+
'MIICeTCCAiCgAwIBAgIUB5E9QVZtmUYcDtCjKB/H3VQv72gwCgYIKoZIzj0EAwIwgYgxCzAJBgNVBAYTAkRFMQ8wDQYDVQQHDAZCZXJsaW4xHTAbBgNVBAoMFEJ1bmRlc2RydWNrZXJlaSBHbWJIMREwDwYDVQQLDAhUIENTIElERTE2MDQGA1UEAwwtU1BSSU5EIEZ1bmtlIEVVREkgV2FsbGV0IFByb3RvdHlwZSBJc3N1aW5nIENBMB4XDTI0MDUzMTA2NDgwOVoXDTM0MDUyOTA2NDgwOVowgYgxCzAJBgNVBAYTAkRFMQ8wDQYDVQQHDAZCZXJsaW4xHTAbBgNVBAoMFEJ1bmRlc2RydWNrZXJlaSBHbWJIMREwDwYDVQQLDAh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dRSwvlVFdqdiLXnk2pQq\n' +
|
|
15
|
+
'T1vZnDG0I+x+iz2EbdsG0aajUzBRMB0GA1UdDgQWBBTnB8pdlVz5yKD+zuNkRR6A\n' +
|
|
16
|
+
'sywywTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMBAf8E\n' +
|
|
17
|
+
'BTADAQH/MAoGCCqGSM49BAMCA0gAMEUCIHH7ie1OAAbff5262rzZVQa8J9zENG8A\n' +
|
|
18
|
+
'QlHHFydMdgaXAiEA1Ib82mhHIYDziE0DDbHEAXOs98al+7dpo8fPGVGTeKI=\n' +
|
|
19
|
+
'-----END CERTIFICATE-----';
|
|
20
|
+
//# sourceMappingURL=trustAnchors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trustAnchors.js","sourceRoot":"","sources":["../src/trustAnchors.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GACtB,+BAA+B;IAC/B,w1BAAw1B;IACx1B,2BAA2B,CAAA;AAEhB,QAAA,UAAU,GACrB,+BAA+B;IAC/B,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,gEAAgE;IAChE,2BAA2B,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Hasher, KBOptions, SaltGenerator } from '@sd-jwt/types';
|
|
2
|
-
import { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc';
|
|
3
|
-
import { IAgentContext, IDIDManager, IKeyManager, IPluginMethodMap, IResolver } from '@veramo/core';
|
|
2
|
+
import { SdJwtVcPayload as SdJwtPayload } from '@sd-jwt/sd-jwt-vc';
|
|
3
|
+
import { DIDDocumentSection, IAgentContext, IDIDManager, IKeyManager, IPluginMethodMap, IResolver } from '@veramo/core';
|
|
4
|
+
import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
|
|
4
5
|
/**
|
|
5
6
|
* My Agent Plugin description.
|
|
6
7
|
*
|
|
@@ -55,11 +56,15 @@ export interface ISDJwtPlugin extends IPluginMethodMap {
|
|
|
55
56
|
*/
|
|
56
57
|
verifySdJwtPresentation(args: IVerifySdJwtPresentationArgs, context: IRequiredContext): Promise<IVerifySdJwtPresentationResult>;
|
|
57
58
|
}
|
|
59
|
+
export declare function contextHasSDJwtPlugin(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ISDJwtPlugin>;
|
|
58
60
|
/**
|
|
59
61
|
* ICreateSdJwtVcArgs
|
|
60
62
|
*
|
|
61
63
|
* @beta
|
|
62
64
|
*/
|
|
65
|
+
export interface SdJwtVcPayload extends SdJwtPayload {
|
|
66
|
+
x5c?: string[];
|
|
67
|
+
}
|
|
63
68
|
export interface ICreateSdJwtVcArgs {
|
|
64
69
|
credentialPayload: SdJwtVcPayload;
|
|
65
70
|
disclosureFrame?: IDisclosureFrame;
|
|
@@ -140,6 +145,18 @@ export interface IVerifySdJwtPresentationArgs {
|
|
|
140
145
|
export type IVerifySdJwtPresentationResult = {
|
|
141
146
|
verifiedPayloads: Record<string, unknown>;
|
|
142
147
|
};
|
|
148
|
+
export type SignKeyArgs = {
|
|
149
|
+
identifier: string;
|
|
150
|
+
vmRelationship: DIDDocumentSection;
|
|
151
|
+
};
|
|
152
|
+
export type SignKeyResult = {
|
|
153
|
+
alg: string;
|
|
154
|
+
key: {
|
|
155
|
+
kid: string;
|
|
156
|
+
x5c?: string[];
|
|
157
|
+
jwkThumbprint?: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
143
160
|
/**
|
|
144
161
|
* This context describes the requirements of this plugin.
|
|
145
162
|
* For this plugin to function properly, the agent needs to also have other plugins installed that implement the
|
|
@@ -148,7 +165,7 @@ export type IVerifySdJwtPresentationResult = {
|
|
|
148
165
|
*
|
|
149
166
|
* @beta
|
|
150
167
|
*/
|
|
151
|
-
export type IRequiredContext = IAgentContext<IDIDManager & IResolver & IKeyManager>;
|
|
168
|
+
export type IRequiredContext = IAgentContext<IDIDManager & IResolver & IKeyManager & ImDLMdoc>;
|
|
152
169
|
export interface SdJWTImplementation {
|
|
153
170
|
saltGenerator: SaltGenerator;
|
|
154
171
|
hasher: Hasher;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,cAAc,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACvH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAGrD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD;;;;;;;OAOG;IACH;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAEjG;;;;OAIG;IACH,uBAAuB,CAAC,IAAI,EAAE,4BAA4B,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAA;IAE/H;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,E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CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contextHasSDJwtPlugin = void 0;
|
|
4
|
+
const ssi_sdk_agent_config_1 = require("@sphereon/ssi-sdk.agent-config");
|
|
5
|
+
function contextHasSDJwtPlugin(context) {
|
|
6
|
+
return (0, ssi_sdk_agent_config_1.contextHasPlugin)(context, 'verifySdJwtVc');
|
|
7
|
+
}
|
|
8
|
+
exports.contextHasSDJwtPlugin = contextHasSDJwtPlugin;
|
|
3
9
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAIA,yEAAiE;AA4DjE,SAAgB,qBAAqB,CAAC,OAAwC;IAC5E,OAAO,IAAA,uCAAgB,EAAC,OAAO,EAAE,eAAe,CAAC,CAAA;AACnD,CAAC;AAFD,sDAEC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.sd-jwt",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.1-next.103+6c9bb921",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"build:clean": "tsc --build --clean && tsc --build"
|
|
10
|
-
"generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
|
|
9
|
+
"build:clean": "tsc --build --clean && tsc --build"
|
|
11
10
|
},
|
|
12
11
|
"veramo": {
|
|
13
12
|
"pluginInterfaces": {
|
|
@@ -17,7 +16,11 @@
|
|
|
17
16
|
"dependencies": {
|
|
18
17
|
"@sd-jwt/core": "^0.6.1",
|
|
19
18
|
"@sd-jwt/sd-jwt-vc": "^0.6.1",
|
|
20
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.24.
|
|
19
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-next.96",
|
|
20
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.24.1-next.96",
|
|
21
|
+
"@sphereon/ssi-sdk.agent-config": "0.29.1-next.103+6c9bb921",
|
|
22
|
+
"@sphereon/ssi-sdk.mdl-mdoc": "0.29.1-next.103+6c9bb921",
|
|
23
|
+
"@sphereon/ssi-types": "0.29.1-next.103+6c9bb921",
|
|
21
24
|
"@veramo/utils": "4.2.0",
|
|
22
25
|
"debug": "^4.3.5"
|
|
23
26
|
},
|
|
@@ -25,10 +28,10 @@
|
|
|
25
28
|
"@sd-jwt/decode": "^0.6.1",
|
|
26
29
|
"@sd-jwt/types": "^0.6.1",
|
|
27
30
|
"@sd-jwt/utils": "^0.6.1",
|
|
28
|
-
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.24.
|
|
29
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.
|
|
30
|
-
"@sphereon/ssi-sdk-ext.key-manager": "0.24.
|
|
31
|
-
"@sphereon/ssi-sdk-ext.kms-local": "0.24.
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.24.1-next.96",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-next.96",
|
|
33
|
+
"@sphereon/ssi-sdk-ext.key-manager": "0.24.1-next.96",
|
|
34
|
+
"@sphereon/ssi-sdk-ext.kms-local": "0.24.1-next.96",
|
|
32
35
|
"@types/node": "18.15.3",
|
|
33
36
|
"@veramo/core": "4.2.0",
|
|
34
37
|
"@veramo/data-store": "4.2.0",
|
|
@@ -62,5 +65,5 @@
|
|
|
62
65
|
"Selective Disclosure",
|
|
63
66
|
"Verifiable Credential"
|
|
64
67
|
],
|
|
65
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "6c9bb921b256f0a200e49b8977180e7d8ed93bf9"
|
|
66
69
|
}
|
|
@@ -132,7 +132,7 @@ describe('Agent plugin', () => {
|
|
|
132
132
|
iat: new Date().getTime() / 1000,
|
|
133
133
|
vct: '',
|
|
134
134
|
}
|
|
135
|
-
expect(
|
|
135
|
+
await expect(
|
|
136
136
|
agent.createSdJwtVc({
|
|
137
137
|
credentialPayload: credentialPayload as unknown as SdJwtVcPayload,
|
|
138
138
|
disclosureFrame,
|
|
@@ -242,7 +242,7 @@ describe('Agent plugin', () => {
|
|
|
242
242
|
},
|
|
243
243
|
},
|
|
244
244
|
})
|
|
245
|
-
expect(presentation).rejects.toThrow('credential does not include a holder reference')
|
|
245
|
+
await expect(presentation).rejects.toThrow('credential does not include a holder reference')
|
|
246
246
|
})
|
|
247
247
|
|
|
248
248
|
it('verify a presentation', async () => {
|
package/src/action-handler.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Debug from 'debug'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { SignKeyArgs, SignKeyResult } from './index'
|
|
4
4
|
import { Jwt, SDJwt } from '@sd-jwt/core'
|
|
5
5
|
import { SDJwtVcInstance, SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc'
|
|
6
6
|
import { Signer, Verifier, KbVerifier, JwtPayload, DisclosureFrame, PresentationFrame } from '@sd-jwt/types'
|
|
@@ -19,16 +19,17 @@ import {
|
|
|
19
19
|
IVerifySdJwtPresentationResult,
|
|
20
20
|
Claims,
|
|
21
21
|
} from './types'
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
22
|
+
import { _ExtendedIKey } from '@veramo/utils'
|
|
23
|
+
import { getFirstKeyWithRelation } from '@sphereon/ssi-sdk-ext.did-utils'
|
|
24
|
+
import { calculateJwkThumbprint, JWK } from '@sphereon/ssi-sdk-ext.key-utils'
|
|
25
|
+
import { funkeTestCA, sphereonCA } from './trustAnchors'
|
|
26
|
+
|
|
27
|
+
const debug = Debug('@sphereon/ssi-sdk.sd-jwt')
|
|
25
28
|
/**
|
|
26
29
|
* @beta
|
|
27
30
|
* SD-JWT plugin for Veramo
|
|
28
31
|
*/
|
|
29
32
|
export class SDJwtPlugin implements IAgentPlugin {
|
|
30
|
-
readonly schema = schema.ISDJwtPlugin
|
|
31
|
-
|
|
32
33
|
constructor(private algorithms: SdJWTImplementation) {}
|
|
33
34
|
|
|
34
35
|
// map the methods your plugin is declaring to their implementation
|
|
@@ -51,7 +52,7 @@ export class SDJwtPlugin implements IAgentPlugin {
|
|
|
51
52
|
throw new Error('credential.issuer must not be empty')
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
const { alg, key } = await this.getSignKey(issuer, context)
|
|
55
|
+
const { alg, key } = await this.getSignKey({ identifier: issuer, vmRelationship: 'assertionMethod' }, context)
|
|
55
56
|
|
|
56
57
|
//TODO: let the user also insert a method to sign the data
|
|
57
58
|
const signer: Signer = async (data: string) => context.agent.keyManagerSign({ keyRef: key.kid, data })
|
|
@@ -70,27 +71,37 @@ export class SDJwtPlugin implements IAgentPlugin {
|
|
|
70
71
|
|
|
71
72
|
/**
|
|
72
73
|
* Get the key to sign the SD-JWT
|
|
73
|
-
* @param
|
|
74
|
+
* @param args - consists of twp arguments: identifier like a did and other forms of identifiers and vmRelationship which represents the purpose of the key
|
|
74
75
|
* @param context - agent instance
|
|
75
76
|
* @returns the key to sign the SD-JWT
|
|
76
77
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
async getSignKey(args: SignKeyArgs, context: IRequiredContext): Promise<SignKeyResult> {
|
|
79
|
+
const { identifier, vmRelationship } = { ...args }
|
|
80
|
+
if (identifier.startsWith('did:')) {
|
|
81
|
+
const didIdentifier = await context.agent.didManagerGet({
|
|
82
|
+
did: identifier.split('#')[0],
|
|
83
|
+
})
|
|
84
|
+
const key: _ExtendedIKey | undefined = await getFirstKeyWithRelation({ identifier: didIdentifier, vmRelationship: vmRelationship }, context)
|
|
85
|
+
if (!key) {
|
|
86
|
+
throw new Error(`No key found with the given id: ${identifier}`)
|
|
87
|
+
}
|
|
88
|
+
const alg = this.getKeyTypeAlgorithm(key.type)
|
|
89
|
+
debug(`Signing key ${key.publicKeyHex} found for identifier ${identifier}`)
|
|
90
|
+
return { alg, key }
|
|
91
|
+
} else {
|
|
92
|
+
const key = await context.agent.keyManagerGet({ kid: identifier })
|
|
93
|
+
if (!key) {
|
|
94
|
+
throw new Error(`No key found with the identifier ${identifier}`)
|
|
95
|
+
}
|
|
96
|
+
const alg = this.getKeyTypeAlgorithm(key.type)
|
|
97
|
+
if (key.meta?.x509 && key.meta.x509.x5c) {
|
|
98
|
+
return { alg, key: { kid: key.kid, x5c: key.meta.x509.x5c as string[] } }
|
|
99
|
+
} else if (key.meta?.jwkThumbprint) {
|
|
100
|
+
return { alg, key: { kid: key.kid, jwkThumbprint: key.meta.jwkThumbprint } }
|
|
101
|
+
} else {
|
|
102
|
+
return { alg, key: { kid: key.kid } }
|
|
103
|
+
}
|
|
89
104
|
}
|
|
90
|
-
const alg = this.getKeyTypeAlgorithm(key.type)
|
|
91
|
-
debug(`Signing key ${key.publicKeyHex} found for issuer ${issuer}`)
|
|
92
|
-
|
|
93
|
-
return { alg, key }
|
|
94
105
|
}
|
|
95
106
|
|
|
96
107
|
/**
|
|
@@ -102,19 +113,17 @@ export class SDJwtPlugin implements IAgentPlugin {
|
|
|
102
113
|
async createSdJwtPresentation(args: ICreateSdJwtPresentationArgs, context: IRequiredContext): Promise<ICreateSdJwtPresentationResult> {
|
|
103
114
|
const cred = await SDJwt.fromEncode(args.presentation, this.algorithms.hasher)
|
|
104
115
|
const claims = await cred.getClaims<Claims>(this.algorithms.hasher)
|
|
105
|
-
let
|
|
116
|
+
let holder: string
|
|
106
117
|
// we primarly look for a cnf field, if it's not there we look for a sub field. If this is also not given, we throw an error since we can not sign it.
|
|
107
118
|
if (claims.cnf?.jwk) {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
//doesn't apply to did:jwk only, as you can represent any DID key as a JWK. So whenever you encounter a JWK it doesn't mean it had to come from a did:jwk in the system. It just can always be represented as a did:jwk
|
|
111
|
-
holderDID = `did:jwk:${encodeJoseBlob(key)}#0`
|
|
119
|
+
const jwk = claims.cnf.jwk
|
|
120
|
+
holder = calculateJwkThumbprint({ jwk: jwk as JWK })
|
|
112
121
|
} else if (claims.sub) {
|
|
113
|
-
|
|
122
|
+
holder = claims.sub as string
|
|
114
123
|
} else {
|
|
115
124
|
throw new Error('invalid_argument: credential does not include a holder reference')
|
|
116
125
|
}
|
|
117
|
-
const { alg, key } = await this.getSignKey(
|
|
126
|
+
const { alg, key } = await this.getSignKey({ identifier: holder, vmRelationship: 'assertionMethod' }, context)
|
|
118
127
|
|
|
119
128
|
const signer: Signer = async (data: string) => {
|
|
120
129
|
return context.agent.keyManagerSign({ keyRef: key.kid, data })
|
|
@@ -175,22 +184,40 @@ export class SDJwtPlugin implements IAgentPlugin {
|
|
|
175
184
|
async verify(sdjwt: SDJwtVcInstance, context: IRequiredContext, data: string, signature: string) {
|
|
176
185
|
const decodedVC = await sdjwt.decode(`${data}.${signature}`)
|
|
177
186
|
const issuer: string = ((decodedVC.jwt as Jwt).payload as Record<string, unknown>).iss as string
|
|
178
|
-
|
|
179
|
-
|
|
187
|
+
const header = (decodedVC.jwt as Jwt).header as Record<string, any>
|
|
188
|
+
const x5c: string[] | undefined = header?.x5c as string[]
|
|
189
|
+
let jwk: JWK | JsonWebKey | undefined = undefined
|
|
190
|
+
if (issuer.includes('did:')) {
|
|
191
|
+
const didDoc = await context.agent.resolveDid({ didUrl: issuer })
|
|
192
|
+
if (!didDoc) {
|
|
193
|
+
throw new Error('invalid_issuer: issuer did not resolve to a did document')
|
|
194
|
+
}
|
|
195
|
+
//TODO SDK-20: This should be checking for an assertionMethod and not just an verificationMethod with an id
|
|
196
|
+
const didDocumentKey = didDoc.didDocument?.verificationMethod?.find((key) => key.id)
|
|
197
|
+
if (!didDocumentKey) {
|
|
198
|
+
throw new Error('invalid_issuer: issuer did document does not include referenced key')
|
|
199
|
+
}
|
|
200
|
+
//FIXME SDK-21: in case it's another did method, the value of the key can be also encoded as a base64url
|
|
201
|
+
// needs more checks. some DID methods do not expose the keys as publicKeyJwk
|
|
202
|
+
jwk = didDocumentKey.publicKeyJwk as JsonWebKey
|
|
180
203
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
204
|
+
if (x5c) {
|
|
205
|
+
const certificateValidationResult = await context.agent.verifyCertificateChain({
|
|
206
|
+
chain: x5c,
|
|
207
|
+
trustAnchors: [funkeTestCA, sphereonCA],
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
if (certificateValidationResult.error || !certificateValidationResult?.certificateChain) {
|
|
211
|
+
throw new Error('Certificate chain validation failed')
|
|
212
|
+
}
|
|
213
|
+
const certInfo = certificateValidationResult.certificateChain[0]
|
|
214
|
+
jwk = certInfo.publicKeyJWK as JWK
|
|
184
215
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
throw new Error('invalid_issuer: issuer did document does not include referenced key')
|
|
216
|
+
|
|
217
|
+
if (!jwk) {
|
|
218
|
+
throw new Error('No valid public key found for signature verification')
|
|
189
219
|
}
|
|
190
|
-
|
|
191
|
-
//needs more checks. some DID methods do not expose the keys as publicKeyJwk
|
|
192
|
-
const key = didDocumentKey.publicKeyJwk as JsonWebKey
|
|
193
|
-
return this.algorithms.verifySignature(data, signature, key)
|
|
220
|
+
return this.algorithms.verifySignature(data, signature, jwk)
|
|
194
221
|
}
|
|
195
222
|
|
|
196
223
|
/**
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
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obHhxG9iSydTAKBggqhkjOPQQDAjBa\n' +
|
|
9
|
+
'MQswCQYDVQQGEwJOTDEkMCIGA1UECgwbU3BoZXJlb24gSW50ZXJuYXRpb25hbCBC\n' +
|
|
10
|
+
'LlYuMQswCQYDVQQLDAJJVDEYMBYGA1UEAwwPY2Euc3BoZXJlb24uY29tMB4XDTI0\n' +
|
|
11
|
+
'MDcyODIxMjY0OVoXDTM0MDcyODIxMjY0OVowWjELMAkGA1UEBhMCTkwxJDAiBgNV\n' +
|
|
12
|
+
'BAoMG1NwaGVyZW9uIEludGVybmF0aW9uYWwgQi5WLjELMAkGA1UECwwCSVQxGDAW\n' +
|
|
13
|
+
'BgNVBAMMD2NhLnNwaGVyZW9uLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA\n' +
|
|
14
|
+
'BEiA0KeESSNrOcmCDga8YsBkUTgowZGwqvL2n91JUpAMdRSwvlVFdqdiLXnk2pQq\n' +
|
|
15
|
+
'T1vZnDG0I+x+iz2EbdsG0aajUzBRMB0GA1UdDgQWBBTnB8pdlVz5yKD+zuNkRR6A\n' +
|
|
16
|
+
'sywywTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMBAf8E\n' +
|
|
17
|
+
'BTADAQH/MAoGCCqGSM49BAMCA0gAMEUCIHH7ie1OAAbff5262rzZVQa8J9zENG8A\n' +
|
|
18
|
+
'QlHHFydMdgaXAiEA1Ib82mhHIYDziE0DDbHEAXOs98al+7dpo8fPGVGTeKI=\n' +
|
|
19
|
+
'-----END CERTIFICATE-----'
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Hasher, KBOptions, SaltGenerator } from '@sd-jwt/types'
|
|
2
|
-
import { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc'
|
|
3
|
-
import { IAgentContext, IDIDManager, IKeyManager, IPluginMethodMap, IResolver } from '@veramo/core'
|
|
2
|
+
import { SdJwtVcPayload as SdJwtPayload } from '@sd-jwt/sd-jwt-vc'
|
|
3
|
+
import { DIDDocumentSection, IAgentContext, IDIDManager, IKeyManager, IPluginMethodMap, IResolver } from '@veramo/core'
|
|
4
|
+
import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc'
|
|
5
|
+
import { contextHasPlugin } from '@sphereon/ssi-sdk.agent-config'
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* My Agent Plugin description.
|
|
@@ -60,11 +62,20 @@ export interface ISDJwtPlugin extends IPluginMethodMap {
|
|
|
60
62
|
verifySdJwtPresentation(args: IVerifySdJwtPresentationArgs, context: IRequiredContext): Promise<IVerifySdJwtPresentationResult>
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
export function contextHasSDJwtPlugin(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ISDJwtPlugin> {
|
|
66
|
+
return contextHasPlugin(context, 'verifySdJwtVc')
|
|
67
|
+
}
|
|
68
|
+
|
|
63
69
|
/**
|
|
64
70
|
* ICreateSdJwtVcArgs
|
|
65
71
|
*
|
|
66
72
|
* @beta
|
|
67
73
|
*/
|
|
74
|
+
|
|
75
|
+
export interface SdJwtVcPayload extends SdJwtPayload {
|
|
76
|
+
x5c?: string[]
|
|
77
|
+
}
|
|
78
|
+
|
|
68
79
|
export interface ICreateSdJwtVcArgs {
|
|
69
80
|
credentialPayload: SdJwtVcPayload
|
|
70
81
|
|
|
@@ -78,6 +89,7 @@ export interface ICreateSdJwtVcArgs {
|
|
|
78
89
|
export interface IDisclosureFrame {
|
|
79
90
|
_sd?: string[]
|
|
80
91
|
_sd_decoy?: number
|
|
92
|
+
|
|
81
93
|
[x: string]: string[] | number | IDisclosureFrame | undefined
|
|
82
94
|
}
|
|
83
95
|
|
|
@@ -166,6 +178,19 @@ export type IVerifySdJwtPresentationResult = {
|
|
|
166
178
|
verifiedPayloads: Record<string, unknown>
|
|
167
179
|
}
|
|
168
180
|
|
|
181
|
+
export type SignKeyArgs = {
|
|
182
|
+
identifier: string
|
|
183
|
+
vmRelationship: DIDDocumentSection
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type SignKeyResult = {
|
|
187
|
+
alg: string
|
|
188
|
+
key: {
|
|
189
|
+
kid: string
|
|
190
|
+
x5c?: string[]
|
|
191
|
+
jwkThumbprint?: string
|
|
192
|
+
}
|
|
193
|
+
}
|
|
169
194
|
/**
|
|
170
195
|
* This context describes the requirements of this plugin.
|
|
171
196
|
* For this plugin to function properly, the agent needs to also have other plugins installed that implement the
|
|
@@ -174,7 +199,8 @@ export type IVerifySdJwtPresentationResult = {
|
|
|
174
199
|
*
|
|
175
200
|
* @beta
|
|
176
201
|
*/
|
|
177
|
-
export type IRequiredContext = IAgentContext<IDIDManager & IResolver & IKeyManager>
|
|
202
|
+
export type IRequiredContext = IAgentContext<IDIDManager & IResolver & IKeyManager & ImDLMdoc>
|
|
203
|
+
|
|
178
204
|
export interface SdJWTImplementation {
|
|
179
205
|
saltGenerator: SaltGenerator
|
|
180
206
|
hasher: Hasher
|
|
@@ -189,5 +215,6 @@ export interface Claims {
|
|
|
189
215
|
cnf?: {
|
|
190
216
|
jwk: JsonWebKey
|
|
191
217
|
}
|
|
218
|
+
|
|
192
219
|
[key: string]: unknown
|
|
193
220
|
}
|
package/dist/ssi-sdk.sd-jwt.d.ts
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { Hasher } from '@sd-jwt/types';
|
|
2
|
-
import { IAgentContext } from '@veramo/core';
|
|
3
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
4
|
-
import { IDIDManager } from '@veramo/core';
|
|
5
|
-
import { IKeyManager } from '@veramo/core';
|
|
6
|
-
import { IPluginMethodMap } from '@veramo/core';
|
|
7
|
-
import { IResolver } from '@veramo/core';
|
|
8
|
-
import { KBOptions } from '@sd-jwt/types';
|
|
9
|
-
import { SaltGenerator } from '@sd-jwt/types';
|
|
10
|
-
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
|
|
11
|
-
import { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc';
|
|
12
|
-
|
|
13
|
-
export declare interface Claims {
|
|
14
|
-
/**
|
|
15
|
-
* Subject of the SD-JWT
|
|
16
|
-
*/
|
|
17
|
-
sub?: string;
|
|
18
|
-
cnf?: {
|
|
19
|
-
jwk: JsonWebKey;
|
|
20
|
-
};
|
|
21
|
-
[key: string]: unknown;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @beta
|
|
27
|
-
*/
|
|
28
|
-
export declare interface ICreateSdJwtPresentationArgs {
|
|
29
|
-
/**
|
|
30
|
-
* Encoded SD-JWT credential
|
|
31
|
-
*/
|
|
32
|
-
presentation: string;
|
|
33
|
-
presentationFrame?: IPresentationFrame;
|
|
34
|
-
/**
|
|
35
|
-
* Information to include to add key binding.
|
|
36
|
-
*/
|
|
37
|
-
kb?: KBOptions;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Created presentation
|
|
42
|
-
* @beta
|
|
43
|
-
*/
|
|
44
|
-
export declare interface ICreateSdJwtPresentationResult {
|
|
45
|
-
/**
|
|
46
|
-
* Encoded presentation.
|
|
47
|
-
*/
|
|
48
|
-
presentation: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* ICreateSdJwtVcArgs
|
|
53
|
-
*
|
|
54
|
-
* @beta
|
|
55
|
-
*/
|
|
56
|
-
export declare interface ICreateSdJwtVcArgs {
|
|
57
|
-
credentialPayload: SdJwtVcPayload;
|
|
58
|
-
disclosureFrame?: IDisclosureFrame;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* ICreateSdJwtVcResult
|
|
63
|
-
*
|
|
64
|
-
* @beta
|
|
65
|
-
*/
|
|
66
|
-
export declare interface ICreateSdJwtVcResult {
|
|
67
|
-
/**
|
|
68
|
-
* the encoded sd-jwt credential
|
|
69
|
-
*/
|
|
70
|
-
credential: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @beta
|
|
75
|
-
*/
|
|
76
|
-
export declare interface IDisclosureFrame {
|
|
77
|
-
_sd?: string[];
|
|
78
|
-
_sd_decoy?: number;
|
|
79
|
-
[x: string]: string[] | number | IDisclosureFrame | undefined;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @beta
|
|
84
|
-
*/
|
|
85
|
-
export declare interface IPresentationFrame {
|
|
86
|
-
[x: string]: boolean | IPresentationFrame;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* This context describes the requirements of this plugin.
|
|
91
|
-
* For this plugin to function properly, the agent needs to also have other plugins installed that implement the
|
|
92
|
-
* interfaces declared here.
|
|
93
|
-
* You can also define requirements on a more granular level, for each plugin method or event handler of your plugin.
|
|
94
|
-
*
|
|
95
|
-
* @beta
|
|
96
|
-
*/
|
|
97
|
-
export declare type IRequiredContext = IAgentContext<IDIDManager & IResolver & IKeyManager>;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* My Agent Plugin description.
|
|
101
|
-
*
|
|
102
|
-
* This is the interface that describes what your plugin can do.
|
|
103
|
-
* The methods listed here, will be directly available to the veramo agent where your plugin is going to be used.
|
|
104
|
-
* Depending on the agent configuration, other agent plugins, as well as the application where the agent is used
|
|
105
|
-
* will be able to call these methods.
|
|
106
|
-
*
|
|
107
|
-
* To build a schema for your plugin using standard tools, you must link to this file in your package.json.
|
|
108
|
-
* Example:
|
|
109
|
-
* ```
|
|
110
|
-
* "veramo": {
|
|
111
|
-
* "pluginInterfaces": {
|
|
112
|
-
* "IMyAgentPlugin": "./src/types/IMyAgentPlugin.ts"
|
|
113
|
-
* }
|
|
114
|
-
* },
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
|
-
* @beta
|
|
118
|
-
*/
|
|
119
|
-
export declare interface ISDJwtPlugin extends IPluginMethodMap {
|
|
120
|
-
/**
|
|
121
|
-
* Your plugin method description
|
|
122
|
-
*
|
|
123
|
-
* @param args - Input parameters for this method
|
|
124
|
-
* @param context - The required context where this method can run.
|
|
125
|
-
* Declaring a context type here lets other developers know which other plugins
|
|
126
|
-
* need to also be installed for this method to work.
|
|
127
|
-
*/
|
|
128
|
-
/**
|
|
129
|
-
* Create a signed SD-JWT credential.
|
|
130
|
-
* @param args - Arguments necessary for the creation of a SD-JWT credential.
|
|
131
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
132
|
-
*/
|
|
133
|
-
createSdJwtVc(args: ICreateSdJwtVcArgs, context: IRequiredContext): Promise<ICreateSdJwtVcResult>;
|
|
134
|
-
/**
|
|
135
|
-
* Create a signed SD-JWT presentation.
|
|
136
|
-
* @param args - Arguments necessary for the creation of a SD-JWT presentation.
|
|
137
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
138
|
-
*/
|
|
139
|
-
createSdJwtPresentation(args: ICreateSdJwtPresentationArgs, context: IRequiredContext): Promise<ICreateSdJwtPresentationResult>;
|
|
140
|
-
/**
|
|
141
|
-
* Verify a signed SD-JWT credential.
|
|
142
|
-
* @param args - Arguments necessary for the verification of a SD-JWT credential.
|
|
143
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
144
|
-
*/
|
|
145
|
-
verifySdJwtVc(args: IVerifySdJwtVcArgs, context: IRequiredContext): Promise<IVerifySdJwtVcResult>;
|
|
146
|
-
/**
|
|
147
|
-
* Verify a signed SD-JWT presentation.
|
|
148
|
-
* @param args - Arguments necessary for the verification of a SD-JWT presentation.
|
|
149
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
150
|
-
*/
|
|
151
|
-
verifySdJwtPresentation(args: IVerifySdJwtPresentationArgs, context: IRequiredContext): Promise<IVerifySdJwtPresentationResult>;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @beta
|
|
156
|
-
*/
|
|
157
|
-
export declare interface IVerifySdJwtPresentationArgs {
|
|
158
|
-
presentation: string;
|
|
159
|
-
requiredClaimKeys?: string[];
|
|
160
|
-
kb?: boolean;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* @beta
|
|
165
|
-
*/
|
|
166
|
-
export declare type IVerifySdJwtPresentationResult = {
|
|
167
|
-
verifiedPayloads: Record<string, unknown>;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @beta
|
|
172
|
-
*/
|
|
173
|
-
export declare interface IVerifySdJwtVcArgs {
|
|
174
|
-
credential: string;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* @beta
|
|
179
|
-
*/
|
|
180
|
-
export declare type IVerifySdJwtVcResult = {
|
|
181
|
-
verifiedPayloads: unknown;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* @public
|
|
186
|
-
*/
|
|
187
|
-
export declare const schema: any;
|
|
188
|
-
|
|
189
|
-
export declare interface SdJWTImplementation {
|
|
190
|
-
saltGenerator: SaltGenerator;
|
|
191
|
-
hasher: Hasher;
|
|
192
|
-
verifySignature: (data: string, signature: string, publicKey: JsonWebKey) => Promise<boolean>;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* @beta
|
|
197
|
-
* SD-JWT plugin for Veramo
|
|
198
|
-
*/
|
|
199
|
-
export declare class SDJwtPlugin implements IAgentPlugin {
|
|
200
|
-
private algorithms;
|
|
201
|
-
readonly schema: any;
|
|
202
|
-
constructor(algorithms: SdJWTImplementation);
|
|
203
|
-
readonly methods: ISDJwtPlugin;
|
|
204
|
-
/**
|
|
205
|
-
* Create a signed SD-JWT credential.
|
|
206
|
-
* @param args - Arguments necessary for the creation of a SD-JWT credential.
|
|
207
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
208
|
-
* @returns A signed SD-JWT credential.
|
|
209
|
-
*/
|
|
210
|
-
createSdJwtVc(args: ICreateSdJwtVcArgs, context: IRequiredContext): Promise<ICreateSdJwtVcResult>;
|
|
211
|
-
/**
|
|
212
|
-
* Get the key to sign the SD-JWT
|
|
213
|
-
* @param issuer - did url like did:exmaple.com#key-1
|
|
214
|
-
* @param context - agent instance
|
|
215
|
-
* @returns the key to sign the SD-JWT
|
|
216
|
-
*/
|
|
217
|
-
private getSignKey;
|
|
218
|
-
/**
|
|
219
|
-
* Create a signed SD-JWT presentation.
|
|
220
|
-
* @param args - Arguments necessary for the creation of a SD-JWT presentation.
|
|
221
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
222
|
-
* @returns A signed SD-JWT presentation.
|
|
223
|
-
*/
|
|
224
|
-
createSdJwtPresentation(args: ICreateSdJwtPresentationArgs, context: IRequiredContext): Promise<ICreateSdJwtPresentationResult>;
|
|
225
|
-
/**
|
|
226
|
-
* Verify a signed SD-JWT credential.
|
|
227
|
-
* @param args - Arguments necessary for the verify a SD-JWT credential.
|
|
228
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
229
|
-
* @returns
|
|
230
|
-
*/
|
|
231
|
-
verifySdJwtVc(args: IVerifySdJwtVcArgs, context: IRequiredContext): Promise<IVerifySdJwtVcResult>;
|
|
232
|
-
/**
|
|
233
|
-
* Verify the key binding of a SD-JWT by validating the signature of the key bound to the SD-JWT
|
|
234
|
-
* @param sdjwt - SD-JWT instance
|
|
235
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
236
|
-
* @param data - signed data
|
|
237
|
-
* @param signature - The signature
|
|
238
|
-
* @param payload - The payload of the SD-JWT
|
|
239
|
-
* @returns
|
|
240
|
-
*/
|
|
241
|
-
private verifyKb;
|
|
242
|
-
/**
|
|
243
|
-
* Validates the signature of a SD-JWT
|
|
244
|
-
* @param sdjwt - SD-JWT instance
|
|
245
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
246
|
-
* @param data - signed data
|
|
247
|
-
* @param signature - The signature
|
|
248
|
-
* @returns
|
|
249
|
-
*/
|
|
250
|
-
verify(sdjwt: SDJwtVcInstance, context: IRequiredContext, data: string, signature: string): Promise<boolean>;
|
|
251
|
-
/**
|
|
252
|
-
* Verify a signed SD-JWT presentation.
|
|
253
|
-
* @param args - Arguments necessary for the verify a SD-JWT presentation.
|
|
254
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
255
|
-
* @returns
|
|
256
|
-
*/
|
|
257
|
-
verifySdJwtPresentation(args: IVerifySdJwtPresentationArgs, context: IRequiredContext): Promise<IVerifySdJwtPresentationResult>;
|
|
258
|
-
private getKeyTypeAlgorithm;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export { }
|
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.47.2"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
package/plugin.schema.json
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ISDJwtPlugin": {
|
|
3
|
-
"components": {
|
|
4
|
-
"schemas": {
|
|
5
|
-
"ICreateSdJwtPresentationArgs": {
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"presentation": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "Encoded SD-JWT credential"
|
|
11
|
-
},
|
|
12
|
-
"presentationFrame": {
|
|
13
|
-
"$ref": "#/components/schemas/IPresentationFrame"
|
|
14
|
-
},
|
|
15
|
-
"kb": {
|
|
16
|
-
"type": "object",
|
|
17
|
-
"properties": {
|
|
18
|
-
"payload": {
|
|
19
|
-
"type": "object",
|
|
20
|
-
"properties": {
|
|
21
|
-
"iat": {
|
|
22
|
-
"type": "number"
|
|
23
|
-
},
|
|
24
|
-
"aud": {
|
|
25
|
-
"type": "string"
|
|
26
|
-
},
|
|
27
|
-
"nonce": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"required": [
|
|
32
|
-
"iat",
|
|
33
|
-
"aud",
|
|
34
|
-
"nonce"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"required": [
|
|
39
|
-
"payload"
|
|
40
|
-
],
|
|
41
|
-
"description": "Information to include to add key binding."
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"required": [
|
|
45
|
-
"presentation"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"IPresentationFrame": {
|
|
49
|
-
"type": "object",
|
|
50
|
-
"additionalProperties": {
|
|
51
|
-
"anyOf": [
|
|
52
|
-
{
|
|
53
|
-
"type": "boolean"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"$ref": "#/components/schemas/IPresentationFrame"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"ICreateSdJwtPresentationResult": {
|
|
62
|
-
"type": "object",
|
|
63
|
-
"properties": {
|
|
64
|
-
"presentation": {
|
|
65
|
-
"type": "string",
|
|
66
|
-
"description": "Encoded presentation."
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"required": [
|
|
70
|
-
"presentation"
|
|
71
|
-
],
|
|
72
|
-
"description": "Created presentation"
|
|
73
|
-
},
|
|
74
|
-
"ICreateSdJwtVcArgs": {
|
|
75
|
-
"type": "object",
|
|
76
|
-
"properties": {
|
|
77
|
-
"credentialPayload": {
|
|
78
|
-
"type": "object",
|
|
79
|
-
"properties": {
|
|
80
|
-
"iss": {
|
|
81
|
-
"type": "string"
|
|
82
|
-
},
|
|
83
|
-
"nbf": {
|
|
84
|
-
"type": "number"
|
|
85
|
-
},
|
|
86
|
-
"exp": {
|
|
87
|
-
"type": "number"
|
|
88
|
-
},
|
|
89
|
-
"cnf": {},
|
|
90
|
-
"vct": {
|
|
91
|
-
"type": "string"
|
|
92
|
-
},
|
|
93
|
-
"status": {},
|
|
94
|
-
"sub": {
|
|
95
|
-
"type": "string"
|
|
96
|
-
},
|
|
97
|
-
"iat": {
|
|
98
|
-
"type": "number"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"required": [
|
|
102
|
-
"iss",
|
|
103
|
-
"vct"
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
"disclosureFrame": {
|
|
107
|
-
"$ref": "#/components/schemas/IDisclosureFrame"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
"required": [
|
|
111
|
-
"credentialPayload"
|
|
112
|
-
],
|
|
113
|
-
"description": "ICreateSdJwtVcArgs"
|
|
114
|
-
},
|
|
115
|
-
"IDisclosureFrame": {
|
|
116
|
-
"type": "object",
|
|
117
|
-
"properties": {
|
|
118
|
-
"_sd": {
|
|
119
|
-
"type": "array",
|
|
120
|
-
"items": {
|
|
121
|
-
"type": "string"
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
"_sd_decoy": {
|
|
125
|
-
"type": "number"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"additionalProperties": {
|
|
129
|
-
"anyOf": [
|
|
130
|
-
{
|
|
131
|
-
"type": "array",
|
|
132
|
-
"items": {
|
|
133
|
-
"type": "string"
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"type": "number"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"$ref": "#/components/schemas/IDisclosureFrame"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"not": {}
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
"ICreateSdJwtVcResult": {
|
|
149
|
-
"type": "object",
|
|
150
|
-
"properties": {
|
|
151
|
-
"credential": {
|
|
152
|
-
"type": "string",
|
|
153
|
-
"description": "the encoded sd-jwt credential"
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
"required": [
|
|
157
|
-
"credential"
|
|
158
|
-
],
|
|
159
|
-
"description": "ICreateSdJwtVcResult"
|
|
160
|
-
},
|
|
161
|
-
"IVerifySdJwtPresentationArgs": {
|
|
162
|
-
"type": "object",
|
|
163
|
-
"properties": {
|
|
164
|
-
"presentation": {
|
|
165
|
-
"type": "string"
|
|
166
|
-
},
|
|
167
|
-
"requiredClaimKeys": {
|
|
168
|
-
"type": "array",
|
|
169
|
-
"items": {
|
|
170
|
-
"type": "string"
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
"kb": {
|
|
174
|
-
"type": "boolean"
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
"required": [
|
|
178
|
-
"presentation"
|
|
179
|
-
]
|
|
180
|
-
},
|
|
181
|
-
"IVerifySdJwtPresentationResult": {
|
|
182
|
-
"type": "object",
|
|
183
|
-
"properties": {
|
|
184
|
-
"verifiedPayloads": {
|
|
185
|
-
"type": "object",
|
|
186
|
-
"additionalProperties": {}
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"required": [
|
|
190
|
-
"verifiedPayloads"
|
|
191
|
-
]
|
|
192
|
-
},
|
|
193
|
-
"IVerifySdJwtVcArgs": {
|
|
194
|
-
"type": "object",
|
|
195
|
-
"properties": {
|
|
196
|
-
"credential": {
|
|
197
|
-
"type": "string"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
"required": [
|
|
201
|
-
"credential"
|
|
202
|
-
]
|
|
203
|
-
},
|
|
204
|
-
"IVerifySdJwtVcResult": {
|
|
205
|
-
"type": "object",
|
|
206
|
-
"properties": {
|
|
207
|
-
"verifiedPayloads": {}
|
|
208
|
-
},
|
|
209
|
-
"required": [
|
|
210
|
-
"verifiedPayloads"
|
|
211
|
-
]
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
"methods": {
|
|
215
|
-
"createSdJwtPresentation": {
|
|
216
|
-
"description": "Create a signed SD-JWT presentation.",
|
|
217
|
-
"arguments": {
|
|
218
|
-
"$ref": "#/components/schemas/ICreateSdJwtPresentationArgs"
|
|
219
|
-
},
|
|
220
|
-
"returnType": {
|
|
221
|
-
"$ref": "#/components/schemas/ICreateSdJwtPresentationResult"
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"createSdJwtVc": {
|
|
225
|
-
"description": "Create a signed SD-JWT credential.",
|
|
226
|
-
"arguments": {
|
|
227
|
-
"$ref": "#/components/schemas/ICreateSdJwtVcArgs"
|
|
228
|
-
},
|
|
229
|
-
"returnType": {
|
|
230
|
-
"$ref": "#/components/schemas/ICreateSdJwtVcResult"
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
"verifySdJwtPresentation": {
|
|
234
|
-
"description": "Verify a signed SD-JWT presentation.",
|
|
235
|
-
"arguments": {
|
|
236
|
-
"$ref": "#/components/schemas/IVerifySdJwtPresentationArgs"
|
|
237
|
-
},
|
|
238
|
-
"returnType": {
|
|
239
|
-
"$ref": "#/components/schemas/IVerifySdJwtPresentationResult"
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
"verifySdJwtVc": {
|
|
243
|
-
"description": "Verify a signed SD-JWT credential.",
|
|
244
|
-
"arguments": {
|
|
245
|
-
"$ref": "#/components/schemas/IVerifySdJwtVcArgs"
|
|
246
|
-
},
|
|
247
|
-
"returnType": {
|
|
248
|
-
"$ref": "#/components/schemas/IVerifySdJwtVcResult"
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|