@sd-jwt/sd-jwt-vc 0.3.2-next.99 → 0.4.0
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/CHANGELOG.md +17 -0
- package/package.json +5 -5
- package/test/app-e2e.spec.ts +17 -7
- package/test/array_data_types.json +10 -8
- package/test/array_full_sd.json +1 -1
- package/test/array_in_sd.json +1 -1
- package/test/array_nested_in_plain.json +10 -1
- package/test/array_none_disclosed.json +1 -1
- package/test/array_of_nulls.json +1 -1
- package/test/array_of_objects.json +8 -1
- package/test/array_of_scalars.json +5 -1
- package/test/array_recursive_sd.json +1 -1
- package/test/array_recursive_sd_some_disclosed.json +14 -6
- package/test/complex.json +1 -1
- package/test/header_mod.json +5 -1
- package/test/json_serialization.json +5 -1
- package/test/key_binding.json +5 -1
- package/test/no_sd.json +1 -1
- package/test/object_data_types.json +11 -9
- package/test/recursions.json +36 -17
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 0.4.0 (2024-03-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* change SDJwtPayload to SdJwtPayload ([9f06ef7](https://github.com/openwallet-foundation-labs/sd-jwt-js/commit/9f06ef7bd31a1dff4e9bf988e425200a5e1aa82d))
|
|
12
|
+
* make sdjwt instance non abstract ([#122](https://github.com/openwallet-foundation-labs/sd-jwt-js/issues/122)) ([e85aae8](https://github.com/openwallet-foundation-labs/sd-jwt-js/commit/e85aae89910f5d9468e29ef14ef3b3d3215b86fd))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add new package for sd-jwt-vc ([ed99188](https://github.com/openwallet-foundation-labs/sd-jwt-js/commit/ed99188f13184d58db64b4211e39fb67f3f78cb5))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/sd-jwt-vc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
},
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@sd-jwt/core": "0.
|
|
42
|
+
"@sd-jwt/core": "0.4.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@sd-jwt/crypto-nodejs": "0.
|
|
46
|
-
"@sd-jwt/types": "0.
|
|
45
|
+
"@sd-jwt/crypto-nodejs": "0.4.0",
|
|
46
|
+
"@sd-jwt/types": "0.4.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"esm"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "391a36550a66833b3d393ff0deb699b1b72cca59"
|
|
65
65
|
}
|
package/test/app-e2e.spec.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import Crypto from 'node:crypto';
|
|
2
2
|
import { SDJwtVcInstance, SdJwtVcPayload } from '../src/index';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
DisclosureFrame,
|
|
5
|
+
PresentationFrame,
|
|
6
|
+
Signer,
|
|
7
|
+
Verifier,
|
|
8
|
+
} from '@sd-jwt/types';
|
|
4
9
|
import fs from 'fs';
|
|
5
10
|
import path from 'path';
|
|
6
11
|
import { describe, expect, test } from 'vitest';
|
|
@@ -53,6 +58,9 @@ describe('App', () => {
|
|
|
53
58
|
data2: {
|
|
54
59
|
hi: 'bye',
|
|
55
60
|
},
|
|
61
|
+
iat,
|
|
62
|
+
iss,
|
|
63
|
+
vct,
|
|
56
64
|
};
|
|
57
65
|
const disclosureFrame: DisclosureFrame<typeof claims> = {
|
|
58
66
|
_sd: ['firstname', 'id', 'data2'],
|
|
@@ -72,8 +80,7 @@ describe('App', () => {
|
|
|
72
80
|
},
|
|
73
81
|
};
|
|
74
82
|
|
|
75
|
-
const
|
|
76
|
-
const encodedSdjwt = await sdjwt.issue(expectedPayload, disclosureFrame);
|
|
83
|
+
const encodedSdjwt = await sdjwt.issue(claims, disclosureFrame);
|
|
77
84
|
expect(encodedSdjwt).toBeDefined();
|
|
78
85
|
const validated = await sdjwt.validate(encodedSdjwt);
|
|
79
86
|
expect(validated).toBeDefined();
|
|
@@ -101,7 +108,7 @@ describe('App', () => {
|
|
|
101
108
|
'vct',
|
|
102
109
|
]);
|
|
103
110
|
const payloads = await decoded.getClaims(digest);
|
|
104
|
-
expect(payloads).toEqual(
|
|
111
|
+
expect(payloads).toEqual(claims);
|
|
105
112
|
const presentableKeys = await decoded.presentableKeys(digest);
|
|
106
113
|
expect(presentableKeys).toEqual([
|
|
107
114
|
'data.list',
|
|
@@ -114,7 +121,10 @@ describe('App', () => {
|
|
|
114
121
|
'id',
|
|
115
122
|
]);
|
|
116
123
|
|
|
117
|
-
const presentationFrame =
|
|
124
|
+
const presentationFrame = {
|
|
125
|
+
firstname: true,
|
|
126
|
+
id: true,
|
|
127
|
+
};
|
|
118
128
|
const presentedSDJwt = await sdjwt.present(encodedSdjwt, presentationFrame);
|
|
119
129
|
expect(presentedSDJwt).toBeDefined();
|
|
120
130
|
|
|
@@ -228,7 +238,7 @@ async function JSONtest(filename: string) {
|
|
|
228
238
|
|
|
229
239
|
const presentedSDJwt = await sdjwt.present(
|
|
230
240
|
encodedSdjwt,
|
|
231
|
-
test.
|
|
241
|
+
test.presentationFrames,
|
|
232
242
|
);
|
|
233
243
|
|
|
234
244
|
expect(presentedSDJwt).toBeDefined();
|
|
@@ -254,7 +264,7 @@ async function JSONtest(filename: string) {
|
|
|
254
264
|
type TestJson = {
|
|
255
265
|
claims: object;
|
|
256
266
|
disclosureFrame: DisclosureFrame<object>;
|
|
257
|
-
|
|
267
|
+
presentationFrames: PresentationFrame<object>;
|
|
258
268
|
presenatedClaims: object;
|
|
259
269
|
requiredClaimKeys: string[];
|
|
260
270
|
};
|
|
@@ -7,14 +7,16 @@
|
|
|
7
7
|
"_sd": [0, 1, 2, 3, 4, 5]
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
|
-
"
|
|
11
|
-
"data_types
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
"presentationFrames": {
|
|
11
|
+
"data_types": {
|
|
12
|
+
"0": true,
|
|
13
|
+
"1": true,
|
|
14
|
+
"2": true,
|
|
15
|
+
"3": true,
|
|
16
|
+
"4": true,
|
|
17
|
+
"5": true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
18
20
|
"presenatedClaims": {
|
|
19
21
|
"data_types": [null, 42, 3.14, "foo", ["Test"], { "foo": "bar" }]
|
|
20
22
|
},
|
package/test/array_full_sd.json
CHANGED
package/test/array_in_sd.json
CHANGED
|
@@ -12,7 +12,16 @@
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"
|
|
15
|
+
"presentationFrames": {
|
|
16
|
+
"nested_array": {
|
|
17
|
+
"0": {
|
|
18
|
+
"0": true
|
|
19
|
+
},
|
|
20
|
+
"1": {
|
|
21
|
+
"1": true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
16
25
|
"presenatedClaims": {
|
|
17
26
|
"nested_array": [["foo"], ["qux"]]
|
|
18
27
|
},
|
package/test/array_of_nulls.json
CHANGED
|
@@ -28,7 +28,14 @@
|
|
|
28
28
|
"_sd": ["foo"]
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
"
|
|
31
|
+
"presentationFrames": {
|
|
32
|
+
"addresses": {
|
|
33
|
+
"1": true
|
|
34
|
+
},
|
|
35
|
+
"array_with_one_sd_object": {
|
|
36
|
+
"foo": true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
32
39
|
"presenatedClaims": {
|
|
33
40
|
"addresses": [
|
|
34
41
|
{
|
|
@@ -25,12 +25,20 @@
|
|
|
25
25
|
"_sd": [0, 1]
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
"
|
|
29
|
-
"array_with_recursive_sd
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
"presentationFrames": {
|
|
29
|
+
"array_with_recursive_sd": {
|
|
30
|
+
"1": {
|
|
31
|
+
"baz": true
|
|
32
|
+
},
|
|
33
|
+
"2": {
|
|
34
|
+
"1": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"test2": {
|
|
38
|
+
"0": true,
|
|
39
|
+
"1": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
34
42
|
"presenatedClaims": {
|
|
35
43
|
"array_with_recursive_sd": [
|
|
36
44
|
"boring",
|
package/test/complex.json
CHANGED
package/test/header_mod.json
CHANGED
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
"birthdate"
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
|
-
"
|
|
27
|
+
"presentationFrames": {
|
|
28
|
+
"given_name": true,
|
|
29
|
+
"family_name": true,
|
|
30
|
+
"address": true
|
|
31
|
+
},
|
|
28
32
|
"presenatedClaims": {
|
|
29
33
|
"given_name": "John",
|
|
30
34
|
"family_name": "Deo",
|
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
"birthdate"
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
|
-
"
|
|
27
|
+
"presentationFrames": {
|
|
28
|
+
"given_name": true,
|
|
29
|
+
"family_name": true,
|
|
30
|
+
"address": true
|
|
31
|
+
},
|
|
28
32
|
"presenatedClaims": {
|
|
29
33
|
"given_name": "John",
|
|
30
34
|
"family_name": "Deo",
|
package/test/key_binding.json
CHANGED
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
"birthdate"
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
|
-
"
|
|
27
|
+
"presentationFrames": {
|
|
28
|
+
"given_name": true,
|
|
29
|
+
"family_name": true,
|
|
30
|
+
"address": true
|
|
31
|
+
},
|
|
28
32
|
"presenatedClaims": {
|
|
29
33
|
"given_name": "John",
|
|
30
34
|
"family_name": "Deo",
|
package/test/no_sd.json
CHANGED
|
@@ -25,15 +25,17 @@
|
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
"
|
|
29
|
-
"value_Data_types
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
"presentationFrames": {
|
|
29
|
+
"value_Data_types": {
|
|
30
|
+
"test_null": true,
|
|
31
|
+
"test_int": true,
|
|
32
|
+
"test_float": true,
|
|
33
|
+
"test_str": true,
|
|
34
|
+
"test_bool": true,
|
|
35
|
+
"test_arr": true,
|
|
36
|
+
"test_object": true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
37
39
|
"presenatedClaims": {
|
|
38
40
|
"value_Data_types": {
|
|
39
41
|
"test_null": null,
|
package/test/recursions.json
CHANGED
|
@@ -50,23 +50,42 @@
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"
|
|
54
|
-
"foo
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
"presentationFrames": {
|
|
54
|
+
"foo": {
|
|
55
|
+
"1": true
|
|
56
|
+
},
|
|
57
|
+
"bar": {
|
|
58
|
+
"green": true
|
|
59
|
+
},
|
|
60
|
+
"qux": {
|
|
61
|
+
"0": {
|
|
62
|
+
"0": true,
|
|
63
|
+
"1": true
|
|
64
|
+
},
|
|
65
|
+
"1": {
|
|
66
|
+
"0": true,
|
|
67
|
+
"1": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"baz": {
|
|
71
|
+
"0": {
|
|
72
|
+
"0": true,
|
|
73
|
+
"1": true
|
|
74
|
+
},
|
|
75
|
+
"1": {
|
|
76
|
+
"0": true,
|
|
77
|
+
"1": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"animals": {
|
|
81
|
+
"snake": {
|
|
82
|
+
"age": true
|
|
83
|
+
},
|
|
84
|
+
"bird": {
|
|
85
|
+
"age": true
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
70
89
|
"presenatedClaims": {
|
|
71
90
|
"foo": ["two"],
|
|
72
91
|
"bar": {
|