@sd-jwt/core 0.17.2-next.1 → 0.17.2-next.3

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": "@sd-jwt/core",
3
- "version": "0.17.2-next.1+9e8110d",
3
+ "version": "0.17.2-next.3+8d5a743",
4
4
  "description": "sd-jwt draft 7 implementation in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "license": "Apache-2.0",
39
39
  "devDependencies": {
40
- "@sd-jwt/crypto-nodejs": "0.17.2-next.1+9e8110d"
40
+ "@sd-jwt/crypto-nodejs": "0.17.2-next.3+8d5a743"
41
41
  },
42
42
  "dependencies": {
43
- "@sd-jwt/decode": "0.17.2-next.1+9e8110d",
44
- "@sd-jwt/present": "0.17.2-next.1+9e8110d",
45
- "@sd-jwt/types": "0.17.2-next.1+9e8110d",
46
- "@sd-jwt/utils": "0.17.2-next.1+9e8110d"
43
+ "@sd-jwt/decode": "0.17.2-next.3+8d5a743",
44
+ "@sd-jwt/present": "0.17.2-next.3+8d5a743",
45
+ "@sd-jwt/types": "0.17.2-next.3+8d5a743",
46
+ "@sd-jwt/utils": "0.17.2-next.3+8d5a743"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
@@ -61,5 +61,5 @@
61
61
  "esm"
62
62
  ]
63
63
  },
64
- "gitHead": "9e8110d18a7af714d9eb4aa2c3bd66ce56bf18d9"
64
+ "gitHead": "8d5a743f1ff5ae51adea37509b5c24a6c09ede8a"
65
65
  }
