@sphereon/ssi-sdk.credential-validation 0.30.2-unstable.9 → 0.31.0
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/README.md
CHANGED
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
A Veramo contact manager plugin. This plugin has utility functions for validating Verifiable Credentials.
|
|
16
16
|
|
|
17
|
+
## Available functions
|
|
18
|
+
|
|
19
|
+
- cvVerifyCredential
|
|
20
|
+
- cvVerifySchema
|
|
21
|
+
- cvVerifyMdoc
|
|
22
|
+
- cvVerifySDJWTCredential
|
|
23
|
+
- cvVerifyW3CCredential
|
|
24
|
+
|
|
17
25
|
## Installation
|
|
18
26
|
|
|
19
27
|
```shell
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialValidation.d.ts","sourceRoot":"","sources":["../../src/agent/CredentialValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmF,MAAM,cAAc,CAAA;AAC5H,OAAO,EAEL,qBAAqB,EAUtB,MAAM,UAAU,CAAA;AAmBjB,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,MAAM,CAMrD,CAAA;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,QAAQ,CAAC,MAAM,MAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAMtC;IAED,OAAO,CAAC,aAAa;YAkBP,kBAAkB;
|
|
1
|
+
{"version":3,"file":"CredentialValidation.d.ts","sourceRoot":"","sources":["../../src/agent/CredentialValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmF,MAAM,cAAc,CAAA;AAC5H,OAAO,EAEL,qBAAqB,EAUtB,MAAM,UAAU,CAAA;AAmBjB,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,MAAM,CAMrD,CAAA;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,QAAQ,CAAC,MAAM,MAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAMtC;IAED,OAAO,CAAC,aAAa;YAkBP,kBAAkB;YAoBlB,cAAc;YAad,cAAc;YAyBd,WAAW;YAQX,6BAA6B;YAsB7B,YAAY;YAwBZ,qBAAqB;YA4CrB,uBAAuB;CAoBtC"}
|
|
@@ -18,9 +18,9 @@ const ssi_types_1 = require("@sphereon/ssi-types");
|
|
|
18
18
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
19
19
|
const _2020_1 = __importDefault(require("ajv/dist/2020"));
|
|
20
20
|
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
21
|
-
const
|
|
22
|
-
var decodeFrom =
|
|
23
|
-
var IssuerSignedCbor =
|
|
21
|
+
const kmp_mdoc_core_1 = require("@sphereon/kmp-mdoc-core");
|
|
22
|
+
var decodeFrom = kmp_mdoc_core_1.com.sphereon.kmp.decodeFrom;
|
|
23
|
+
var IssuerSignedCbor = kmp_mdoc_core_1.com.sphereon.mdoc.data.device.IssuerSignedCbor;
|
|
24
24
|
// Exposing the methods here for any REST implementation
|
|
25
25
|
exports.credentialValidationMethods = [
|
|
26
26
|
'cvVerifyCredential',
|
|
@@ -63,7 +63,11 @@ class CredentialValidation {
|
|
|
63
63
|
var _a;
|
|
64
64
|
const { credential, hasher, policies } = args;
|
|
65
65
|
// defaulting the schema validation to when_present
|
|
66
|
-
const schemaResult = yield this.cvVerifySchema({
|
|
66
|
+
const schemaResult = yield this.cvVerifySchema({
|
|
67
|
+
credential,
|
|
68
|
+
validationPolicy: (_a = policies === null || policies === void 0 ? void 0 : policies.schemaValidation) !== null && _a !== void 0 ? _a : index_1.SchemaValidation.WHEN_PRESENT,
|
|
69
|
+
hasher,
|
|
70
|
+
});
|
|
67
71
|
if (!schemaResult.result) {
|
|
68
72
|
return schemaResult;
|
|
69
73
|
}
|
|
@@ -149,9 +153,9 @@ class CredentialValidation {
|
|
|
149
153
|
}
|
|
150
154
|
cvVerifyMdoc(args, context) {
|
|
151
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
-
var _a
|
|
156
|
+
var _a;
|
|
153
157
|
const { credential } = args;
|
|
154
|
-
const issuerSigned = IssuerSignedCbor.Static.cborDecode(decodeFrom(credential,
|
|
158
|
+
const issuerSigned = IssuerSignedCbor.Static.cborDecode(decodeFrom(credential, kmp_mdoc_core_1.com.sphereon.kmp.Encoding.BASE64URL));
|
|
155
159
|
const verification = yield context.agent.mdocVerifyIssuerSigned({ input: issuerSigned.toJson().issuerAuth }).catch((error) => {
|
|
156
160
|
var _a;
|
|
157
161
|
return {
|
|
@@ -161,8 +165,8 @@ class CredentialValidation {
|
|
|
161
165
|
message: (_a = error.message) !== null && _a !== void 0 ? _a : 'SD-JWT VC could not be verified',
|
|
162
166
|
};
|
|
163
167
|
});
|
|
164
|
-
return Object.assign({ source: ssi_types_1.CredentialMapper.toWrappedVerifiableCredential(credential), result:
|
|
165
|
-
error: (
|
|
168
|
+
return Object.assign({ source: ssi_types_1.CredentialMapper.toWrappedVerifiableCredential(credential), result: !verification.error, subResults: [] }, (verification.error && {
|
|
169
|
+
error: (_a = verification.message) !== null && _a !== void 0 ? _a : `Could not verify mdoc from issuer`,
|
|
166
170
|
}));
|
|
167
171
|
});
|
|
168
172
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialValidation.js","sourceRoot":"","sources":["../../src/agent/CredentialValidation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,oCAYiB;AACjB,mDAO4B;AAC5B,8DAA+B;AAC/B,0DAAmC;AACnC,8DAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"CredentialValidation.js","sourceRoot":"","sources":["../../src/agent/CredentialValidation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,oCAYiB;AACjB,mDAO4B;AAC5B,8DAA+B;AAC/B,0DAAmC;AACnC,8DAAoC;AACpC,2DAA6C;AAE7C,IAAO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AAM,CAAC,QAAQ;oBACvB,UAAU;oBACV,KAAK;oBACL,YAAY;iBACb,CAAA;YACH,CAAC;QACH,CAAC;KAAA;IAEa,uBAAuB,CAAC,IAA+B,EAAE,OAAwB;;YAC7F,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;YAEnC,MAAM,YAAY,GAAuD,MAAM,OAAO,CAAC,KAAK;iBACzF,aAAa,CAAC,EAAE,UAAU,EAAE,CAAC;iBAC7B,KAAK,CAAC,CAAC,KAAY,EAA+B,EAAE;;gBACnD,OAAO;oBACL,KAAK,EAAE,mBAAmB;oBAC1B,YAAY,EAAE,MAAA,KAAK,CAAC,OAAO,mCAAI,iCAAiC;iBACjE,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,MAAM,GAAG,QAAQ,IAAI,YAAY,IAAI,SAAS,IAAI,YAAY,CAAA;YACpE,uBACE,MAAM,EAAE,4BAAgB,CAAC,6BAA6B,CAAC,UAA0C,EAAE,EAAE,MAAM,EAAE,CAAC,EAC9G,MAAM,EACN,UAAU,EAAE,EAAE,IACX,CAAC,CAAC,MAAM,sBAAS,YAAY,CAAE,CAAC,EACpC;QACH,CAAC;KAAA;CACF;AA5MD,oDA4MC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.credential-validation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@sphereon/kmp-
|
|
19
|
-
"@sphereon/ssi-sdk.agent-config": "0.
|
|
20
|
-
"@sphereon/ssi-sdk.core": "0.
|
|
21
|
-
"@sphereon/ssi-sdk.mdl-mdoc": "0.
|
|
22
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.
|
|
23
|
-
"@sphereon/ssi-types": "0.
|
|
18
|
+
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.15",
|
|
19
|
+
"@sphereon/ssi-sdk.agent-config": "0.31.0",
|
|
20
|
+
"@sphereon/ssi-sdk.core": "0.31.0",
|
|
21
|
+
"@sphereon/ssi-sdk.mdl-mdoc": "0.31.0",
|
|
22
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.31.0",
|
|
23
|
+
"@sphereon/ssi-types": "0.31.0",
|
|
24
24
|
"@veramo/core": "4.2.0",
|
|
25
25
|
"@veramo/utils": "4.2.0",
|
|
26
26
|
"ajv": "^8.17.1",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"Credential",
|
|
55
55
|
"VerifiableCredential"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "3010f7bc57ed5f8d7953b6bf893e3164ea1821e8"
|
|
58
58
|
}
|
package/plugin.schema.json
CHANGED
|
@@ -1002,9 +1002,8 @@
|
|
|
1002
1002
|
"description": "Original IssuerSigned to Mdoc that we've received. Can be either the encoded or decoded variant."
|
|
1003
1003
|
},
|
|
1004
1004
|
"decoded": {
|
|
1005
|
-
"
|
|
1006
|
-
"
|
|
1007
|
-
"description": "Decoded version of the Mdoc payload. We add the record to make sure existing implementations remain happy"
|
|
1005
|
+
"$ref": "#/components/schemas/MdocDecodedPayload",
|
|
1006
|
+
"description": "Record where keys are the namespaces and the values are objects again with the namespace values"
|
|
1008
1007
|
},
|
|
1009
1008
|
"type": {
|
|
1010
1009
|
"anyOf": [
|
|
@@ -1025,7 +1024,7 @@
|
|
|
1025
1024
|
"description": "The claim format, typically used during exchange transport protocols"
|
|
1026
1025
|
},
|
|
1027
1026
|
"credential": {
|
|
1028
|
-
"$ref": "#/components/schemas/
|
|
1027
|
+
"$ref": "#/components/schemas/MdocDocument",
|
|
1029
1028
|
"description": "Internal stable representation of a Credential"
|
|
1030
1029
|
}
|
|
1031
1030
|
},
|
|
@@ -1037,6 +1036,20 @@
|
|
|
1037
1036
|
"credential"
|
|
1038
1037
|
]
|
|
1039
1038
|
},
|
|
1039
|
+
"MdocDecodedPayload": {
|
|
1040
|
+
"type": "object",
|
|
1041
|
+
"additionalProperties": {
|
|
1042
|
+
"type": "object",
|
|
1043
|
+
"additionalProperties": {
|
|
1044
|
+
"type": [
|
|
1045
|
+
"string",
|
|
1046
|
+
"number",
|
|
1047
|
+
"boolean"
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
"description": "Record where keys are the namespaces and the values are objects again with the namespace values"
|
|
1052
|
+
},
|
|
1040
1053
|
"WrappedVerifiablePresentation": {
|
|
1041
1054
|
"anyOf": [
|
|
1042
1055
|
{
|
|
@@ -1441,9 +1454,7 @@
|
|
|
1441
1454
|
"items": {
|
|
1442
1455
|
"$ref": "#/components/schemas/WrappedMdocCredential"
|
|
1443
1456
|
},
|
|
1444
|
-
"
|
|
1445
|
-
"maxItems": 1,
|
|
1446
|
-
"description": "Wrapped Mdocs belonging to the Presentation. ."
|
|
1457
|
+
"description": "Wrapped Mdocs belonging to the Presentation. There can be multiple documents in a single device response"
|
|
1447
1458
|
}
|
|
1448
1459
|
},
|
|
1449
1460
|
"required": [
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
import fetch from 'cross-fetch'
|
|
24
24
|
import Ajv2020 from 'ajv/dist/2020'
|
|
25
25
|
import addFormats from 'ajv-formats'
|
|
26
|
-
import { com } from '@sphereon/kmp-
|
|
26
|
+
import { com } from '@sphereon/kmp-mdoc-core'
|
|
27
27
|
import { IVerifySdJwtVcResult } from '@sphereon/ssi-sdk.sd-jwt'
|
|
28
28
|
import decodeFrom = com.sphereon.kmp.decodeFrom
|
|
29
29
|
import IssuerSignedCbor = com.sphereon.mdoc.data.device.IssuerSignedCbor
|
|
30
|
-
import IVerifySignatureResult = com.sphereon.crypto.IVerifySignatureResult
|
|
30
|
+
import IVerifySignatureResult = com.sphereon.crypto.generic.IVerifySignatureResult
|
|
31
31
|
|
|
32
32
|
// Exposing the methods here for any REST implementation
|
|
33
33
|
export const credentialValidationMethods: Array<string> = [
|
|
@@ -72,7 +72,11 @@ export class CredentialValidation implements IAgentPlugin {
|
|
|
72
72
|
private async cvVerifyCredential(args: VerifyCredentialArgs, context: RequiredContext): Promise<VerificationResult> {
|
|
73
73
|
const { credential, hasher, policies } = args
|
|
74
74
|
// defaulting the schema validation to when_present
|
|
75
|
-
const schemaResult = await this.cvVerifySchema({
|
|
75
|
+
const schemaResult = await this.cvVerifySchema({
|
|
76
|
+
credential,
|
|
77
|
+
validationPolicy: policies?.schemaValidation ?? SchemaValidation.WHEN_PRESENT,
|
|
78
|
+
hasher,
|
|
79
|
+
})
|
|
76
80
|
if (!schemaResult.result) {
|
|
77
81
|
return schemaResult
|
|
78
82
|
}
|
|
@@ -169,7 +173,7 @@ export class CredentialValidation implements IAgentPlugin {
|
|
|
169
173
|
|
|
170
174
|
return {
|
|
171
175
|
source: CredentialMapper.toWrappedVerifiableCredential(credential as OriginalVerifiableCredential),
|
|
172
|
-
result: !verification.error
|
|
176
|
+
result: !verification.error,
|
|
173
177
|
subResults: [],
|
|
174
178
|
...(verification.error && {
|
|
175
179
|
error: verification.message ?? `Could not verify mdoc from issuer`,
|