@verii/server-credentialagent 1.0.0-pre.1754353016 → 1.0.0-pre.1754430833
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 +31 -31
- package/test/holder/get-presentation-request.test.js +8 -1
- package/test/holder/helpers/credential-type-metadata.js +3 -3
- package/test/holder/issuing-controller.test.js +25 -29
- package/test/holder/presentation-submission.test.js +24 -24
- package/test/holder/submit-identification.test.js +50 -49
- package/test/operator/vc-api-credentials.test.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/server-credentialagent",
|
|
3
|
-
"version": "1.0.0-pre.
|
|
3
|
+
"version": "1.0.0-pre.1754430833",
|
|
4
4
|
"description": "Credential Agent application",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
@@ -38,31 +38,31 @@
|
|
|
38
38
|
"@fastify/view": "^11.0.0",
|
|
39
39
|
"@spencejs/spence-factories": "^0.10.2",
|
|
40
40
|
"@spencejs/spence-mongo-repos": "^0.10.2",
|
|
41
|
-
"@verii/auth": "1.0.0-pre.
|
|
42
|
-
"@verii/base-contract-io": "1.0.0-pre.
|
|
43
|
-
"@verii/blockchain-functions": "1.0.0-pre.
|
|
44
|
-
"@verii/common-fetchers": "1.0.0-pre.
|
|
45
|
-
"@verii/common-functions": "1.0.0-pre.
|
|
46
|
-
"@verii/common-schemas": "1.0.0-pre.
|
|
47
|
-
"@verii/config": "1.0.0-pre.
|
|
48
|
-
"@verii/contract-permissions": "1.0.0-pre.
|
|
49
|
-
"@verii/crypto": "1.0.0-pre.
|
|
50
|
-
"@verii/csv-parser": "1.0.0-pre.
|
|
51
|
-
"@verii/db-kms": "1.0.0-pre.
|
|
52
|
-
"@verii/did-doc": "1.0.0-pre.
|
|
53
|
-
"@verii/fastify-plugins": "1.0.0-pre.
|
|
54
|
-
"@verii/jwt": "1.0.0-pre.
|
|
55
|
-
"@verii/metadata-registration": "1.0.0-pre.
|
|
56
|
-
"@verii/organizations-registry": "1.0.0-pre.
|
|
57
|
-
"@verii/request": "1.0.0-pre.
|
|
58
|
-
"@verii/rest-queries": "1.0.0-pre.
|
|
59
|
-
"@verii/server-provider": "1.0.0-pre.
|
|
60
|
-
"@verii/spencer-mongo-extensions": "1.0.0-pre.
|
|
61
|
-
"@verii/test-regexes": "1.0.0-pre.
|
|
62
|
-
"@verii/validation": "1.0.0-pre.
|
|
63
|
-
"@verii/vc-checks": "1.0.0-pre.
|
|
64
|
-
"@verii/velocity-issuing": "1.0.0-pre.
|
|
65
|
-
"@verii/verifiable-credentials": "1.0.0-pre.
|
|
41
|
+
"@verii/auth": "1.0.0-pre.1754430833",
|
|
42
|
+
"@verii/base-contract-io": "1.0.0-pre.1754430833",
|
|
43
|
+
"@verii/blockchain-functions": "1.0.0-pre.1754430833",
|
|
44
|
+
"@verii/common-fetchers": "1.0.0-pre.1754430833",
|
|
45
|
+
"@verii/common-functions": "1.0.0-pre.1754430833",
|
|
46
|
+
"@verii/common-schemas": "1.0.0-pre.1754430833",
|
|
47
|
+
"@verii/config": "1.0.0-pre.1754430833",
|
|
48
|
+
"@verii/contract-permissions": "1.0.0-pre.1754430833",
|
|
49
|
+
"@verii/crypto": "1.0.0-pre.1754430833",
|
|
50
|
+
"@verii/csv-parser": "1.0.0-pre.1754430833",
|
|
51
|
+
"@verii/db-kms": "1.0.0-pre.1754430833",
|
|
52
|
+
"@verii/did-doc": "1.0.0-pre.1754430833",
|
|
53
|
+
"@verii/fastify-plugins": "1.0.0-pre.1754430833",
|
|
54
|
+
"@verii/jwt": "1.0.0-pre.1754430833",
|
|
55
|
+
"@verii/metadata-registration": "1.0.0-pre.1754430833",
|
|
56
|
+
"@verii/organizations-registry": "1.0.0-pre.1754430833",
|
|
57
|
+
"@verii/request": "1.0.0-pre.1754430833",
|
|
58
|
+
"@verii/rest-queries": "1.0.0-pre.1754430833",
|
|
59
|
+
"@verii/server-provider": "1.0.0-pre.1754430833",
|
|
60
|
+
"@verii/spencer-mongo-extensions": "1.0.0-pre.1754430833",
|
|
61
|
+
"@verii/test-regexes": "1.0.0-pre.1754430833",
|
|
62
|
+
"@verii/validation": "1.0.0-pre.1754430833",
|
|
63
|
+
"@verii/vc-checks": "1.0.0-pre.1754430833",
|
|
64
|
+
"@verii/velocity-issuing": "1.0.0-pre.1754430833",
|
|
65
|
+
"@verii/verifiable-credentials": "1.0.0-pre.1754430833",
|
|
66
66
|
"ajv": "8.17.1",
|
|
67
67
|
"canonicalize": "^2.1.0",
|
|
68
68
|
"date-fns": "~3.6.0",
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"lodash": "^4.17.21",
|
|
77
77
|
"mongodb": "~6.17.0",
|
|
78
78
|
"nanoid": "~3.3.1",
|
|
79
|
-
"nock": "
|
|
79
|
+
"nock": "15.0.0-beta.5",
|
|
80
80
|
"qr-image": "~3.2.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@spencejs/spence-config": "0.10.2",
|
|
84
|
-
"@verii/endpoints-organizations-registrar": "1.0.0-pre.
|
|
85
|
-
"@verii/sample-data": "1.0.0-pre.
|
|
84
|
+
"@verii/endpoints-organizations-registrar": "1.0.0-pre.1754430833",
|
|
85
|
+
"@verii/sample-data": "1.0.0-pre.1754430833",
|
|
86
86
|
"@verii/test-regexes": "0.5.0-build",
|
|
87
|
-
"@verii/tests-helpers": "1.0.0-pre.
|
|
87
|
+
"@verii/tests-helpers": "1.0.0-pre.1754430833",
|
|
88
88
|
"cheerio": "1.1.0",
|
|
89
89
|
"dotenv": "16.6.1",
|
|
90
90
|
"eslint": "8.57.1",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"prettier": "2.8.8",
|
|
106
106
|
"qs": "6.14.0"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "1f66b3f094e6b835d75d8321b97f08160ce3f837"
|
|
109
109
|
}
|
|
@@ -204,6 +204,13 @@ describe('presentation request', () => {
|
|
|
204
204
|
expect(response.statusCode).toEqual(404);
|
|
205
205
|
});
|
|
206
206
|
it('should 500 if tenant did doc cannot be found', async () => {
|
|
207
|
+
nock('http://oracle.localhost.test')
|
|
208
|
+
.get(
|
|
209
|
+
`/api/v0.6/organizations/${encodeURIComponent(
|
|
210
|
+
tenant.did
|
|
211
|
+
)}/verified-profile`
|
|
212
|
+
)
|
|
213
|
+
.reply(404);
|
|
207
214
|
const q = { disclosureId: disclosure._id };
|
|
208
215
|
const response = await fastify.injectJson({
|
|
209
216
|
method: 'GET',
|
|
@@ -212,7 +219,7 @@ describe('presentation request', () => {
|
|
|
212
219
|
`/get-presentation-request?id=${q.disclosureId}`
|
|
213
220
|
),
|
|
214
221
|
});
|
|
215
|
-
expect(response.statusCode).toEqual(
|
|
222
|
+
expect(response.statusCode).toEqual(502);
|
|
216
223
|
});
|
|
217
224
|
it('should 500 if tenant doesnt have a private key defined', async () => {
|
|
218
225
|
nockRegistrarGetOrganizationVerifiedProfile(
|
|
@@ -79,9 +79,9 @@ const nockCredentialTypes = (times = 2) => {
|
|
|
79
79
|
)
|
|
80
80
|
)
|
|
81
81
|
.times(times)
|
|
82
|
-
.reply(200, (
|
|
83
|
-
const questionMarkIdx =
|
|
84
|
-
const searchParamsString =
|
|
82
|
+
.reply(200, (request) => {
|
|
83
|
+
const questionMarkIdx = request.url.indexOf('?');
|
|
84
|
+
const searchParamsString = request.url.substring(questionMarkIdx);
|
|
85
85
|
const query = new URLSearchParams(searchParamsString);
|
|
86
86
|
return Object.values(
|
|
87
87
|
pick(query.getAll('credentialType'), credentialTypeMetadata)
|
|
@@ -1284,9 +1284,8 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1284
1284
|
let identityWebhookHeaders;
|
|
1285
1285
|
const webhookNock = nock(webhookUrl)
|
|
1286
1286
|
.post(requestOffersFromVendorEndpoint)
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
identityWebhookHeaders = this.req.headers;
|
|
1287
|
+
.reply(200, (request) => {
|
|
1288
|
+
identityWebhookHeaders = request.headers;
|
|
1290
1289
|
|
|
1291
1290
|
return {
|
|
1292
1291
|
offers: [offer],
|
|
@@ -1307,7 +1306,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1307
1306
|
|
|
1308
1307
|
expect(response.statusCode).toEqual(200);
|
|
1309
1308
|
expect(webhookNock.isDone()).toBe(true);
|
|
1310
|
-
expect(identityWebhookHeaders.
|
|
1309
|
+
expect(identityWebhookHeaders.get('Authorization')).toBe(
|
|
1311
1310
|
'Bearer fake-bearer-token'
|
|
1312
1311
|
);
|
|
1313
1312
|
});
|
|
@@ -1363,9 +1362,8 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1363
1362
|
let identityWebhookHeaders;
|
|
1364
1363
|
const webhookNock = nock(webhookUrl)
|
|
1365
1364
|
.post(requestOffersFromVendorEndpoint)
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
identityWebhookHeaders = this.req.headers;
|
|
1365
|
+
.reply(200, (request) => {
|
|
1366
|
+
identityWebhookHeaders = request.headers;
|
|
1369
1367
|
|
|
1370
1368
|
return {
|
|
1371
1369
|
offers: [offer],
|
|
@@ -1386,7 +1384,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1386
1384
|
|
|
1387
1385
|
expect(response.statusCode).toEqual(200);
|
|
1388
1386
|
expect(webhookNock.isDone()).toBe(true);
|
|
1389
|
-
expect(identityWebhookHeaders.
|
|
1387
|
+
expect(identityWebhookHeaders.get('Authorization')).toBe('Bearer secret');
|
|
1390
1388
|
});
|
|
1391
1389
|
|
|
1392
1390
|
it('/credential-offers should not apply customToken if webhookUrl is not present', async () => {
|
|
@@ -1438,9 +1436,8 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1438
1436
|
let identityWebhookHeaders;
|
|
1439
1437
|
const webhookNock = nock(mockVendorUrl)
|
|
1440
1438
|
.post(requestOffersFromVendorEndpoint)
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
identityWebhookHeaders = this.req.headers;
|
|
1439
|
+
.reply(200, (request) => {
|
|
1440
|
+
identityWebhookHeaders = request.headers;
|
|
1444
1441
|
|
|
1445
1442
|
return {
|
|
1446
1443
|
offers: [offer],
|
|
@@ -1461,7 +1458,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1461
1458
|
|
|
1462
1459
|
expect(response.statusCode).toEqual(200);
|
|
1463
1460
|
expect(webhookNock.isDone()).toBe(true);
|
|
1464
|
-
expect(identityWebhookHeaders.
|
|
1461
|
+
expect(identityWebhookHeaders.get('Authorization')).toBe(
|
|
1465
1462
|
'Bearer fake-bearer-token'
|
|
1466
1463
|
);
|
|
1467
1464
|
});
|
|
@@ -1518,9 +1515,8 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1518
1515
|
let identityWebhookHeaders;
|
|
1519
1516
|
const webhookNock = nock(webhookUrl)
|
|
1520
1517
|
.post(requestOffersFromVendorEndpoint)
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
identityWebhookHeaders = this.req.headers;
|
|
1518
|
+
.reply(200, (request) => {
|
|
1519
|
+
identityWebhookHeaders = request.headers;
|
|
1524
1520
|
|
|
1525
1521
|
return {
|
|
1526
1522
|
offers: [offer],
|
|
@@ -1541,7 +1537,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1541
1537
|
|
|
1542
1538
|
expect(response.statusCode).toEqual(200);
|
|
1543
1539
|
expect(webhookNock.isDone()).toBe(true);
|
|
1544
|
-
expect(identityWebhookHeaders.
|
|
1540
|
+
expect(identityWebhookHeaders.get('Authorization')).toBe(
|
|
1545
1541
|
'Bearer fake-bearer-token'
|
|
1546
1542
|
);
|
|
1547
1543
|
});
|
|
@@ -1596,9 +1592,8 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1596
1592
|
let identityWebhookHeaders;
|
|
1597
1593
|
nock(webhookUrl)
|
|
1598
1594
|
.post(requestOffersFromVendorEndpoint)
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
identityWebhookHeaders = this.req.headers;
|
|
1595
|
+
.reply(200, (request) => {
|
|
1596
|
+
identityWebhookHeaders = request.headers;
|
|
1602
1597
|
|
|
1603
1598
|
return {
|
|
1604
1599
|
offers: [offer],
|
|
@@ -1618,7 +1613,9 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
1618
1613
|
});
|
|
1619
1614
|
|
|
1620
1615
|
expect(response.statusCode).toEqual(200);
|
|
1621
|
-
expect(identityWebhookHeaders.
|
|
1616
|
+
expect(identityWebhookHeaders.get('Authorization')).toEqual(
|
|
1617
|
+
'Bearer secret'
|
|
1618
|
+
);
|
|
1622
1619
|
});
|
|
1623
1620
|
|
|
1624
1621
|
it('/credential-offers should return all offers if exchange has only OFFERS_RECEIVED event and no OFFERS_WAITING_ON_VENDOR event', async () => {
|
|
@@ -5277,9 +5274,8 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
5277
5274
|
const nockWeb = nock(webhookUrl)
|
|
5278
5275
|
.post(acceptedOffersNotificationEndpoint)
|
|
5279
5276
|
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
identityWebhookHeaders = this.req.headers;
|
|
5277
|
+
.reply(200, (request) => {
|
|
5278
|
+
identityWebhookHeaders = request.headers;
|
|
5283
5279
|
});
|
|
5284
5280
|
|
|
5285
5281
|
const response = await fastify.injectJson({
|
|
@@ -5298,7 +5294,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
5298
5294
|
|
|
5299
5295
|
expect(response.statusCode).toEqual(200);
|
|
5300
5296
|
expect(nockWeb.isDone()).toEqual(true);
|
|
5301
|
-
expect(identityWebhookHeaders.
|
|
5297
|
+
expect(identityWebhookHeaders.get('Authorization')).toBeNull();
|
|
5302
5298
|
});
|
|
5303
5299
|
|
|
5304
5300
|
it('/finalize-offers should call a custom webhook from tenant with custom token', async () => {
|
|
@@ -5326,10 +5322,8 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
5326
5322
|
|
|
5327
5323
|
const nockWeb = nock(webhookUrl)
|
|
5328
5324
|
.post(acceptedOffersNotificationEndpoint)
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
.reply(200, function () {
|
|
5332
|
-
identityWebhookHeaders = this.req.headers;
|
|
5325
|
+
.reply(200, (request) => {
|
|
5326
|
+
identityWebhookHeaders = request.headers;
|
|
5333
5327
|
});
|
|
5334
5328
|
|
|
5335
5329
|
const response = await fastify.injectJson({
|
|
@@ -5348,7 +5342,9 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
5348
5342
|
|
|
5349
5343
|
expect(response.statusCode).toEqual(200);
|
|
5350
5344
|
expect(nockWeb.isDone()).toEqual(true);
|
|
5351
|
-
expect(identityWebhookHeaders.
|
|
5345
|
+
expect(identityWebhookHeaders.get('Authorization')).toEqual(
|
|
5346
|
+
'Bearer secret'
|
|
5347
|
+
);
|
|
5352
5348
|
});
|
|
5353
5349
|
|
|
5354
5350
|
it('/finalize-offers should approve offer from approvedOfferIds payload array and call triggerOffersAcceptedWebhook with an error', async () => {
|
|
@@ -355,8 +355,8 @@ describe('presentation submission', () => {
|
|
|
355
355
|
|
|
356
356
|
nock(mockVendorUrl)
|
|
357
357
|
.post(sendCredentialsUncheckedEndpoint)
|
|
358
|
-
.reply(200, (
|
|
359
|
-
webhookPayload =
|
|
358
|
+
.reply(200, async (request) => {
|
|
359
|
+
webhookPayload = await request.json();
|
|
360
360
|
return sendCredentialsPayload;
|
|
361
361
|
});
|
|
362
362
|
|
|
@@ -438,8 +438,8 @@ describe('presentation submission', () => {
|
|
|
438
438
|
|
|
439
439
|
nock(mockVendorUrl)
|
|
440
440
|
.post(sendCredentialsUncheckedEndpoint)
|
|
441
|
-
.reply(200, (
|
|
442
|
-
webhookPayload =
|
|
441
|
+
.reply(200, async (request) => {
|
|
442
|
+
webhookPayload = await request.json();
|
|
443
443
|
return sendCredentialsPayload;
|
|
444
444
|
});
|
|
445
445
|
|
|
@@ -589,8 +589,8 @@ describe('presentation submission', () => {
|
|
|
589
589
|
|
|
590
590
|
nock(mockVendorUrl)
|
|
591
591
|
.post(sendCredentialsCheckedEndpoint)
|
|
592
|
-
.reply(200, (
|
|
593
|
-
webhookPayload =
|
|
592
|
+
.reply(200, async (request) => {
|
|
593
|
+
webhookPayload = await request.json();
|
|
594
594
|
return sendCredentialsPayload;
|
|
595
595
|
});
|
|
596
596
|
|
|
@@ -677,8 +677,8 @@ describe('presentation submission', () => {
|
|
|
677
677
|
);
|
|
678
678
|
nock(mockVendorUrl)
|
|
679
679
|
.post(sendCredentialsCheckedEndpoint)
|
|
680
|
-
.reply(200, (
|
|
681
|
-
webhookPayload =
|
|
680
|
+
.reply(200, async (request) => {
|
|
681
|
+
webhookPayload = await request.json();
|
|
682
682
|
return sendCredentialsPayload;
|
|
683
683
|
});
|
|
684
684
|
|
|
@@ -764,8 +764,8 @@ describe('presentation submission', () => {
|
|
|
764
764
|
|
|
765
765
|
nock(mockVendorUrl)
|
|
766
766
|
.post(sendCredentialsCheckedEndpoint)
|
|
767
|
-
.reply(200, (
|
|
768
|
-
webhookPayload =
|
|
767
|
+
.reply(200, async (request) => {
|
|
768
|
+
webhookPayload = await request.json();
|
|
769
769
|
return sendCredentialsPayload;
|
|
770
770
|
});
|
|
771
771
|
|
|
@@ -834,8 +834,8 @@ describe('presentation submission', () => {
|
|
|
834
834
|
|
|
835
835
|
nock(mockVendorUrl)
|
|
836
836
|
.post(sendCredentialsCheckedEndpoint)
|
|
837
|
-
.reply(200, (
|
|
838
|
-
webhookPayload =
|
|
837
|
+
.reply(200, async (request) => {
|
|
838
|
+
webhookPayload = await request.json();
|
|
839
839
|
return sendCredentialsPayload;
|
|
840
840
|
});
|
|
841
841
|
|
|
@@ -1023,8 +1023,8 @@ describe('presentation submission', () => {
|
|
|
1023
1023
|
|
|
1024
1024
|
nock(mockVendorUrl)
|
|
1025
1025
|
.post(sendCredentialsCheckedEndpoint)
|
|
1026
|
-
.reply(200, (
|
|
1027
|
-
webhookPayload =
|
|
1026
|
+
.reply(200, async (request) => {
|
|
1027
|
+
webhookPayload = await request.json();
|
|
1028
1028
|
return sendCredentialsPayload;
|
|
1029
1029
|
});
|
|
1030
1030
|
|
|
@@ -1320,8 +1320,8 @@ describe('presentation submission', () => {
|
|
|
1320
1320
|
|
|
1321
1321
|
nock(mockVendorUrl)
|
|
1322
1322
|
.post(sendCredentialsCheckedEndpoint)
|
|
1323
|
-
.reply(200, (
|
|
1324
|
-
webhookPayload =
|
|
1323
|
+
.reply(200, async (request) => {
|
|
1324
|
+
webhookPayload = await request.json();
|
|
1325
1325
|
return sendCredentialsPayload;
|
|
1326
1326
|
});
|
|
1327
1327
|
|
|
@@ -1432,8 +1432,8 @@ describe('presentation submission', () => {
|
|
|
1432
1432
|
|
|
1433
1433
|
nock(mockVendorUrl)
|
|
1434
1434
|
.post(sendCredentialsCheckedEndpoint)
|
|
1435
|
-
.reply(200, (
|
|
1436
|
-
webhookPayload =
|
|
1435
|
+
.reply(200, async (request) => {
|
|
1436
|
+
webhookPayload = await request.json();
|
|
1437
1437
|
return sendCredentialsPayload;
|
|
1438
1438
|
});
|
|
1439
1439
|
|
|
@@ -1498,8 +1498,8 @@ describe('presentation submission', () => {
|
|
|
1498
1498
|
|
|
1499
1499
|
nock(mockVendorUrl)
|
|
1500
1500
|
.post(sendCredentialsCheckedEndpoint)
|
|
1501
|
-
.reply(200, (
|
|
1502
|
-
webhookPayload =
|
|
1501
|
+
.reply(200, async (request) => {
|
|
1502
|
+
webhookPayload = await request.json();
|
|
1503
1503
|
return sendCredentialsPayload;
|
|
1504
1504
|
});
|
|
1505
1505
|
|
|
@@ -1550,8 +1550,8 @@ describe('presentation submission', () => {
|
|
|
1550
1550
|
|
|
1551
1551
|
nock(mockVendorUrl)
|
|
1552
1552
|
.post(sendCredentialsCheckedEndpoint)
|
|
1553
|
-
.reply(200, (
|
|
1554
|
-
webhookPayload =
|
|
1553
|
+
.reply(200, async (request) => {
|
|
1554
|
+
webhookPayload = await request.json();
|
|
1555
1555
|
return sendCredentialsPayload;
|
|
1556
1556
|
});
|
|
1557
1557
|
|
|
@@ -1786,8 +1786,8 @@ describe('presentation submission', () => {
|
|
|
1786
1786
|
let webhookPayload;
|
|
1787
1787
|
nock(mockVendorUrl)
|
|
1788
1788
|
.post(sendCredentialsCheckedEndpoint)
|
|
1789
|
-
.reply(200, (
|
|
1790
|
-
webhookPayload =
|
|
1789
|
+
.reply(200, async (request) => {
|
|
1790
|
+
webhookPayload = await request.json();
|
|
1791
1791
|
return sendCredentialsPayload;
|
|
1792
1792
|
});
|
|
1793
1793
|
|
|
@@ -1560,8 +1560,8 @@ describe('submit identification disclosure', () => {
|
|
|
1560
1560
|
let identifyWebhookPayload;
|
|
1561
1561
|
nock(mockVendorUrl)
|
|
1562
1562
|
.post(identifyUserOnVendorEndpoint)
|
|
1563
|
-
.reply(200, (
|
|
1564
|
-
identifyWebhookPayload =
|
|
1563
|
+
.reply(200, async (request) => {
|
|
1564
|
+
identifyWebhookPayload = await request.json();
|
|
1565
1565
|
return {
|
|
1566
1566
|
vendorUserId,
|
|
1567
1567
|
};
|
|
@@ -1643,8 +1643,8 @@ describe('submit identification disclosure', () => {
|
|
|
1643
1643
|
let identifyWebhookPayload;
|
|
1644
1644
|
nock(mockVendorUrl)
|
|
1645
1645
|
.post(identifyUserOnVendorEndpoint)
|
|
1646
|
-
.reply(200, (
|
|
1647
|
-
identifyWebhookPayload =
|
|
1646
|
+
.reply(200, async (request) => {
|
|
1647
|
+
identifyWebhookPayload = await request.json();
|
|
1648
1648
|
return {
|
|
1649
1649
|
vendorUserId,
|
|
1650
1650
|
};
|
|
@@ -1761,8 +1761,8 @@ describe('submit identification disclosure', () => {
|
|
|
1761
1761
|
let identifyWebhookPayload;
|
|
1762
1762
|
const nockWebhook = await nock(webhookUrl)
|
|
1763
1763
|
.post(identifyUserOnVendorEndpoint)
|
|
1764
|
-
.reply(200, (
|
|
1765
|
-
identifyWebhookPayload =
|
|
1764
|
+
.reply(200, async (request) => {
|
|
1765
|
+
identifyWebhookPayload = await request.json();
|
|
1766
1766
|
return {
|
|
1767
1767
|
vendorUserId,
|
|
1768
1768
|
};
|
|
@@ -1885,10 +1885,9 @@ describe('submit identification disclosure', () => {
|
|
|
1885
1885
|
let identityWebhookHeaders;
|
|
1886
1886
|
const nockWebhook = await nock(webhookUrl)
|
|
1887
1887
|
.post(identifyUserOnVendorEndpoint)
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
identifyWebhookPayload = body;
|
|
1888
|
+
.reply(200, async (request) => {
|
|
1889
|
+
identityWebhookHeaders = request.headers;
|
|
1890
|
+
identifyWebhookPayload = await request.json();
|
|
1892
1891
|
return {
|
|
1893
1892
|
vendorUserId,
|
|
1894
1893
|
};
|
|
@@ -1937,7 +1936,9 @@ describe('submit identification disclosure', () => {
|
|
|
1937
1936
|
tenantDID: customTenant.did,
|
|
1938
1937
|
tenantId: customTenant._id,
|
|
1939
1938
|
});
|
|
1940
|
-
expect(identityWebhookHeaders.
|
|
1939
|
+
expect(identityWebhookHeaders.get('Authorization')).toEqual(
|
|
1940
|
+
'Bearer secret'
|
|
1941
|
+
);
|
|
1941
1942
|
});
|
|
1942
1943
|
|
|
1943
1944
|
it('should 200 when identifying email and a coupon was not provided', async () => {
|
|
@@ -1952,8 +1953,8 @@ describe('submit identification disclosure', () => {
|
|
|
1952
1953
|
let identifyWebhookPayload;
|
|
1953
1954
|
nock(mockVendorUrl)
|
|
1954
1955
|
.post(identifyUserOnVendorEndpoint)
|
|
1955
|
-
.reply(200, (
|
|
1956
|
-
identifyWebhookPayload =
|
|
1956
|
+
.reply(200, async (request) => {
|
|
1957
|
+
identifyWebhookPayload = await request.json();
|
|
1957
1958
|
return {
|
|
1958
1959
|
vendorUserId,
|
|
1959
1960
|
};
|
|
@@ -2044,8 +2045,8 @@ describe('submit identification disclosure', () => {
|
|
|
2044
2045
|
let identifyWebhookPayload;
|
|
2045
2046
|
nock(mockVendorUrl)
|
|
2046
2047
|
.post(identifyUserOnVendorEndpoint)
|
|
2047
|
-
.reply(200, (
|
|
2048
|
-
identifyWebhookPayload =
|
|
2048
|
+
.reply(200, async (request) => {
|
|
2049
|
+
identifyWebhookPayload = await request.json();
|
|
2049
2050
|
return {
|
|
2050
2051
|
vendorUserId,
|
|
2051
2052
|
};
|
|
@@ -2133,8 +2134,8 @@ describe('submit identification disclosure', () => {
|
|
|
2133
2134
|
let identifyWebhookPayload;
|
|
2134
2135
|
nock(mockVendorUrl)
|
|
2135
2136
|
.post(identifyUserOnVendorEndpoint)
|
|
2136
|
-
.reply(200, (
|
|
2137
|
-
identifyWebhookPayload =
|
|
2137
|
+
.reply(200, async (request) => {
|
|
2138
|
+
identifyWebhookPayload = await request.json();
|
|
2138
2139
|
return {
|
|
2139
2140
|
vendorUserId,
|
|
2140
2141
|
};
|
|
@@ -2224,8 +2225,8 @@ describe('submit identification disclosure', () => {
|
|
|
2224
2225
|
let identifyWebhookPayload;
|
|
2225
2226
|
nock(mockVendorUrl)
|
|
2226
2227
|
.post(identifyUserOnVendorEndpoint)
|
|
2227
|
-
.reply(200, (
|
|
2228
|
-
identifyWebhookPayload =
|
|
2228
|
+
.reply(200, async (request) => {
|
|
2229
|
+
identifyWebhookPayload = await request.json();
|
|
2229
2230
|
return {
|
|
2230
2231
|
vendorUserId,
|
|
2231
2232
|
};
|
|
@@ -2313,8 +2314,8 @@ describe('submit identification disclosure', () => {
|
|
|
2313
2314
|
let identifyWebhookPayload;
|
|
2314
2315
|
nock(mockVendorUrl)
|
|
2315
2316
|
.post(identifyUserOnVendorEndpoint)
|
|
2316
|
-
.reply(200, (
|
|
2317
|
-
identifyWebhookPayload =
|
|
2317
|
+
.reply(200, async (request) => {
|
|
2318
|
+
identifyWebhookPayload = await request.json();
|
|
2318
2319
|
return {
|
|
2319
2320
|
vendorUserId,
|
|
2320
2321
|
};
|
|
@@ -2402,8 +2403,8 @@ describe('submit identification disclosure', () => {
|
|
|
2402
2403
|
let identifyWebhookPayload;
|
|
2403
2404
|
nock(mockVendorUrl)
|
|
2404
2405
|
.post(identifyUserOnVendorEndpoint)
|
|
2405
|
-
.reply(200, (
|
|
2406
|
-
identifyWebhookPayload =
|
|
2406
|
+
.reply(200, async (request) => {
|
|
2407
|
+
identifyWebhookPayload = await request.json();
|
|
2407
2408
|
return {
|
|
2408
2409
|
vendorUserId,
|
|
2409
2410
|
};
|
|
@@ -2498,8 +2499,8 @@ describe('submit identification disclosure', () => {
|
|
|
2498
2499
|
let identifyWebhookPayload;
|
|
2499
2500
|
nock(mockVendorUrl)
|
|
2500
2501
|
.post(identifyUserOnVendorEndpoint)
|
|
2501
|
-
.reply(200, (
|
|
2502
|
-
identifyWebhookPayload =
|
|
2502
|
+
.reply(200, async (request) => {
|
|
2503
|
+
identifyWebhookPayload = await request.json();
|
|
2503
2504
|
return {
|
|
2504
2505
|
vendorUserId,
|
|
2505
2506
|
};
|
|
@@ -2676,8 +2677,8 @@ describe('submit identification disclosure', () => {
|
|
|
2676
2677
|
let identifyWebhookPayload;
|
|
2677
2678
|
nock(mockVendorUrl)
|
|
2678
2679
|
.post(identifyUserOnVendorEndpoint)
|
|
2679
|
-
.reply(200, (
|
|
2680
|
-
identifyWebhookPayload =
|
|
2680
|
+
.reply(200, async (request) => {
|
|
2681
|
+
identifyWebhookPayload = await request.json();
|
|
2681
2682
|
return { vendorUserId };
|
|
2682
2683
|
});
|
|
2683
2684
|
|
|
@@ -2768,8 +2769,8 @@ describe('submit identification disclosure', () => {
|
|
|
2768
2769
|
let identifyWebhookPayload;
|
|
2769
2770
|
nock(mockVendorUrl)
|
|
2770
2771
|
.post(identifyUserOnVendorEndpoint)
|
|
2771
|
-
.reply(200, (
|
|
2772
|
-
identifyWebhookPayload =
|
|
2772
|
+
.reply(200, async (request) => {
|
|
2773
|
+
identifyWebhookPayload = await request.json();
|
|
2773
2774
|
return { vendorUserId };
|
|
2774
2775
|
});
|
|
2775
2776
|
|
|
@@ -2883,8 +2884,8 @@ describe('submit identification disclosure', () => {
|
|
|
2883
2884
|
let identifyWebhookPayload;
|
|
2884
2885
|
nock(mockVendorUrl)
|
|
2885
2886
|
.post(identifyUserOnVendorEndpoint)
|
|
2886
|
-
.reply(200, (
|
|
2887
|
-
identifyWebhookPayload =
|
|
2887
|
+
.reply(200, async (request) => {
|
|
2888
|
+
identifyWebhookPayload = await request.json();
|
|
2888
2889
|
return { vendorUserId };
|
|
2889
2890
|
});
|
|
2890
2891
|
|
|
@@ -3000,8 +3001,8 @@ describe('submit identification disclosure', () => {
|
|
|
3000
3001
|
let identifyWebhookPayload;
|
|
3001
3002
|
nock(mockVendorUrl)
|
|
3002
3003
|
.post(identifyUserOnVendorEndpoint)
|
|
3003
|
-
.reply(200, (
|
|
3004
|
-
identifyWebhookPayload =
|
|
3004
|
+
.reply(200, async (request) => {
|
|
3005
|
+
identifyWebhookPayload = await request.json();
|
|
3005
3006
|
return {
|
|
3006
3007
|
vendorUserId: existingUser.vendorUserId,
|
|
3007
3008
|
};
|
|
@@ -3127,8 +3128,8 @@ describe('submit identification disclosure', () => {
|
|
|
3127
3128
|
let identifyWebhookPayload;
|
|
3128
3129
|
const nockWebhook = await nock(webhookUrl)
|
|
3129
3130
|
.post(identifyUserOnVendorEndpoint)
|
|
3130
|
-
.reply(200, (
|
|
3131
|
-
identifyWebhookPayload =
|
|
3131
|
+
.reply(200, async (request) => {
|
|
3132
|
+
identifyWebhookPayload = await request.json();
|
|
3132
3133
|
return {
|
|
3133
3134
|
vendorUserId: existingUser.vendorUserId,
|
|
3134
3135
|
};
|
|
@@ -3688,8 +3689,8 @@ describe('submit identification disclosure', () => {
|
|
|
3688
3689
|
nock(mockVendorUrl)
|
|
3689
3690
|
.post(identifyUserOnVendorEndpoint)
|
|
3690
3691
|
.twice()
|
|
3691
|
-
.reply(200, (
|
|
3692
|
-
identifyWebhookPayload =
|
|
3692
|
+
.reply(200, async (request) => {
|
|
3693
|
+
identifyWebhookPayload = await request.json();
|
|
3693
3694
|
return {
|
|
3694
3695
|
vendorUserId,
|
|
3695
3696
|
};
|
|
@@ -3829,8 +3830,8 @@ describe('submit identification disclosure', () => {
|
|
|
3829
3830
|
let identifyWebhookPayload;
|
|
3830
3831
|
nock(mockVendorUrl)
|
|
3831
3832
|
.post(identifyUserOnVendorEndpoint)
|
|
3832
|
-
.reply(200, (
|
|
3833
|
-
identifyWebhookPayload =
|
|
3833
|
+
.reply(200, async (request) => {
|
|
3834
|
+
identifyWebhookPayload = await request.json();
|
|
3834
3835
|
return {
|
|
3835
3836
|
vendorUserId,
|
|
3836
3837
|
};
|
|
@@ -3945,8 +3946,8 @@ describe('submit identification disclosure', () => {
|
|
|
3945
3946
|
let identifyWebhookPayload;
|
|
3946
3947
|
nock(mockVendorUrl)
|
|
3947
3948
|
.post(identifyUserOnVendorEndpoint)
|
|
3948
|
-
.reply(200, (
|
|
3949
|
-
identifyWebhookPayload =
|
|
3949
|
+
.reply(200, async (request) => {
|
|
3950
|
+
identifyWebhookPayload = await request.json();
|
|
3950
3951
|
return {
|
|
3951
3952
|
vendorUserId,
|
|
3952
3953
|
};
|
|
@@ -4055,8 +4056,8 @@ describe('submit identification disclosure', () => {
|
|
|
4055
4056
|
let identifyWebhookPayload;
|
|
4056
4057
|
nock(mockVendorUrl)
|
|
4057
4058
|
.post(identifyUserOnVendorEndpoint)
|
|
4058
|
-
.reply(200, (
|
|
4059
|
-
identifyWebhookPayload =
|
|
4059
|
+
.reply(200, async (request) => {
|
|
4060
|
+
identifyWebhookPayload = await request.json();
|
|
4060
4061
|
return {
|
|
4061
4062
|
vendorUserId,
|
|
4062
4063
|
};
|
|
@@ -4152,8 +4153,8 @@ describe('submit identification disclosure', () => {
|
|
|
4152
4153
|
let identifyWebhookPayload;
|
|
4153
4154
|
nock(mockVendorUrl)
|
|
4154
4155
|
.post(identifyUserOnVendorEndpoint)
|
|
4155
|
-
.reply(200, (
|
|
4156
|
-
identifyWebhookPayload =
|
|
4156
|
+
.reply(200, async (request) => {
|
|
4157
|
+
identifyWebhookPayload = await request.json();
|
|
4157
4158
|
return {
|
|
4158
4159
|
vendorUserId,
|
|
4159
4160
|
};
|
|
@@ -4332,8 +4333,8 @@ describe('submit identification disclosure', () => {
|
|
|
4332
4333
|
let identifyWebhookPayload;
|
|
4333
4334
|
nock(mockVendorUrl)
|
|
4334
4335
|
.post(identifyUserOnVendorEndpoint)
|
|
4335
|
-
.reply(200, (
|
|
4336
|
-
identifyWebhookPayload =
|
|
4336
|
+
.reply(200, async (request) => {
|
|
4337
|
+
identifyWebhookPayload = await request.json();
|
|
4337
4338
|
return {
|
|
4338
4339
|
vendorUserId,
|
|
4339
4340
|
};
|
|
@@ -4539,8 +4540,8 @@ describe('submit identification disclosure', () => {
|
|
|
4539
4540
|
let identifyWebhookPayload;
|
|
4540
4541
|
nock(mockVendorUrl)
|
|
4541
4542
|
.post(identifyUserOnVendorEndpoint)
|
|
4542
|
-
.reply(200, (
|
|
4543
|
-
identifyWebhookPayload =
|
|
4543
|
+
.reply(200, async (request) => {
|
|
4544
|
+
identifyWebhookPayload = await request.json();
|
|
4544
4545
|
return {
|
|
4545
4546
|
vendorUserId,
|
|
4546
4547
|
};
|
|
@@ -943,9 +943,9 @@ const nockCredentialTypes = () => {
|
|
|
943
943
|
)
|
|
944
944
|
)
|
|
945
945
|
.times(2)
|
|
946
|
-
.reply(200, (
|
|
947
|
-
const questionMarkIdx =
|
|
948
|
-
const searchParamsString =
|
|
946
|
+
.reply(200, (request) => {
|
|
947
|
+
const questionMarkIdx = request.url.indexOf('?');
|
|
948
|
+
const searchParamsString = request.url.substring(questionMarkIdx);
|
|
949
949
|
const query = new URLSearchParams(searchParamsString);
|
|
950
950
|
return Object.values(
|
|
951
951
|
pick(query.getAll('credentialType'), credentialTypeMetadata)
|