@@ -59,7 +59,7 @@ describe('index', () => {
59
59
 
60
60
  expect(credential).toBeDefined();
61
61
 
62
- const presentation = await sdjwt.present<typeof claims>(
62
+ const presentation = await sdjwt.present(
63
63
  credential,
64
64
  { foo: true },
65
65
  {
@@ -173,7 +173,7 @@ describe('index', () => {
173
173
  },
174
174
  );
175
175
 
176
- const presentation = await sdjwt.present<typeof claims>(
176
+ const presentation = await sdjwt.present(
177
177
  credential,
178
178
  { foo: true },
179
179
  {
@@ -249,7 +249,7 @@ describe('index', () => {
249
249
  },
250
250
  );
251
251
 
252
- const presentation = await sdjwt.present<typeof claims>(
252
+ const presentation = await sdjwt.present(
253
253
  credential,
254
254
  { foo: true },
255
255
  {
@@ -263,7 +263,9 @@ describe('index', () => {
263
263
  },
264
264
  );
265
265
 
266
- const results = await sdjwt.verify(presentation, ['foo'], true);
266
+ const results = await sdjwt.verify(presentation, {
267
+ requiredClaimKeys: ['foo'],
268
+ });
267
269
  expect(results).toBeDefined();
268
270
  });
269
271
 
@@ -359,7 +361,7 @@ describe('index', () => {
359
361
  },
360
362
  );
361
363
 
362
- const presentation = await sdjwt.present<typeof claims>(
364
+ const presentation = await sdjwt.present(
363
365
  credential,
364
366
  { foo: true },
365
367
  {
@@ -403,7 +405,7 @@ describe('index', () => {
403
405
  },
404
406
  );
405
407
  try {
406
- await sdjwt.present<typeof claims>(
408
+ await sdjwt.present(
407
409
  credential,
408
410
  { foo: true },
409
411
  {
@@ -445,7 +447,7 @@ describe('index', () => {
445
447
  },
446
448
  );
447
449
 
448
- const presentation = await sdjwt.present<typeof claims>(
450
+ const presentation = await sdjwt.present(
449
451
  credential,
450
452
  { foo: true },
451
453
  {
@@ -488,7 +490,7 @@ describe('index', () => {
488
490
  },
489
491
  );
490
492
 
491
- const presentation = sdjwt.present<typeof claims>(
493
+ const presentation = sdjwt.present(
492
494
  credential,
493
495
  { foo: true },
494
496
  {
@@ -501,7 +503,7 @@ describe('index', () => {
501
503
  },
502
504
  },
503
505
  );
504
- expect(presentation).rejects.toThrow(
506
+ await expect(presentation).rejects.toThrow(
505
507
  'Key Binding sign algorithm not specified',
506
508
  );
507
509
  });
@@ -526,13 +528,13 @@ describe('index', () => {
526
528
  },
527
529
  );
528
530
  const sdjwt = new SDJwtInstance<SdJwtPayload>({});
529
- expect(sdjwt.keys('')).rejects.toThrow('Hasher not found');
530
- expect(sdjwt.presentableKeys('')).rejects.toThrow('Hasher not found');
531
- expect(sdjwt.getClaims('')).rejects.toThrow('Hasher not found');
531
+ await expect(sdjwt.keys('')).rejects.toThrow('Hasher not found');
532
+ await expect(sdjwt.presentableKeys('')).rejects.toThrow('Hasher not found');
533
+ await expect(sdjwt.getClaims('')).rejects.toThrow('Hasher not found');
532
534
  expect(() => sdjwt.decode('')).toThrowError('Hasher not found');
533
- expect(
534
- sdjwt.present<typeof claims>(credential, { foo: true }),
535
- ).rejects.toThrow('Hasher not found');
535
+ await expect(sdjwt.present(credential, { foo: true })).rejects.toThrow(
536
+ 'Hasher not found',
537
+ );
536
538
  });
537
539
 
538
540
  test('presentableKeys', async () => {
@@ -581,19 +583,15 @@ describe('index', () => {
581
583
  },
582
584
  );
583
585
 
584
- const presentation = await sdjwt.present<typeof claims>(
585
- credential,
586
- undefined,
587
- {
588
- kb: {
589
- payload: {
590
- aud: '1',
591
- iat: 1,
592
- nonce: '342',
593
- },
586
+ const presentation = await sdjwt.present(credential, undefined, {
587
+ kb: {
588
+ payload: {
589
+ aud: '1',
590
+ iat: 1,
591
+ nonce: '342',
594
592
  },
595
593
  },
596
- );
594
+ });
597
595
 
598
596
  const decoded = await sdjwt.decode(presentation);
599
597
  expect(decoded.jwt).toBeDefined();
@@ -131,7 +131,7 @@ describe('App', () => {
131
131
  });
132
132
 
133
133
  const requiredClaimKeys = ['firstname', 'id', 'data.ssn'];
134
- const verified = await sdjwt.verify(encodedSdjwt, requiredClaimKeys);
134
+ const verified = await sdjwt.verify(encodedSdjwt, { requiredClaimKeys });
135
135
  expect(verified).toBeDefined();
136
136
  });
137
137
 
@@ -233,9 +233,11 @@ async function JSONtest(filename: string) {
233
233
 
234
234
  const presentationClaims = await sdjwt.getClaims(presentedSDJwt);
235
235
 
236
- expect(presentationClaims).toEqual(test.presenatedClaims);
236
+ expect(presentationClaims).toEqual(test.presentedClaims);
237
237
 
238
- const verified = await sdjwt.verify(encodedSdjwt, test.requiredClaimKeys);
238
+ const verified = await sdjwt.verify(encodedSdjwt, {
239
+ requiredClaimKeys: test.requiredClaimKeys,
240
+ });
239
241
 
240
242
  expect(verified).toBeDefined();
241
243
  expect(verified).toStrictEqual({
@@ -248,7 +250,7 @@ type TestJson = {
248
250
  claims: SdJwtPayload;
249
251
  disclosureFrame: DisclosureFrame<SdJwtPayload>;
250
252
  presentationFrames: PresentationFrame<SdJwtPayload>;
251
- presenatedClaims: object;
253
+ presentedClaims: object;
252
254
  requiredClaimKeys: string[];
253
255
  };
254
256
 
@@ -17,7 +17,7 @@
17
17
  "5": true
18
18
  }
19
19
  },
20
- "presenatedClaims": {
20
+ "presentedClaims": {
21
21
  "data_types": [null, 42, 3.14, "foo", ["Test"], { "foo": "bar" }]
22
22
  },
23
23
  "requiredClaimKeys": [
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "presentationFrames": { "is_over": { "18": true } },
15
- "presenatedClaims": {
15
+ "presentedClaims": {
16
16
  "is_over": {
17
17
  "18": false
18
18
  }
@@ -6,7 +6,7 @@
6
6
  "_sd": ["sd_array"]
7
7
  },
8
8
  "presentationFrames": { "sd_array": true },
9
- "presenatedClaims": {
9
+ "presentedClaims": {
10
10
  "sd_array": ["32", "23"]
11
11
  },
12
12
  "requiredClaimKeys": ["sd_array"]
@@ -22,7 +22,7 @@
22
22
  }
23
23
  }
24
24
  },
25
- "presenatedClaims": {
25
+ "presentedClaims": {
26
26
  "nested_array": [["foo"], ["qux"]]
27
27
  },
28
28
  "requiredClaimKeys": ["nested_array.0.0", "nested_array.1.0"]
@@ -12,6 +12,6 @@
12
12
  }
13
13
  },
14
14
  "presentationFrames": {},
15
- "presenatedClaims": {},
15
+ "presentedClaims": {},
16
16
  "requiredClaimKeys": []
17
17
  }
@@ -8,7 +8,7 @@
8
8
  }
9
9
  },
10
10
  "presentationFrames": {},
11
- "presenatedClaims": {
11
+ "presentedClaims": {
12
12
  "null_values": [null, null]
13
13
  },
14
14
  "requiredClaimKeys": ["null_values.0", "null_values.1"]
@@ -36,7 +36,7 @@
36
36
  "foo": true
37
37
  }
38
38
  },
39
- "presenatedClaims": {
39
+ "presentedClaims": {
40
40
  "addresses": [
41
41
  {
42
42
  "street": "123 Main St",
@@ -12,7 +12,7 @@
12
12
  "1": true
13
13
  }
14
14
  },
15
- "presenatedClaims": {
15
+ "presentedClaims": {
16
16
  "nationalities": ["CA", "DE"]
17
17
  },
18
18
  "requiredClaimKeys": ["nationalities.0", "nationalities.1"]
@@ -27,7 +27,7 @@
27
27
  }
28
28
  },
29
29
  "presentationFrames": {},
30
- "presenatedClaims": {
30
+ "presentedClaims": {
31
31
  "array_with_recursive_sd": ["boring", []],
32
32
  "test2": []
33
33
  },
@@ -39,7 +39,7 @@
39
39
  "1": true
40
40
  }
41
41
  },
42
- "presenatedClaims": {
42
+ "presentedClaims": {
43
43
  "array_with_recursive_sd": [
44
44
  "boring",
45
45
  {
package/test/complex.json CHANGED
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  "presentationFrames": { "firstname": true, "id": true },
35
- "presenatedClaims": {
35
+ "presentedClaims": {
36
36
  "lastname": "Doe",
37
37
  "ssn": "123-45-6789",
38
38
  "data": { "firstname": "John", "lastname": "Doe", "ssn": "123-45-6789" },
@@ -29,7 +29,7 @@
29
29
  "family_name": true,
30
30
  "address": true
31
31
  },
32
- "presenatedClaims": {
32
+ "presentedClaims": {
33
33
  "given_name": "John",
34
34
  "family_name": "Deo",
35
35
  "address": {
@@ -29,7 +29,7 @@
29
29
  "family_name": true,
30
30
  "address": true
31
31
  },
32
- "presenatedClaims": {
32
+ "presentedClaims": {
33
33
  "given_name": "John",
34
34
  "family_name": "Deo",
35
35
  "address": {
@@ -29,7 +29,7 @@
29
29
  "family_name": true,
30
30
  "address": true
31
31
  },
32
- "presenatedClaims": {
32
+ "presentedClaims": {
33
33
  "given_name": "John",
34
34
  "family_name": "Deo",
35
35
  "address": {
package/test/no_sd.json CHANGED
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "disclosureFrame": {},
16
16
  "presentationFrames": {},
17
- "presenatedClaims": {
17
+ "presentedClaims": {
18
18
  "recursive": [
19
19
  "boring",
20
20
  {
@@ -36,7 +36,7 @@
36
36
  "test_object": true
37
37
  }
38
38
  },
39
- "presenatedClaims": {
39
+ "presentedClaims": {
40
40
  "value_Data_types": {
41
41
  "test_null": null,
42
42
  "test_int": 42,
@@ -86,7 +86,7 @@
86
86
  }
87
87
  }
88
88
  },
89
- "presenatedClaims": {
89
+ "presentedClaims": {
90
90
  "foo": ["two"],
91
91
  "bar": {
92
92
  "green": 2