@verii/server-credentialagent 1.1.0-pre.1758089377 → 1.1.0-pre.1758094000

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/server-credentialagent",
3
- "version": "1.1.0-pre.1758089377",
3
+ "version": "1.1.0-pre.1758094000",
4
4
  "description": "Credential Agent application",
5
5
  "main": "src/index.js",
6
6
  "repository": "https://github.com/LFDT-Verii/core",
@@ -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.1758089377",
44
- "@verii/base-contract-io": "1.1.0-pre.1758089377",
45
- "@verii/blockchain-functions": "1.1.0-pre.1758089377",
46
- "@verii/common-fetchers": "1.1.0-pre.1758089377",
47
- "@verii/common-functions": "1.1.0-pre.1758089377",
48
- "@verii/common-schemas": "1.1.0-pre.1758089377",
49
- "@verii/config": "1.1.0-pre.1758089377",
50
- "@verii/contract-permissions": "1.1.0-pre.1758089377",
51
- "@verii/crypto": "1.1.0-pre.1758089377",
52
- "@verii/csv-parser": "1.1.0-pre.1758089377",
53
- "@verii/db-kms": "1.1.0-pre.1758089377",
54
- "@verii/did-doc": "1.1.0-pre.1758089377",
55
- "@verii/fastify-plugins": "1.1.0-pre.1758089377",
56
- "@verii/http-client": "1.1.0-pre.1758089377",
57
- "@verii/jwt": "1.1.0-pre.1758089377",
58
- "@verii/metadata-registration": "1.1.0-pre.1758089377",
59
- "@verii/organizations-registry": "1.1.0-pre.1758089377",
60
- "@verii/rest-queries": "1.1.0-pre.1758089377",
61
- "@verii/server-provider": "1.1.0-pre.1758089377",
62
- "@verii/spencer-mongo-extensions": "1.1.0-pre.1758089377",
63
- "@verii/test-regexes": "1.1.0-pre.1758089377",
64
- "@verii/validation": "1.1.0-pre.1758089377",
65
- "@verii/vc-checks": "1.1.0-pre.1758089377",
66
- "@verii/verii-issuing": "1.1.0-pre.1758089377",
67
- "@verii/verii-verification": "1.1.0-pre.1758089377",
43
+ "@verii/auth": "1.1.0-pre.1758094000",
44
+ "@verii/base-contract-io": "1.1.0-pre.1758094000",
45
+ "@verii/blockchain-functions": "1.1.0-pre.1758094000",
46
+ "@verii/common-fetchers": "1.1.0-pre.1758094000",
47
+ "@verii/common-functions": "1.1.0-pre.1758094000",
48
+ "@verii/common-schemas": "1.1.0-pre.1758094000",
49
+ "@verii/config": "1.1.0-pre.1758094000",
50
+ "@verii/contract-permissions": "1.1.0-pre.1758094000",
51
+ "@verii/crypto": "1.1.0-pre.1758094000",
52
+ "@verii/csv-parser": "1.1.0-pre.1758094000",
53
+ "@verii/db-kms": "1.1.0-pre.1758094000",
54
+ "@verii/did-doc": "1.1.0-pre.1758094000",
55
+ "@verii/fastify-plugins": "1.1.0-pre.1758094000",
56
+ "@verii/http-client": "1.1.0-pre.1758094000",
57
+ "@verii/jwt": "1.1.0-pre.1758094000",
58
+ "@verii/metadata-registration": "1.1.0-pre.1758094000",
59
+ "@verii/organizations-registry": "1.1.0-pre.1758094000",
60
+ "@verii/rest-queries": "1.1.0-pre.1758094000",
61
+ "@verii/server-provider": "1.1.0-pre.1758094000",
62
+ "@verii/spencer-mongo-extensions": "1.1.0-pre.1758094000",
63
+ "@verii/test-regexes": "1.1.0-pre.1758094000",
64
+ "@verii/validation": "1.1.0-pre.1758094000",
65
+ "@verii/vc-checks": "1.1.0-pre.1758094000",
66
+ "@verii/verii-issuing": "1.1.0-pre.1758094000",
67
+ "@verii/verii-verification": "1.1.0-pre.1758094000",
68
68
  "ajv": "8.17.1",
69
69
  "canonicalize": "^2.1.0",
70
70
  "date-fns": "~3.6.0",
@@ -83,10 +83,10 @@
83
83
  },
84
84
  "devDependencies": {
85
85
  "@spencejs/spence-config": "0.10.2",
86
- "@verii/endpoints-organizations-registrar": "1.1.0-pre.1758089377",
87
- "@verii/sample-data": "1.1.0-pre.1758089377",
86
+ "@verii/endpoints-organizations-registrar": "1.1.0-pre.1758094000",
87
+ "@verii/sample-data": "1.1.0-pre.1758094000",
88
88
  "@verii/test-regexes": "0.5.0-build",
89
- "@verii/tests-helpers": "1.1.0-pre.1758089377",
89
+ "@verii/tests-helpers": "1.1.0-pre.1758094000",
90
90
  "cheerio": "1.1.2",
91
91
  "dotenv": "16.6.1",
92
92
  "eslint": "8.57.1",
@@ -107,5 +107,5 @@
107
107
  "prettier": "2.8.8",
108
108
  "qs": "6.14.0"
109
109
  },
