@verii/server-credentialagent 1.1.0-pre.1770077593 → 1.1.0-pre.1770080046
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/e2e/org-registration-and-issuing.e2e.test.js +10 -10
- package/migrations/20210317133137-add-index-to-offers-repo.js +1 -1
- package/migrations/20210719120225-add_unique_did_index_to_tenant.js +1 -1
- package/package.json +41 -40
- package/src/controllers/holder/get-exchange-progress/controller.js +1 -1
- package/src/controllers/holder/inspect/get-presentation-request/controller.js +3 -4
- package/src/controllers/holder/inspect/submit-presentation/controller.js +2 -2
- package/src/controllers/holder/issue/get-credential-manifest/controller.js +11 -12
- package/src/controllers/holder/issue/offers/controller.js +8 -8
- package/src/controllers/holder/issue/offers/credential-offers/controller.js +30 -28
- package/src/controllers/holder/issue/submit-identification/autohooks.js +1 -1
- package/src/controllers/holder/issue/submit-identification/controller.js +2 -2
- package/src/controllers/holder/oauth/controller.js +6 -7
- package/src/controllers/operator/tenants/_tenantId/check-credentials/controller-v0.8.js +6 -5
- package/src/controllers/operator/tenants/_tenantId/controller-v0.8.js +8 -8
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/controller-v0.8.js +14 -14
- package/src/controllers/operator/tenants/_tenantId/disclosures/_id/feeds/controller-v0.8.js +6 -6
- package/src/controllers/operator/tenants/_tenantId/disclosures/controller-v0.8.js +4 -4
- package/src/controllers/operator/tenants/_tenantId/exchanges/_exchangeId/controller-v0.8.js +3 -3
- package/src/controllers/operator/tenants/_tenantId/exchanges/controller-v0.8.js +6 -6
- package/src/controllers/operator/tenants/_tenantId/issued-credentials/controller-v0.8.js +14 -14
- package/src/controllers/operator/tenants/_tenantId/keys/controller-v0.8.js +7 -7
- package/src/controllers/operator/tenants/_tenantId/offer-data/controller-v0.8.js +3 -4
- package/src/controllers/operator/tenants/_tenantId/offers/controller-v0.8.js +13 -13
- package/src/controllers/operator/tenants/_tenantId/users/controller-v0.8.js +6 -5
- package/src/controllers/operator/tenants/_tenantId/vc-api/credentials/controller-v0.8.js +6 -6
- package/src/controllers/operator/tenants/controller-v0.8.js +7 -7
- package/src/controllers/root/controller.js +12 -12
- package/src/controllers/saasoperator/groups/_id/controller.js +4 -4
- package/src/controllers/saasoperator/groups/controller.js +2 -2
- package/src/entities/allocations/repos/repo.js +1 -1
- package/src/entities/deep-links/domains/velocity-protocol-uri-to-http-uri.js +1 -1
- package/src/entities/disclosures/domains/get-disclosure-configuration-type.js +2 -2
- package/src/entities/disclosures/domains/parse-body-to-disclosure.js +1 -1
- package/src/entities/disclosures/domains/validate-by-identification-method.js +2 -2
- package/src/entities/disclosures/domains/validate-commercial-entity.js +2 -1
- package/src/entities/disclosures/domains/validate-disclosure-by-configuration-type.js +1 -1
- package/src/entities/disclosures/domains/validate-disclosure-default-issuing.js +5 -5
- package/src/entities/disclosures/domains/validate-disclosure.js +1 -1
- package/src/entities/disclosures/domains/validate-presentation-definition.js +2 -2
- package/src/entities/disclosures/factories/disclosure-factory.js +2 -2
- package/src/entities/disclosures/repos/repo.js +2 -2
- package/src/entities/exchanges/adapters/sign-exchange-response.js +3 -2
- package/src/entities/exchanges/domains/build-exchange-progress.js +1 -1
- package/src/entities/exchanges/domains/ensure-exchange-state-valid.js +1 -1
- package/src/entities/exchanges/orchestrators/build-exchange-request-deep-link.js +3 -3
- package/src/entities/exchanges/repos/exchange-state-repo-extension.js +3 -3
- package/src/entities/exchanges/repos/repo.js +1 -1
- package/src/entities/feeds/factories/feed-factory.js +1 -1
- package/src/entities/feeds/repos/repo.js +1 -1
- package/src/entities/groups/orchestrators/find-group-or-error.js +1 -1
- package/src/entities/groups/orchestrators/validate-group.js +1 -1
- package/src/entities/groups/repos/delete-tenant-extension.js +1 -1
- package/src/entities/groups/repos/repo.js +1 -1
- package/src/entities/groups/repos/update-or-error-extension.js +1 -1
- package/src/entities/keys/domains/is-matching-private-key-kid.js +1 -1
- package/src/entities/keys/factories/key-factory.js +1 -1
- package/src/entities/keys/orchestrators/validate-did-doc-keys.js +2 -1
- package/src/entities/metadata-list-allocations/repos/repo.js +1 -1
- package/src/entities/offers/domains/build-deeplink-url.js +12 -12
- package/src/entities/offers/domains/build-offer.js +2 -2
- package/src/entities/offers/domains/build-qr-code-url.js +5 -5
- package/src/entities/offers/domains/filter-object-ids.js +2 -2
- package/src/entities/offers/domains/post-validation-offers-handler.js +1 -1
- package/src/entities/offers/domains/prepare-linked-credentials-for-holder.js +1 -1
- package/src/entities/offers/domains/resolve-subject.js +7 -7
- package/src/entities/offers/domains/validate-offer-commercial-entity.js +1 -0
- package/src/entities/offers/domains/validate-offer.js +6 -5
- package/src/entities/offers/factories/offer-factory.js +5 -5
- package/src/entities/offers/orchestrators/create-verifiable-credentials.js +9 -9
- package/src/entities/offers/orchestrators/finalize-exchange.js +2 -2
- package/src/entities/offers/orchestrators/load-credential-refs.js +3 -3
- package/src/entities/offers/orchestrators/load-credential-types-map.js +2 -2
- package/src/entities/offers/orchestrators/prepare-offers.js +1 -1
- package/src/entities/offers/orchestrators/trigger-issued-credentials-webhook.js +2 -2
- package/src/entities/offers/repos/clean-pii-extension.js +1 -1
- package/src/entities/offers/repos/repo.js +5 -5
- package/src/entities/presentations/domains/build-identity-doc.js +7 -4
- package/src/entities/presentations/domains/build-vendor-data.js +1 -1
- package/src/entities/presentations/domains/check-payment-requirement.js +1 -1
- package/src/entities/presentations/domains/extract-fields-from-id-credential.js +1 -1
- package/src/entities/presentations/domains/validate-presentation.js +5 -5
- package/src/entities/presentations/orchestrators/create-presentation-request.js +6 -5
- package/src/entities/presentations/orchestrators/deduplicate-disclosure-exchange.js +2 -2
- package/src/entities/presentations/orchestrators/handle-presentation-submission.js +2 -2
- package/src/entities/presentations/orchestrators/match-identity-on-exchange.js +4 -4
- package/src/entities/presentations/orchestrators/share-identification-credentials.js +4 -3
- package/src/entities/presentations/orchestrators/share-presentation.js +12 -12
- package/src/entities/redirect/orchestrators/load-org-info.js +2 -1
- package/src/entities/revocation-list-allocations/repos/repo.js +1 -1
- package/src/entities/schemas/orchestrators/load-schema-validation.js +6 -6
- package/src/entities/tenants/domains/extract-service.js +1 -1
- package/src/entities/tenants/domains/validate-service-ids.js +2 -2
- package/src/entities/tenants/factories/tenant-factory.js +1 -1
- package/src/entities/tenants/orchestrators/add-primary-address-to-tenant.js +1 -1
- package/src/entities/tenants/orchestrators/create-tenant.js +4 -4
- package/src/entities/tenants/orchestrators/refresh-tenant-dids.js +1 -1
- package/src/entities/tenants/orchestrators/set-tenant-default-issuing-disclosure.js +1 -1
- package/src/entities/tenants/repos/repo.js +1 -1
- package/src/entities/tokens/adapters/access-token.js +1 -1
- package/src/entities/users/repos/find-or-insert-vendor-user-repo-extension.js +1 -1
- package/src/entities/users/repos/repo.js +1 -1
- package/src/fetchers/operator/inspection-fetcher.js +1 -1
- package/src/fetchers/operator/vendor-errors-handler.js +6 -6
- package/src/fetchers/operator/webhook-auth-header.js +1 -1
- package/src/plugins/ensure-disclosure-configuration-type-plugin.js +1 -1
- package/src/plugins/ensure-tenant-default-issuing-disclosure-id-plugin.js +3 -3
- package/src/plugins/exchange-error-handler-plugin.js +1 -1
- package/src/plugins/exchange-loader-plugin.js +1 -0
- package/src/plugins/group-loader-plugin.js +1 -1
- package/src/plugins/tenant-loader-plugin.js +2 -2
- package/src/plugins/validate-cao-plugin.js +2 -2
- package/src/plugins/verify-access-token-plugin.js +2 -2
- package/test/combined/app-redirect.test.js +17 -17
- package/test/combined/helpers/credentialagent-build-fastify.js +1 -1
- package/test/combined/helpers/nock-registrar-app-schema-name.js +3 -2
- package/test/combined/helpers/nock-registrar-get-organization-verified-profile.js +3 -3
- package/test/combined/validate-cao-plugin.test.js +6 -6
- package/test/helpers/jwt-vc-expectation.js +3 -3
- package/test/holder/credential-manifest-controller.test.js +154 -153
- package/test/holder/e2e-issuing-controller.test.js +10 -10
- package/test/holder/get-exchange-progress-controller.test.js +2 -2
- package/test/holder/get-presentation-request.test.js +57 -57
- package/test/holder/helpers/credential-type-metadata.js +3 -3
- package/test/holder/helpers/credentialagent-holder-build-fastify.js +1 -1
- package/test/holder/helpers/generate-presentation.js +7 -7
- package/test/holder/helpers/generate-test-access-token.js +1 -1
- package/test/holder/helpers/jwt-vc-expectation.js +3 -3
- package/test/holder/issuing-controller.test.js +297 -264
- package/test/holder/oauth-token-controller.test.js +16 -17
- package/test/holder/presentation-submission.test.js +89 -103
- package/test/holder/submit-identification.test.js +209 -209
- package/test/operator/check-credentials-controller-v0.8.test.js +22 -22
- package/test/operator/credentials-revoke.test.js +13 -13
- package/test/operator/disclosures-controller-v0.8.test.js +168 -172
- package/test/operator/exchanges-controller-v0.8.test.js +10 -11
- package/test/operator/exchanges-id-controller-v0.8.test.js +0 -1
- package/test/operator/feeds-controller-v0.8.test.js +19 -20
- package/test/operator/generate-push-gateway-token.test.js +1 -1
- package/test/operator/groups-controller.test.js +2 -2
- package/test/operator/groups-id-controller.test.js +7 -7
- package/test/operator/helpers/credentialagent-operator-build-fastify.js +1 -1
- package/test/operator/helpers/generate-primary-and-add-operator-to-primary.js +3 -4
- package/test/operator/issued-credentials-controller-v0.8.test.js +8 -9
- package/test/operator/keys-controller-v0.8.test.js +39 -39
- package/test/operator/offer-data-controller-v0.8.test.js +9 -8
- package/test/operator/offers-controller-v0.8.test.js +120 -121
- package/test/operator/set-configuration-type-modifier.test.js +6 -8
- package/test/operator/tenant-controller-v0.8.test.js +12 -13
- package/test/operator/tenants-controller-v0.8.test.js +58 -64
- package/test/operator/users-controller-v0.8.test.js +2 -3
- package/test/operator/vc-api-credentials.test.js +34 -34
- package/test/operator/vendor-errors-handler.test.js +10 -10
|
@@ -76,7 +76,7 @@ dotenv.config({
|
|
|
76
76
|
'..',
|
|
77
77
|
'samples',
|
|
78
78
|
'sample-registrar-server',
|
|
79
|
-
'.localdev.env'
|
|
79
|
+
'.localdev.env',
|
|
80
80
|
),
|
|
81
81
|
processEnv: e2eEnv,
|
|
82
82
|
});
|
|
@@ -192,7 +192,7 @@ describe('org registration and issuing e2e', () => {
|
|
|
192
192
|
'Content-Type': 'application/json',
|
|
193
193
|
Authorization: `Bearer ${authJson.access_token}`,
|
|
194
194
|
},
|
|
195
|
-
}
|
|
195
|
+
},
|
|
196
196
|
).then((r) => r.json());
|
|
197
197
|
|
|
198
198
|
// json response checks
|
|
@@ -214,7 +214,7 @@ describe('org registration and issuing e2e', () => {
|
|
|
214
214
|
headers: {
|
|
215
215
|
'Content-Type': 'application/json',
|
|
216
216
|
},
|
|
217
|
-
}
|
|
217
|
+
},
|
|
218
218
|
);
|
|
219
219
|
const quantity = 100;
|
|
220
220
|
const expiry = addMonths(3, new Date());
|
|
@@ -244,13 +244,13 @@ describe('org registration and issuing e2e', () => {
|
|
|
244
244
|
Authorization: `Bearer ${fineractAuthJson.access_token}`,
|
|
245
245
|
'fineract-platform-tenantid': 'default',
|
|
246
246
|
},
|
|
247
|
-
}
|
|
247
|
+
},
|
|
248
248
|
);
|
|
249
249
|
expect(createVoucherResponse.status).toEqual(200);
|
|
250
250
|
await expect(createVoucherResponse.json()).resolves.toEqual({
|
|
251
251
|
clientId: parseInt(
|
|
252
252
|
createFullOrganizationResponse.ids.fineractClientId,
|
|
253
|
-
10
|
|
253
|
+
10,
|
|
254
254
|
),
|
|
255
255
|
officeId: 1,
|
|
256
256
|
resourceId: expect.any(Number),
|
|
@@ -265,7 +265,7 @@ describe('org registration and issuing e2e', () => {
|
|
|
265
265
|
Authorization: `Bearer ${fineractAuthJson.access_token}`,
|
|
266
266
|
'fineract-platform-tenantid': 'default',
|
|
267
267
|
},
|
|
268
|
-
}
|
|
268
|
+
},
|
|
269
269
|
);
|
|
270
270
|
await expect(balanceQuery2Response.json()).resolves.toEqual({
|
|
271
271
|
balance: 100,
|
|
@@ -282,7 +282,7 @@ describe('org registration and issuing e2e', () => {
|
|
|
282
282
|
KeyPurposes.EXCHANGES,
|
|
283
283
|
KeyPurposes.ISSUING_METADATA,
|
|
284
284
|
].includes(first(purposes)),
|
|
285
|
-
keys
|
|
285
|
+
keys,
|
|
286
286
|
),
|
|
287
287
|
};
|
|
288
288
|
|
|
@@ -297,7 +297,7 @@ describe('org registration and issuing e2e', () => {
|
|
|
297
297
|
'Content-Type': 'application/json',
|
|
298
298
|
Authorization: `Bearer ${OPERATOR_API_TOKEN}`,
|
|
299
299
|
},
|
|
300
|
-
}
|
|
300
|
+
},
|
|
301
301
|
);
|
|
302
302
|
expect(createTenantResponse.status).toEqual(201);
|
|
303
303
|
const createTenantJson = await createTenantResponse.json();
|
|
@@ -441,7 +441,7 @@ describe('org registration and issuing e2e', () => {
|
|
|
441
441
|
authorization: `Bearer ${OPERATOR_API_TOKEN}`,
|
|
442
442
|
},
|
|
443
443
|
body: JSON.stringify(disclosure),
|
|
444
|
-
}
|
|
444
|
+
},
|
|
445
445
|
);
|
|
446
446
|
|
|
447
447
|
expect(createDisclosureResponse.status).toEqual(201);
|
|
@@ -466,7 +466,7 @@ const initMintBundle = async () => {
|
|
|
466
466
|
contractAddress: e2eEnv.COUPON_CONTRACT_ADDRESS,
|
|
467
467
|
rpcProvider,
|
|
468
468
|
},
|
|
469
|
-
{ log: console, traceId: nanoid() }
|
|
469
|
+
{ log: console, traceId: nanoid() },
|
|
470
470
|
);
|
|
471
471
|
|
|
472
472
|
return mint;
|
|
@@ -30,7 +30,7 @@ module.exports = {
|
|
|
30
30
|
console.log(`${resultsArray.length} duplicates found.`);
|
|
31
31
|
// eslint-disable-next-line no-console
|
|
32
32
|
console.log(
|
|
33
|
-
'Please remove the following duplicate tenants before re-running the migration'
|
|
33
|
+
'Please remove the following duplicate tenants before re-running the migration',
|
|
34
34
|
);
|
|
35
35
|
each((result) => {
|
|
36
36
|
// eslint-disable-next-line no-console
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/server-credentialagent",
|
|
3
|
-
"version": "1.1.0-pre.
|
|
3
|
+
"version": "1.1.0-pre.1770080046",
|
|
4
4
|
"description": "Credential Agent application",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"start:dev": "node --throw-deprecation src/standalone.js",
|
|
16
16
|
"start-operator": "node src/main-operator.js",
|
|
17
17
|
"start-holder": "node src/main-holder.js",
|
|
18
|
-
"lint": "eslint
|
|
18
|
+
"lint": "eslint .",
|
|
19
19
|
"lint:ci": "eslint . --format json >> eslint-results.json",
|
|
20
|
-
"lint:fix": "eslint --fix
|
|
20
|
+
"lint:fix": "eslint --fix .",
|
|
21
21
|
"migrate:status": "./node_modules/.bin/migrate-mongo status --file migrate-mongo.config.js",
|
|
22
22
|
"migrate:create": "./node_modules/.bin/migrate-mongo create --file migrate-mongo.config.js",
|
|
23
23
|
"migrate:up": "./node_modules/.bin/migrate-mongo up --file migrate-mongo.config.js",
|
|
@@ -40,31 +40,31 @@
|
|
|
40
40
|
"@fastify/view": "^11.0.0",
|
|
41
41
|
"@spencejs/spence-factories": "^0.10.2",
|
|
42
42
|
"@spencejs/spence-mongo-repos": "^0.10.2",
|
|
43
|
-
"@verii/auth": "1.1.0-pre.
|
|
44
|
-
"@verii/base-contract-io": "1.1.0-pre.
|
|
45
|
-
"@verii/blockchain-functions": "1.1.0-pre.
|
|
46
|
-
"@verii/common-fetchers": "1.1.0-pre.
|
|
47
|
-
"@verii/common-functions": "1.1.0-pre.
|
|
48
|
-
"@verii/common-schemas": "1.1.0-pre.
|
|
49
|
-
"@verii/config": "1.1.0-pre.
|
|
50
|
-
"@verii/contract-permissions": "1.1.0-pre.
|
|
51
|
-
"@verii/crypto": "1.1.0-pre.
|
|
52
|
-
"@verii/csv-parser": "1.1.0-pre.
|
|
53
|
-
"@verii/db-kms": "1.1.0-pre.
|
|
54
|
-
"@verii/did-doc": "1.1.0-pre.
|
|
55
|
-
"@verii/fastify-plugins": "1.1.0-pre.
|
|
56
|
-
"@verii/http-client": "1.1.0-pre.
|
|
57
|
-
"@verii/jwt": "1.1.0-pre.
|
|
58
|
-
"@verii/metadata-registration": "1.1.0-pre.
|
|
59
|
-
"@verii/organizations-registry": "1.1.0-pre.
|
|
60
|
-
"@verii/rest-queries": "1.1.0-pre.
|
|
61
|
-
"@verii/server-provider": "1.1.0-pre.
|
|
62
|
-
"@verii/spencer-mongo-extensions": "1.1.0-pre.
|
|
63
|
-
"@verii/test-regexes": "1.1.0-pre.
|
|
64
|
-
"@verii/validation": "1.1.0-pre.
|
|
65
|
-
"@verii/vc-checks": "1.1.0-pre.
|
|
66
|
-
"@verii/verii-issuing": "1.1.0-pre.
|
|
67
|
-
"@verii/verii-verification": "1.1.0-pre.
|
|
43
|
+
"@verii/auth": "1.1.0-pre.1770080046",
|
|
44
|
+
"@verii/base-contract-io": "1.1.0-pre.1770080046",
|
|
45
|
+
"@verii/blockchain-functions": "1.1.0-pre.1770080046",
|
|
46
|
+
"@verii/common-fetchers": "1.1.0-pre.1770080046",
|
|
47
|
+
"@verii/common-functions": "1.1.0-pre.1770080046",
|
|
48
|
+
"@verii/common-schemas": "1.1.0-pre.1770080046",
|
|
49
|
+
"@verii/config": "1.1.0-pre.1770080046",
|
|
50
|
+
"@verii/contract-permissions": "1.1.0-pre.1770080046",
|
|
51
|
+
"@verii/crypto": "1.1.0-pre.1770080046",
|
|
52
|
+
"@verii/csv-parser": "1.1.0-pre.1770080046",
|
|
53
|
+
"@verii/db-kms": "1.1.0-pre.1770080046",
|
|
54
|
+
"@verii/did-doc": "1.1.0-pre.1770080046",
|
|
55
|
+
"@verii/fastify-plugins": "1.1.0-pre.1770080046",
|
|
56
|
+
"@verii/http-client": "1.1.0-pre.1770080046",
|
|
57
|
+
"@verii/jwt": "1.1.0-pre.1770080046",
|
|
58
|
+
"@verii/metadata-registration": "1.1.0-pre.1770080046",
|
|
59
|
+
"@verii/organizations-registry": "1.1.0-pre.1770080046",
|
|
60
|
+
"@verii/rest-queries": "1.1.0-pre.1770080046",
|
|
61
|
+
"@verii/server-provider": "1.1.0-pre.1770080046",
|
|
62
|
+
"@verii/spencer-mongo-extensions": "1.1.0-pre.1770080046",
|
|
63
|
+
"@verii/test-regexes": "1.1.0-pre.1770080046",
|
|
64
|
+
"@verii/validation": "1.1.0-pre.1770080046",
|
|
65
|
+
"@verii/vc-checks": "1.1.0-pre.1770080046",
|
|
66
|
+
"@verii/verii-issuing": "1.1.0-pre.1770080046",
|
|
67
|
+
"@verii/verii-verification": "1.1.0-pre.1770080046",
|
|
68
68
|
"ajv": "8.17.1",
|
|
69
69
|
"canonicalize": "^2.1.0",
|
|
70
70
|
"date-fns": "~4.1.0",
|
|
@@ -83,29 +83,30 @@
|
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@spencejs/spence-config": "0.10.2",
|
|
86
|
-
"@verii/endpoints-organizations-registrar": "1.1.0-pre.
|
|
87
|
-
"@verii/sample-data": "1.1.0-pre.
|
|
86
|
+
"@verii/endpoints-organizations-registrar": "1.1.0-pre.1770080046",
|
|
87
|
+
"@verii/sample-data": "1.1.0-pre.1770080046",
|
|
88
88
|
"@verii/test-regexes": "0.5.0-build",
|
|
89
|
-
"@verii/tests-helpers": "1.1.0-pre.
|
|
89
|
+
"@verii/tests-helpers": "1.1.0-pre.1770080046",
|
|
90
90
|
"cheerio": "1.2.0",
|
|
91
91
|
"dotenv": "16.6.1",
|
|
92
|
-
"eslint": "
|
|
93
|
-
"eslint-config-airbnb-
|
|
94
|
-
"eslint-config-prettier": "
|
|
95
|
-
"eslint-plugin-autofix": "
|
|
96
|
-
"eslint-plugin-better-mutation": "1.
|
|
92
|
+
"eslint": "9.39.2",
|
|
93
|
+
"eslint-config-airbnb-extended": "3.0.1",
|
|
94
|
+
"eslint-config-prettier": "10.1.8",
|
|
95
|
+
"eslint-plugin-autofix": "2.2.0",
|
|
96
|
+
"eslint-plugin-better-mutation": "2.1.0",
|
|
97
97
|
"eslint-plugin-import": "2.32.0",
|
|
98
98
|
"eslint-plugin-prefer-arrow-functions": "3.9.1",
|
|
99
|
-
"eslint-plugin-prettier": "
|
|
100
|
-
"eslint-watch": "
|
|
99
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
100
|
+
"eslint-watch": "8.0.0",
|
|
101
101
|
"expect": "30.2.0",
|
|
102
|
+
"globals": "16.5.0",
|
|
102
103
|
"jest-json-schema": "6.1.0",
|
|
103
104
|
"jose": "5.10.0",
|
|
104
105
|
"migrate-mongo": "12.1.3",
|
|
105
106
|
"nanoid-dictionary": "5.0.0",
|
|
106
107
|
"nodemon": "3.1.11",
|
|
107
|
-
"prettier": "
|
|
108
|
+
"prettier": "3.8.1",
|
|
108
109
|
"qs": "6.14.1"
|
|
109
110
|
},
|
|
110
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "b095afed30b67c9643860bfddec83169ef8a50b4"
|
|
111
112
|
}
|
|
@@ -75,7 +75,7 @@ const controller = async (fastify) => {
|
|
|
75
75
|
protocolMetadata: {
|
|
76
76
|
protocol: ExchangeProtocols.VNF_API,
|
|
77
77
|
},
|
|
78
|
-
})
|
|
78
|
+
}),
|
|
79
79
|
);
|
|
80
80
|
// eslint-disable-next-line better-mutation/no-mutation
|
|
81
81
|
req.exchange = exchange; // exchange is added onto the request for the exchange error handler
|
|
@@ -83,17 +83,16 @@ const controller = async (fastify) => {
|
|
|
83
83
|
const presentationRequest = await createPresentationRequest(
|
|
84
84
|
disclosure,
|
|
85
85
|
exchange,
|
|
86
|
-
req
|
|
86
|
+
req,
|
|
87
87
|
);
|
|
88
88
|
|
|
89
|
-
// eslint-disable-next-line camelcase
|
|
90
89
|
return {
|
|
91
90
|
presentation_request:
|
|
92
91
|
!isProd && req.query.format === 'json'
|
|
93
92
|
? presentationRequest
|
|
94
93
|
: await signExchangeResponse(presentationRequest, {}, req),
|
|
95
94
|
};
|
|
96
|
-
}
|
|
95
|
+
},
|
|
97
96
|
);
|
|
98
97
|
};
|
|
99
98
|
|
|
@@ -44,7 +44,7 @@ const controller = async (fastify) => {
|
|
|
44
44
|
// eslint-disable-next-line better-mutation/no-mutation
|
|
45
45
|
req.body.vp = await verifyVerifiablePresentationJwt(
|
|
46
46
|
req.body.jwt_vp ?? req.body.vp_jwt,
|
|
47
|
-
req
|
|
47
|
+
req,
|
|
48
48
|
);
|
|
49
49
|
},
|
|
50
50
|
schema: fastify.autoSchema({
|
|
@@ -82,7 +82,7 @@ const controller = async (fastify) => {
|
|
|
82
82
|
},
|
|
83
83
|
async (req) => {
|
|
84
84
|
return handlePresentationSubmission(req.body.vp, req);
|
|
85
|
-
}
|
|
85
|
+
},
|
|
86
86
|
);
|
|
87
87
|
};
|
|
88
88
|
|
|
@@ -85,23 +85,23 @@ const credentialManifestController = async (fastify) => {
|
|
|
85
85
|
pushDelegate,
|
|
86
86
|
credentialTypes,
|
|
87
87
|
id,
|
|
88
|
-
req
|
|
88
|
+
req,
|
|
89
89
|
);
|
|
90
90
|
const disclosure = await repos.disclosures.findById(
|
|
91
|
-
exchange.disclosureId
|
|
91
|
+
exchange.disclosureId,
|
|
92
92
|
);
|
|
93
93
|
|
|
94
94
|
// eslint-disable-next-line better-mutation/no-mutation
|
|
95
95
|
req.exchange = exchange; // added onto the request for the exchange error handler
|
|
96
96
|
await ensureExchangeStateValid(
|
|
97
97
|
ExchangeErrorCodeState.EXCHANGE_INVALID,
|
|
98
|
-
req
|
|
98
|
+
req,
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
const presentationRequest = await createPresentationRequest(
|
|
102
102
|
disclosure,
|
|
103
103
|
exchange,
|
|
104
|
-
req
|
|
104
|
+
req,
|
|
105
105
|
);
|
|
106
106
|
|
|
107
107
|
const credentialTypeDescriptors = await Promise.all(
|
|
@@ -109,10 +109,10 @@ const credentialManifestController = async (fastify) => {
|
|
|
109
109
|
(type) =>
|
|
110
110
|
getCredentialTypeDescriptor(
|
|
111
111
|
{ type, locale, includeDisplay: true },
|
|
112
|
-
req
|
|
112
|
+
req,
|
|
113
113
|
),
|
|
114
|
-
credentialTypes
|
|
115
|
-
)
|
|
114
|
+
credentialTypes,
|
|
115
|
+
),
|
|
116
116
|
);
|
|
117
117
|
|
|
118
118
|
const credentialManifest = {
|
|
@@ -121,14 +121,13 @@ const credentialManifestController = async (fastify) => {
|
|
|
121
121
|
issuer: { id: tenant.did },
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
// eslint-disable-next-line camelcase
|
|
125
124
|
return {
|
|
126
125
|
issuing_request:
|
|
127
126
|
!isProd && req.query.format === 'json'
|
|
128
127
|
? credentialManifest
|
|
129
128
|
: await signExchangeResponse(credentialManifest, {}, req),
|
|
130
129
|
};
|
|
131
|
-
}
|
|
130
|
+
},
|
|
132
131
|
);
|
|
133
132
|
};
|
|
134
133
|
|
|
@@ -149,7 +148,7 @@ const findOrCreateExchange = async (
|
|
|
149
148
|
pushDelegate,
|
|
150
149
|
credentialTypes,
|
|
151
150
|
disclosureId,
|
|
152
|
-
context
|
|
151
|
+
context,
|
|
153
152
|
) => {
|
|
154
153
|
const { repos } = context;
|
|
155
154
|
|
|
@@ -162,7 +161,7 @@ const findOrCreateExchange = async (
|
|
|
162
161
|
protocolMetadata: {
|
|
163
162
|
protocol: ExchangeProtocols.VNF_API,
|
|
164
163
|
},
|
|
165
|
-
}
|
|
164
|
+
},
|
|
166
165
|
);
|
|
167
166
|
}
|
|
168
167
|
|
|
@@ -186,7 +185,7 @@ const findOrCreateExchange = async (
|
|
|
186
185
|
protocol: ExchangeProtocols.VNF_API,
|
|
187
186
|
},
|
|
188
187
|
},
|
|
189
|
-
[ExchangeStates.CREDENTIAL_MANIFEST_REQUESTED]
|
|
188
|
+
[ExchangeStates.CREDENTIAL_MANIFEST_REQUESTED],
|
|
190
189
|
);
|
|
191
190
|
};
|
|
192
191
|
|
|
@@ -35,7 +35,7 @@ const controller = async (fastify) => {
|
|
|
35
35
|
const { addDocSchema } = fastify;
|
|
36
36
|
|
|
37
37
|
fastify.addHook('preHandler', async (req) =>
|
|
38
|
-
ensureExchangeStateValid(ExchangeErrorCodeState.EXCHANGE_INVALID, req)
|
|
38
|
+
ensureExchangeStateValid(ExchangeErrorCodeState.EXCHANGE_INVALID, req),
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
addDocSchema(newOfferRelatedResourceSchema);
|
|
@@ -86,7 +86,7 @@ const controller = async (fastify) => {
|
|
|
86
86
|
|
|
87
87
|
await repos.exchanges.addState(
|
|
88
88
|
exchange._id,
|
|
89
|
-
ExchangeStates.CLAIMING_IN_PROGRESS
|
|
89
|
+
ExchangeStates.CLAIMING_IN_PROGRESS,
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
await rejectOffers(exchange, rejectedOfferIds, req);
|
|
@@ -94,16 +94,16 @@ const controller = async (fastify) => {
|
|
|
94
94
|
const signedCredentials = await approveOffers(
|
|
95
95
|
approvedOfferIds,
|
|
96
96
|
body.proof,
|
|
97
|
-
req
|
|
97
|
+
req,
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
await finalizeExchange(
|
|
101
101
|
exchange,
|
|
102
102
|
concat(approvedOfferIds, rejectedOfferIds),
|
|
103
|
-
req
|
|
103
|
+
req,
|
|
104
104
|
);
|
|
105
105
|
return signedCredentials;
|
|
106
|
-
}
|
|
106
|
+
},
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
const rejectOffers = async (exchange, offerIds, context) => {
|
|
@@ -130,7 +130,7 @@ const approveOffers = async (offerIds, proof, context) => {
|
|
|
130
130
|
}
|
|
131
131
|
log.info(
|
|
132
132
|
{ credentialSubjectId: subject?.id, offers },
|
|
133
|
-
'issuing these offers'
|
|
133
|
+
'issuing these offers',
|
|
134
134
|
);
|
|
135
135
|
|
|
136
136
|
checkOffersToBeApproved(offers);
|
|
@@ -141,13 +141,13 @@ const approveOffers = async (offerIds, proof, context) => {
|
|
|
141
141
|
const initCheckOffers = (prop, errorMessageSuffix) => (offers) => {
|
|
142
142
|
const errorOfferIds = flow(
|
|
143
143
|
filter((offer) => !!offer[prop]),
|
|
144
|
-
map('_id')
|
|
144
|
+
map('_id'),
|
|
145
145
|
)(offers);
|
|
146
146
|
|
|
147
147
|
if (!isEmpty(errorOfferIds)) {
|
|
148
148
|
throw newError(
|
|
149
149
|
400,
|
|
150
|
-
buildCheckOffersErrorMessage(errorOfferIds, errorMessageSuffix)
|
|
150
|
+
buildCheckOffersErrorMessage(errorOfferIds, errorMessageSuffix),
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
};
|
|
@@ -49,7 +49,7 @@ const { requestOffersFromVendor } = require('../../../../../fetchers');
|
|
|
49
49
|
|
|
50
50
|
const controller = async (fastify) => {
|
|
51
51
|
fastify.addHook('preHandler', async (req) =>
|
|
52
|
-
ensureExchangeStateValid(ExchangeErrorCodeState.OFFERS_CLIAMED_SYNCH, req)
|
|
52
|
+
ensureExchangeStateValid(ExchangeErrorCodeState.OFFERS_CLIAMED_SYNCH, req),
|
|
53
53
|
);
|
|
54
54
|
const validateOffer = initValidateOffer(fastify);
|
|
55
55
|
|
|
@@ -103,6 +103,7 @@ const controller = async (fastify) => {
|
|
|
103
103
|
},
|
|
104
104
|
}),
|
|
105
105
|
},
|
|
106
|
+
// eslint-disable-next-line complexity
|
|
106
107
|
async (req, reply) => {
|
|
107
108
|
const {
|
|
108
109
|
user: { vendorUserId },
|
|
@@ -115,7 +116,7 @@ const controller = async (fastify) => {
|
|
|
115
116
|
|
|
116
117
|
await repos.exchanges.addState(
|
|
117
118
|
exchange._id,
|
|
118
|
-
ExchangeStates.OFFERS_REQUESTED
|
|
119
|
+
ExchangeStates.OFFERS_REQUESTED,
|
|
119
120
|
);
|
|
120
121
|
|
|
121
122
|
const offerMode = loadOfferMode(req);
|
|
@@ -129,14 +130,14 @@ const controller = async (fastify) => {
|
|
|
129
130
|
types,
|
|
130
131
|
offerHashes,
|
|
131
132
|
},
|
|
132
|
-
req
|
|
133
|
+
req,
|
|
133
134
|
);
|
|
134
135
|
|
|
135
136
|
if (status === 202) {
|
|
136
137
|
await repos.exchanges.addState(
|
|
137
138
|
exchange._id,
|
|
138
139
|
ExchangeStates.OFFERS_WAITING_ON_VENDOR,
|
|
139
|
-
{ offerHashes, vendorUserId }
|
|
140
|
+
{ offerHashes, vendorUserId },
|
|
140
141
|
);
|
|
141
142
|
} else {
|
|
142
143
|
const $set = {
|
|
@@ -155,7 +156,7 @@ const controller = async (fastify) => {
|
|
|
155
156
|
await repos.exchanges.addState(
|
|
156
157
|
exchange._id,
|
|
157
158
|
ExchangeStates.OFFERS_SENT,
|
|
158
|
-
$set
|
|
159
|
+
$set,
|
|
159
160
|
);
|
|
160
161
|
}
|
|
161
162
|
|
|
@@ -167,7 +168,7 @@ const controller = async (fastify) => {
|
|
|
167
168
|
challenge: isEmpty(holderOffers) ? undefined : challenge,
|
|
168
169
|
offers: holderOffers,
|
|
169
170
|
};
|
|
170
|
-
}
|
|
171
|
+
},
|
|
171
172
|
);
|
|
172
173
|
|
|
173
174
|
const loadOfferMode = (context) => {
|
|
@@ -185,7 +186,7 @@ const controller = async (fastify) => {
|
|
|
185
186
|
|
|
186
187
|
const loadAllOffers = async (
|
|
187
188
|
{ vendorUserId, types, offerHashes },
|
|
188
|
-
context
|
|
189
|
+
context,
|
|
189
190
|
) => {
|
|
190
191
|
const { exchange } = context;
|
|
191
192
|
const skipVendorOffers =
|
|
@@ -198,18 +199,18 @@ const controller = async (fastify) => {
|
|
|
198
199
|
offerHashes,
|
|
199
200
|
skipVendorOffers,
|
|
200
201
|
},
|
|
201
|
-
context
|
|
202
|
+
context,
|
|
202
203
|
);
|
|
203
204
|
};
|
|
204
205
|
|
|
205
206
|
const loadWebhookOffers = async (
|
|
206
207
|
{ vendorUserId, types, offerHashes },
|
|
207
|
-
context
|
|
208
|
+
context,
|
|
208
209
|
) => {
|
|
209
210
|
const { exchange } = context;
|
|
210
211
|
const skipPrepreparedOffers = !some(
|
|
211
212
|
{ state: ExchangeStates.OFFERS_RECEIVED },
|
|
212
|
-
exchange.events
|
|
213
|
+
exchange.events,
|
|
213
214
|
);
|
|
214
215
|
return loadOffers(
|
|
215
216
|
{
|
|
@@ -218,13 +219,13 @@ const controller = async (fastify) => {
|
|
|
218
219
|
offerHashes,
|
|
219
220
|
skipPrepreparedOffers,
|
|
220
221
|
},
|
|
221
|
-
context
|
|
222
|
+
context,
|
|
222
223
|
);
|
|
223
224
|
};
|
|
224
225
|
|
|
225
226
|
const loadPreparedOffers = async (
|
|
226
227
|
{ vendorUserId, types, offerHashes },
|
|
227
|
-
context
|
|
228
|
+
context,
|
|
228
229
|
) =>
|
|
229
230
|
loadOffers(
|
|
230
231
|
{
|
|
@@ -233,17 +234,17 @@ const controller = async (fastify) => {
|
|
|
233
234
|
offerHashes,
|
|
234
235
|
skipVendorOffers: true,
|
|
235
236
|
},
|
|
236
|
-
context
|
|
237
|
+
context,
|
|
237
238
|
);
|
|
238
239
|
|
|
239
240
|
const loadLegacyOffers = async (
|
|
240
241
|
{ vendorUserId, types, offerHashes },
|
|
241
|
-
context
|
|
242
|
+
context,
|
|
242
243
|
) => {
|
|
243
244
|
const { exchange } = context;
|
|
244
245
|
const skipVendorOffers = some(
|
|
245
246
|
{ state: ExchangeStates.OFFERS_RECEIVED },
|
|
246
|
-
exchange.events
|
|
247
|
+
exchange.events,
|
|
247
248
|
);
|
|
248
249
|
return loadOffers(
|
|
249
250
|
{
|
|
@@ -253,7 +254,7 @@ const controller = async (fastify) => {
|
|
|
253
254
|
filterByExchange: true,
|
|
254
255
|
skipVendorOffers,
|
|
255
256
|
},
|
|
256
|
-
context
|
|
257
|
+
context,
|
|
257
258
|
);
|
|
258
259
|
};
|
|
259
260
|
|
|
@@ -266,7 +267,8 @@ const controller = async (fastify) => {
|
|
|
266
267
|
skipVendorOffers = false,
|
|
267
268
|
skipPrepreparedOffers = false,
|
|
268
269
|
},
|
|
269
|
-
context
|
|
270
|
+
context,
|
|
271
|
+
// eslint-disable-next-line complexity
|
|
270
272
|
) => {
|
|
271
273
|
const vendorOfferResults = skipVendorOffers
|
|
272
274
|
? { offers: [], status: 200 }
|
|
@@ -282,17 +284,17 @@ const controller = async (fastify) => {
|
|
|
282
284
|
types,
|
|
283
285
|
offerHashes: concat(
|
|
284
286
|
offerHashes,
|
|
285
|
-
map('contentHash.value', vendorOfferResults.offers)
|
|
287
|
+
map('contentHash.value', vendorOfferResults.offers),
|
|
286
288
|
),
|
|
287
289
|
exchangeId: filterByExchange ? context.exchange._id : undefined,
|
|
288
290
|
},
|
|
289
|
-
context
|
|
291
|
+
context,
|
|
290
292
|
);
|
|
291
293
|
return {
|
|
292
294
|
...vendorOfferResults,
|
|
293
295
|
offers: mapOffer(
|
|
294
296
|
[...vendorOfferResults.offers, ...preparedOffers],
|
|
295
|
-
context
|
|
297
|
+
context,
|
|
296
298
|
),
|
|
297
299
|
};
|
|
298
300
|
};
|
|
@@ -318,7 +320,7 @@ const controller = async (fastify) => {
|
|
|
318
320
|
? offer.issuer
|
|
319
321
|
: offer.issuer.id.toString(),
|
|
320
322
|
}),
|
|
321
|
-
offers
|
|
323
|
+
offers,
|
|
322
324
|
);
|
|
323
325
|
};
|
|
324
326
|
|
|
@@ -346,7 +348,7 @@ const controller = async (fastify) => {
|
|
|
346
348
|
|
|
347
349
|
const countOffersWithoutOfferId = flow(
|
|
348
350
|
filter(({ offerId }) => isNil(offerId)),
|
|
349
|
-
size
|
|
351
|
+
size,
|
|
350
352
|
)(vendorOffers);
|
|
351
353
|
if (countOffersWithoutOfferId) {
|
|
352
354
|
const err = `${countOffersWithoutOfferId} offer(s) without offerId received from vendor`;
|
|
@@ -356,7 +358,7 @@ const controller = async (fastify) => {
|
|
|
356
358
|
{
|
|
357
359
|
vendorUserId,
|
|
358
360
|
err,
|
|
359
|
-
}
|
|
361
|
+
},
|
|
360
362
|
);
|
|
361
363
|
throw newError(500, err, {
|
|
362
364
|
errorCode: 'upstream_offers_offer_id_missing',
|
|
@@ -366,17 +368,17 @@ const controller = async (fastify) => {
|
|
|
366
368
|
const validatedOffersWithStatuses = await buildVendorOfferStatuses(
|
|
367
369
|
vendorOffers,
|
|
368
370
|
offerHashes,
|
|
369
|
-
context
|
|
371
|
+
context,
|
|
370
372
|
);
|
|
371
373
|
|
|
372
374
|
const vendorOfferStatuses = flow(
|
|
373
375
|
map(([{ offerId }, status]) => [offerId, status]),
|
|
374
|
-
fromPairs
|
|
376
|
+
fromPairs,
|
|
375
377
|
)(validatedOffersWithStatuses);
|
|
376
378
|
|
|
377
379
|
const validOffers = flow(
|
|
378
380
|
filter(([, status]) => status === 'OK'),
|
|
379
|
-
map(([offer]) => offer)
|
|
381
|
+
map(([offer]) => offer),
|
|
380
382
|
)(validatedOffersWithStatuses);
|
|
381
383
|
|
|
382
384
|
if (isEmpty(validOffers)) {
|
|
@@ -400,7 +402,7 @@ const controller = async (fastify) => {
|
|
|
400
402
|
vendorOffer,
|
|
401
403
|
true,
|
|
402
404
|
false,
|
|
403
|
-
context
|
|
405
|
+
context,
|
|
404
406
|
);
|
|
405
407
|
if (includes(hashOffer(validatedOffer), offerHashes)) {
|
|
406
408
|
return [validatedOffer, 'Duplicate'];
|
|
@@ -428,7 +430,7 @@ const validateInvalidWebhookOffers = (vendorOfferStatuses, context) => {
|
|
|
428
430
|
|
|
429
431
|
const allValid = all(
|
|
430
432
|
(status) => status === 'OK',
|
|
431
|
-
values(vendorOfferStatuses)
|
|
433
|
+
values(vendorOfferStatuses),
|
|
432
434
|
);
|
|
433
435
|
|
|
434
436
|
if (!errorOnInvalidWebhookOffers || allValid) {
|
|
@@ -32,6 +32,6 @@ module.exports = async (fastify) => {
|
|
|
32
32
|
.addSchema(velocityPresentationSubmissionResponseSchema)
|
|
33
33
|
.register(exchangeLoaderPlugin)
|
|
34
34
|
.addHook('preHandler', async (req) =>
|
|
35
|
-
ensureExchangeStateValid(ExchangeErrorCodeState.EXCHANGE_INVALID, req)
|
|
35
|
+
ensureExchangeStateValid(ExchangeErrorCodeState.EXCHANGE_INVALID, req),
|
|
36
36
|
);
|
|
37
37
|
};
|