@sd-jwt/core 0.17.2-next.2 → 0.17.2-next.4
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 +7 -7
- package/src/test/index.spec.ts +24 -26
- package/test/app-e2e.spec.ts +6 -4
- package/test/array_data_types.json +1 -1
- package/test/array_full_sd.json +1 -1
- package/test/array_in_sd.json +1 -1
- package/test/array_nested_in_plain.json +1 -1
- package/test/array_none_disclosed.json +1 -1
- package/test/array_of_nulls.json +1 -1
- package/test/array_of_objects.json +1 -1
- package/test/array_of_scalars.json +1 -1
- package/test/array_recursive_sd.json +1 -1
- package/test/array_recursive_sd_some_disclosed.json +1 -1
- package/test/complex.json +1 -1
- package/test/header_mod.json +1 -1
- package/test/json_serialization.json +1 -1
- package/test/key_binding.json +1 -1
- package/test/no_sd.json +1 -1
- package/test/object_data_types.json +1 -1
- package/test/recursions.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/core",
|
|
3
|
-
"version": "0.17.2-next.
|
|
3
|
+
"version": "0.17.2-next.4+213de7e",
|
|
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.
|
|
40
|
+
"@sd-jwt/crypto-nodejs": "0.17.2-next.4+213de7e"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@sd-jwt/decode": "0.17.2-next.
|
|
44
|
-
"@sd-jwt/present": "0.17.2-next.
|
|
45
|
-
"@sd-jwt/types": "0.17.2-next.
|
|
46
|
-
"@sd-jwt/utils": "0.17.2-next.
|
|
43
|
+
"@sd-jwt/decode": "0.17.2-next.4+213de7e",
|
|
44
|
+
"@sd-jwt/present": "0.17.2-next.4+213de7e",
|
|
45
|
+
"@sd-jwt/types": "0.17.2-next.4+213de7e",
|
|
46
|
+
"@sd-jwt/utils": "0.17.2-next.4+213de7e"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"esm"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "213de7e85b9820ca638ba3362fe4deee808e236e"
|
|
65
65
|
}
|
package/src/test/index.spec.ts
CHANGED
|
@@ -59,7 +59,7 @@ describe('index', () => {
|
|
|
59
59
|
|
|
60
60
|
expect(credential).toBeDefined();
|
|
61
61
|
|
|
62
|
-
const presentation = await sdjwt.present
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
535
|
-
)
|
|
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
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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();
|
package/test/app-e2e.spec.ts
CHANGED
|
@@ -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.
|
|
236
|
+
expect(presentationClaims).toEqual(test.presentedClaims);
|
|
237
237
|
|
|
238
|
-
const verified = await sdjwt.verify(encodedSdjwt,
|
|
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
|
-
|
|
253
|
+
presentedClaims: object;
|
|
252
254
|
requiredClaimKeys: string[];
|
|
253
255
|
};
|
|
254
256
|
|
package/test/array_full_sd.json
CHANGED
package/test/array_in_sd.json
CHANGED
package/test/array_of_nulls.json
CHANGED
package/test/complex.json
CHANGED
package/test/header_mod.json
CHANGED
package/test/key_binding.json
CHANGED
package/test/no_sd.json
CHANGED