110
- "gitHead": "5b06e1575dc6628ef2c79ee7e7567f920caaf91b"
110
+ "gitHead": "b3c64e0a7724eb54cf40c86938011dca098fa616"
111
111
  }
@@ -49,14 +49,14 @@ const crossValidateVp = (presentation, { exchange }) => {
49
49
  throw createError(400, 'Mismatched Exchange Ids', {
50
50
  exchange,
51
51
  presentationSubmission,
52
- errorCode: 'presention_mismatch_exchange',
52
+ errorCode: 'presentation_mismatch_exchange',
53
53
  });
54
54
  }
55
55
  if (exchange?.disclosureId.toString() !== disclosureId) {
56
56
  throw createError(400, 'Mismatched Disclosure Ids', {
57
57
  exchange,
58
58
  presentationSubmission,
59
- errorCode: 'presention_mismatch_disclosure',
59
+ errorCode: 'presentation_mismatch_disclosure',
60
60
  });
61
61
  }
62
62
  };
@@ -3222,7 +3222,7 @@ describe('submit identification disclosure', () => {
3222
3222
  expect(countResult).toEqual(1);
3223
3223
  });
3224
3224
 
3225
- it('should return 400 when jwt_vp verification failed', async () => {
3225
+ it('should return 400 when jwt_vp kid is invalid', async () => {
3226
3226
  const presentationIdDocument = await generateKYCPresentation(
3227
3227
  exchange,
3228
3228
  'idDocument'
@@ -3251,7 +3251,75 @@ describe('submit identification disclosure', () => {
3251
3251
  errorResponseMatcher({
3252
3252
  error: 'Bad Request',
3253
3253
  errorCode: 'presentation_malformed',
3254
- message: 'Malformed jwt_vp property: must_be_did',
3254
+ message: 'kid_must_be_did',
3255
+ statusCode: 400,
3256
+ })
3257
+ );
3258
+ });
3259
+
3260
+ it('should return 400 when jwt_vp is self signed', async () => {
3261
+ const presentationIdDocument = await generateKYCPresentation(
3262
+ exchange,
3263
+ 'idDocument'
3264
+ );
3265
+
3266
+ nock(mockVendorUrl).post(identifyUserOnVendorEndpoint).reply(200, {});
3267
+
3268
+ const response = await fastify.injectJson({
3269
+ method: 'POST',
3270
+ url: idUrl(tenant),
3271
+ headers: {
3272
+ 'x-vnf-protocol-version': `${VeriiProtocolVersions.PROTOCOL_VERSION_2}`,
3273
+ },
3274
+ payload: {
3275
+ jwt_vp: await presentationIdDocument.selfSign(),
3276
+ exchange_id: exchange._id,
3277
+ },
3278
+ });
3279
+
3280
+ expect(response.statusCode).toEqual(400);
3281
+ expect(response.json).toEqual(
3282
+ errorResponseMatcher({
3283
+ error: 'Bad Request',
3284
+ errorCode: 'presentation_malformed',
3285
+ message: 'jwt_vp must not be self signed',
3286
+ statusCode: 400,
3287
+ })
3288
+ );
3289
+ });
3290
+
3291
+ it('should return 400 when jwt_vp is different key', async () => {
3292
+ const presentationIdDocument = await generateKYCPresentation(
3293
+ exchange,
3294
+ 'idDocument'
3295
+ );
3296
+
3297
+ nock(mockVendorUrl).post(identifyUserOnVendorEndpoint).reply(200, {});
3298
+ const { privateKey: invalidKey } = generateKeyPair({ format: 'jwk' });
3299
+ const jwtVp = await presentationIdDocument.sign(
3300
+ holderKid,
3301
+ invalidKey,
3302
+ holderDid
3303
+ );
3304
+
3305
+ const response = await fastify.injectJson({
3306
+ method: 'POST',
3307
+ url: idUrl(tenant),
3308
+ headers: {
3309
+ 'x-vnf-protocol-version': `${VeriiProtocolVersions.PROTOCOL_VERSION_2}`,
3310
+ },
3311
+ payload: {
3312
+ jwt_vp: jwtVp,
3313
+ exchange_id: exchange._id,
3314
+ },
3315
+ });
3316
+
3317
+ expect(response.statusCode).toEqual(400);
3318
+ expect(response.json).toEqual(
3319
+ errorResponseMatcher({
3320
+ error: 'Bad Request',
3321
+ errorCode: 'presentation_malformed',
3322
+ message: 'Malformed jwt_vp property: signature verification failed',
3255
3323
  statusCode: 400,
3256
3324
  })
3257
3325
  );