@verii/batch-issuer 1.3.0 → 1.4.0-pre.1794611916.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/batch-issuer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-pre.1794611916.0",
|
|
4
4
|
"description": "Loads Credentialing Hub depots and credentials from a CSV file, a YAML spec and JSON Handlebars templates",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ajv": "8.20.0",
|
|
17
|
-
"ajv-formats": "3.0.1",
|
|
18
17
|
"commander": "~15.0.0",
|
|
19
18
|
"csv-parse": "^7.0.3",
|
|
20
19
|
"csv-stringify": "^6.9.0",
|
|
@@ -22,13 +21,13 @@
|
|
|
22
21
|
"libphonenumber-js": "^1.13.15",
|
|
23
22
|
"lodash": "^4.18.1",
|
|
24
23
|
"yaml": "^2.9.1",
|
|
25
|
-
"@verii/common-
|
|
26
|
-
"@verii/
|
|
27
|
-
"@verii/credentialing-hub-operator-api": "1.
|
|
28
|
-
"@verii/
|
|
29
|
-
"@verii/
|
|
30
|
-
"@verii/
|
|
31
|
-
"@verii/
|
|
24
|
+
"@verii/common-functions": "1.4.0-pre.1794611916.0",
|
|
25
|
+
"@verii/jwt": "1.4.0-pre.1794611916.0",
|
|
26
|
+
"@verii/credentialing-hub-operator-api": "1.4.0-pre.1794611916.0",
|
|
27
|
+
"@verii/http-client": "1.4.0-pre.1794611916.0",
|
|
28
|
+
"@verii/common-fetchers": "1.4.0-pre.1794611916.0",
|
|
29
|
+
"@verii/validation": "1.4.0-pre.1794611916.0",
|
|
30
|
+
"@verii/vc-checks": "1.4.0-pre.1794611916.0"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
33
|
"eslint": "9.39.5",
|
|
@@ -31,6 +31,7 @@ const {
|
|
|
31
31
|
trim,
|
|
32
32
|
} = require('lodash/fp');
|
|
33
33
|
const {
|
|
34
|
+
ruleCandidateValues,
|
|
34
35
|
ruleValues,
|
|
35
36
|
selectClaims,
|
|
36
37
|
} = require('@verii/credentialing-hub-operator-api');
|
|
@@ -65,10 +66,6 @@ const readSample = async (file) => {
|
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
|
|
68
|
-
// The Hub's equal rule uses a value only when the credentials give exactly one.
|
|
69
|
-
const candidateValues = (rule, values) =>
|
|
70
|
-
rule.rule === 'equal' && size(values) !== 1 ? [] : values;
|
|
71
|
-
|
|
72
69
|
const pointerSelections = (rule) => (sample) => ({
|
|
73
70
|
file: sample.file,
|
|
74
71
|
pointers: map(
|
|
@@ -80,14 +77,15 @@ const pointerSelections = (rule) => (sample) => ({
|
|
|
80
77
|
),
|
|
81
78
|
});
|
|
82
79
|
|
|
80
|
+
// The values the rule finds, and the ones the Hub uses: an equal rule uses a
|
|
81
|
+
// value only when the credentials give exactly one.
|
|
83
82
|
const checkRule = (samples) => (rule) => {
|
|
84
|
-
const values = ruleValues(rule, samples);
|
|
85
83
|
const ruleSamples = filter({ type: rule.type }, samples);
|
|
86
84
|
return {
|
|
87
85
|
rule,
|
|
88
86
|
samples: map(pointerSelections(rule), ruleSamples),
|
|
89
|
-
values,
|
|
90
|
-
candidateValues:
|
|
87
|
+
values: ruleValues(rule, samples),
|
|
88
|
+
candidateValues: ruleCandidateValues(rule, samples),
|
|
91
89
|
};
|
|
92
90
|
};
|
|
93
91
|
|
package/src/load/load-batch.js
CHANGED
|
@@ -36,7 +36,8 @@ const {
|
|
|
36
36
|
zipWith,
|
|
37
37
|
} = require('lodash/fp');
|
|
38
38
|
const { runSequentially } = require('@verii/common-functions');
|
|
39
|
-
const { isInternalVpAuth
|
|
39
|
+
const { isInternalVpAuth } = require('@verii/credentialing-hub-operator-api');
|
|
40
|
+
const { isPreauth } = require('../validation/check-service');
|
|
40
41
|
const { appendRecords, startState } = require('../state/state-file');
|
|
41
42
|
const { count } = require('../report/count');
|
|
42
43
|
|
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const Ajv2019 = require('ajv/dist/2019');
|
|
18
|
-
const addFormats = require('ajv-formats');
|
|
19
|
-
const draft7MetaSchema = require('ajv/dist/refs/json-schema-draft-07.json');
|
|
20
17
|
const {
|
|
21
18
|
cloneDeep,
|
|
22
19
|
difference,
|
|
@@ -35,22 +32,19 @@ const {
|
|
|
35
32
|
const {
|
|
36
33
|
operatorApiAjvFormats,
|
|
37
34
|
} = require('@verii/credentialing-hub-operator-api');
|
|
38
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
initAjv2019Validation,
|
|
37
|
+
wrapValidationError,
|
|
38
|
+
} = require('@verii/validation');
|
|
39
39
|
|
|
40
40
|
// credentials/create checks a credentialSubject with the validation plugin's
|
|
41
|
-
// AJV
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
allErrors: true,
|
|
49
|
-
});
|
|
50
|
-
ajv.addMetaSchema(draft7MetaSchema);
|
|
51
|
-
addFormats(ajv, operatorApiAjvFormats);
|
|
52
|
-
return initValidation(ajv);
|
|
53
|
-
};
|
|
41
|
+
// AJV, the Hub's formats, and the credentials controller's options. It reports
|
|
42
|
+
// every error rather than the first, which doesn't change what's valid.
|
|
43
|
+
const initSubjectValidation = () =>
|
|
44
|
+
initAjv2019Validation(
|
|
45
|
+
{ useDefaults: true, strictTypes: false, allErrors: true },
|
|
46
|
+
operatorApiAjvFormats,
|
|
47
|
+
);
|
|
54
48
|
|
|
55
49
|
const loadSubjectValidators = async (metadatas, registrar) => {
|
|
56
50
|
const schemas = await Promise.all(
|
|
@@ -26,17 +26,13 @@ const {
|
|
|
26
26
|
sortBy,
|
|
27
27
|
zipWith,
|
|
28
28
|
} = require('lodash/fp');
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const {
|
|
30
|
+
isInternalVpAuth,
|
|
31
|
+
isServiceDeactivated,
|
|
32
|
+
} = require('@verii/credentialing-hub-operator-api');
|
|
33
33
|
|
|
34
34
|
const isPreauth = (service) => includes('preauth', service.authMethods);
|
|
35
35
|
|
|
36
|
-
const isDeactivated = (service) =>
|
|
37
|
-
service.deactivationDate != null &&
|
|
38
|
-
new Date(service.deactivationDate) <= new Date();
|
|
39
|
-
|
|
40
36
|
// The rules in valueIndex order. Only an internal verifiable_presentation
|
|
41
37
|
// service matches depots by their auth values.
|
|
42
38
|
const authRulesOf = (service) =>
|
|
@@ -59,7 +55,7 @@ const checkAuthMethods = (service) => {
|
|
|
59
55
|
};
|
|
60
56
|
|
|
61
57
|
const checkActive = (service) =>
|
|
62
|
-
|
|
58
|
+
isServiceDeactivated(service)
|
|
63
59
|
? [{ reason: `the service was deactivated at ${service.deactivationDate}` }]
|
|
64
60
|
: [];
|
|
65
61
|
|
|
@@ -124,4 +120,4 @@ const checkService = ({ spec, templates, service }) => {
|
|
|
124
120
|
};
|
|
125
121
|
};
|
|
126
122
|
|
|
127
|
-
module.exports = { checkService,
|
|
123
|
+
module.exports = { checkService, isPreauth };
|