@sd-jwt/core 0.2.1 → 2.0.2-next.26
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/LICENSE +201 -0
- package/dist/index.d.mts +106 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +606 -0
- package/dist/index.mjs +586 -0
- package/package.json +60 -48
- package/src/decoy.ts +15 -0
- package/src/index.ts +235 -0
- package/src/jwt.ts +107 -0
- package/src/kbjwt.ts +45 -0
- package/src/sdjwt.ts +318 -0
- package/src/test/decoy.spec.ts +30 -0
- package/src/test/index.spec.ts +379 -0
- package/src/test/jwt.spec.ts +141 -0
- package/src/test/kbjwt.spec.ts +275 -0
- package/src/test/pass.spec.ts +6 -0
- package/src/test/sdjwt.spec.ts +382 -0
- package/test/app-e2e.spec.ts +248 -0
- package/test/array_data_types.json +29 -0
- package/test/array_full_sd.json +21 -0
- package/test/array_in_sd.json +13 -0
- package/test/array_nested_in_plain.json +20 -0
- package/test/array_none_disclosed.json +17 -0
- package/test/array_of_nulls.json +15 -0
- package/test/array_of_objects.json +58 -0
- package/test/array_of_scalars.json +15 -0
- package/test/array_recursive_sd.json +35 -0
- package/test/array_recursive_sd_some_disclosed.json +55 -0
- package/test/complex.json +43 -0
- package/test/header_mod.json +44 -0
- package/test/json_serialization.json +44 -0
- package/test/key_binding.json +44 -0
- package/test/no_sd.json +36 -0
- package/test/object_data_types.json +60 -0
- package/test/recursions.json +98 -0
- package/tsconfig.json +7 -0
- package/vitest.config.mts +4 -0
- package/README.md +0 -97
- package/build/base64url.d.ts +0 -28
- package/build/base64url.js +0 -40
- package/build/base64url.js.map +0 -1
- package/build/hasherAlgorithm.d.ts +0 -70
- package/build/hasherAlgorithm.js +0 -75
- package/build/hasherAlgorithm.js.map +0 -1
- package/build/index.d.ts +0 -13
- package/build/index.js +0 -20
- package/build/index.js.map +0 -1
- package/build/jwt/compact.d.ts +0 -6
- package/build/jwt/compact.js +0 -27
- package/build/jwt/compact.js.map +0 -1
- package/build/jwt/error.d.ts +0 -2
- package/build/jwt/error.js +0 -7
- package/build/jwt/error.js.map +0 -1
- package/build/jwt/index.d.ts +0 -2
- package/build/jwt/index.js +0 -19
- package/build/jwt/index.js.map +0 -1
- package/build/jwt/jwt.d.ts +0 -208
- package/build/jwt/jwt.js +0 -325
- package/build/jwt/jwt.js.map +0 -1
- package/build/keyBinding/index.d.ts +0 -1
- package/build/keyBinding/index.js +0 -18
- package/build/keyBinding/index.js.map +0 -1
- package/build/keyBinding/keyBinding.d.ts +0 -64
- package/build/keyBinding/keyBinding.js +0 -119
- package/build/keyBinding/keyBinding.js.map +0 -1
- package/build/sdJwt/compact.d.ts +0 -8
- package/build/sdJwt/compact.js +0 -39
- package/build/sdJwt/compact.js.map +0 -1
- package/build/sdJwt/decoys.d.ts +0 -3
- package/build/sdJwt/decoys.js +0 -35
- package/build/sdJwt/decoys.js.map +0 -1
- package/build/sdJwt/disclosureFrame.d.ts +0 -8
- package/build/sdJwt/disclosureFrame.js +0 -87
- package/build/sdJwt/disclosureFrame.js.map +0 -1
- package/build/sdJwt/disclosureMapping.d.ts +0 -43
- package/build/sdJwt/disclosureMapping.js +0 -278
- package/build/sdJwt/disclosureMapping.js.map +0 -1
- package/build/sdJwt/disclosures.d.ts +0 -33
- package/build/sdJwt/disclosures.js +0 -114
- package/build/sdJwt/disclosures.js.map +0 -1
- package/build/sdJwt/error.d.ts +0 -2
- package/build/sdJwt/error.js +0 -7
- package/build/sdJwt/error.js.map +0 -1
- package/build/sdJwt/index.d.ts +0 -6
- package/build/sdJwt/index.js +0 -23
- package/build/sdJwt/index.js.map +0 -1
- package/build/sdJwt/presentationFrame.d.ts +0 -3
- package/build/sdJwt/presentationFrame.js +0 -64
- package/build/sdJwt/presentationFrame.js.map +0 -1
- package/build/sdJwt/sdJwt.d.ts +0 -206
- package/build/sdJwt/sdJwt.js +0 -442
- package/build/sdJwt/sdJwt.js.map +0 -1
- package/build/sdJwt/swapClaim.d.ts +0 -2
- package/build/sdJwt/swapClaim.js +0 -79
- package/build/sdJwt/swapClaim.js.map +0 -1
- package/build/sdJwt/types.d.ts +0 -5
- package/build/sdJwt/types.js +0 -3
- package/build/sdJwt/types.js.map +0 -1
- package/build/sdJwtVc/error.d.ts +0 -2
- package/build/sdJwtVc/error.js +0 -7
- package/build/sdJwtVc/error.js.map +0 -1
- package/build/sdJwtVc/index.d.ts +0 -2
- package/build/sdJwtVc/index.js +0 -19
- package/build/sdJwtVc/index.js.map +0 -1
- package/build/sdJwtVc/sdJwtVc.d.ts +0 -47
- package/build/sdJwtVc/sdJwtVc.js +0 -149
- package/build/sdJwtVc/sdJwtVc.js.map +0 -1
- package/build/signatureAndEncryptionAlgorithm.d.ts +0 -105
- package/build/signatureAndEncryptionAlgorithm.js +0 -110
- package/build/signatureAndEncryptionAlgorithm.js.map +0 -1
- package/build/types/disclosure.d.ts +0 -5
- package/build/types/disclosure.js +0 -3
- package/build/types/disclosure.js.map +0 -1
- package/build/types/frame.d.ts +0 -5
- package/build/types/frame.js +0 -3
- package/build/types/frame.js.map +0 -1
- package/build/types/hasher.d.ts +0 -14
- package/build/types/hasher.js +0 -3
- package/build/types/hasher.js.map +0 -1
- package/build/types/index.d.ts +0 -5
- package/build/types/index.js +0 -22
- package/build/types/index.js.map +0 -1
- package/build/types/present.d.ts +0 -2
- package/build/types/present.js +0 -3
- package/build/types/present.js.map +0 -1
- package/build/types/saltGenerator.d.ts +0 -17
- package/build/types/saltGenerator.js +0 -3
- package/build/types/saltGenerator.js.map +0 -1
- package/build/types/signer.d.ts +0 -2
- package/build/types/signer.js +0 -3
- package/build/types/signer.js.map +0 -1
- package/build/types/utils.d.ts +0 -2
- package/build/types/utils.js +0 -3
- package/build/types/utils.js.map +0 -1
- package/build/types/verifier.d.ts +0 -14
- package/build/types/verifier.js +0 -3
- package/build/types/verifier.js.map +0 -1
- package/build/utils/index.d.ts +0 -2
- package/build/utils/index.js +0 -19
- package/build/utils/index.js.map +0 -1
- package/build/utils/traverse.d.ts +0 -8
- package/build/utils/traverse.js +0 -29
- package/build/utils/traverse.js.map +0 -1
- package/build/utils/utils.d.ts +0 -8
- package/build/utils/utils.js +0 -118
- package/build/utils/utils.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"is_over": {
|
|
4
|
+
"13": false,
|
|
5
|
+
"18": true,
|
|
6
|
+
"21": false
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"disclosureFrame": {
|
|
10
|
+
"is_over": {
|
|
11
|
+
"_sd": ["13", "18", "21"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"presentationKeys": [],
|
|
15
|
+
"presenatedClaims": {},
|
|
16
|
+
"requiredClaimKeys": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"null_values": [null, null, null, null]
|
|
4
|
+
},
|
|
5
|
+
"disclosureFrame": {
|
|
6
|
+
"null_values": {
|
|
7
|
+
"_sd": [1, 2]
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"presentationKeys": [],
|
|
11
|
+
"presenatedClaims": {
|
|
12
|
+
"null_values": [null, null]
|
|
13
|
+
},
|
|
14
|
+
"requiredClaimKeys": ["null_values.0", "null_values.1"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"addresses": [
|
|
4
|
+
{
|
|
5
|
+
"street": "123 Main St",
|
|
6
|
+
"city": "Anytown",
|
|
7
|
+
"state": "NY",
|
|
8
|
+
"zip": "12345",
|
|
9
|
+
"type": "main_address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"street": "456 Main St",
|
|
13
|
+
"city": "Anytown",
|
|
14
|
+
"state": "NY",
|
|
15
|
+
"zip": "12345",
|
|
16
|
+
"type": "secondary_address"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"array_with_one_sd_object": {
|
|
20
|
+
"foo": "bar"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"disclosureFrame": {
|
|
24
|
+
"addresses": {
|
|
25
|
+
"_sd": [1]
|
|
26
|
+
},
|
|
27
|
+
"array_with_one_sd_object": {
|
|
28
|
+
"_sd": ["foo"]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"presentationKeys": ["addresses.1", "array_with_one_sd_object.foo"],
|
|
32
|
+
"presenatedClaims": {
|
|
33
|
+
"addresses": [
|
|
34
|
+
{
|
|
35
|
+
"street": "123 Main St",
|
|
36
|
+
"city": "Anytown",
|
|
37
|
+
"state": "NY",
|
|
38
|
+
"zip": "12345",
|
|
39
|
+
"type": "main_address"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"street": "456 Main St",
|
|
43
|
+
"city": "Anytown",
|
|
44
|
+
"state": "NY",
|
|
45
|
+
"zip": "12345",
|
|
46
|
+
"type": "secondary_address"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"array_with_one_sd_object": {
|
|
50
|
+
"foo": "bar"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"requiredClaimKeys": [
|
|
54
|
+
"addresses.0.type",
|
|
55
|
+
"addresses.1.city",
|
|
56
|
+
"array_with_one_sd_object.foo"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"nationalities": ["US", "CA", "DE"]
|
|
4
|
+
},
|
|
5
|
+
"disclosureFrame": {
|
|
6
|
+
"nationalities": {
|
|
7
|
+
"_sd": [0, 1]
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"presentationKeys": ["nationalities.1"],
|
|
11
|
+
"presenatedClaims": {
|
|
12
|
+
"nationalities": ["CA", "DE"]
|
|
13
|
+
},
|
|
14
|
+
"requiredClaimKeys": ["nationalities.0", "nationalities.1"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"array_with_recursive_sd": [
|
|
4
|
+
"boring",
|
|
5
|
+
{
|
|
6
|
+
"foo": "bar",
|
|
7
|
+
"baz": {
|
|
8
|
+
"qux": "quxx"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
["foo", "bar"]
|
|
12
|
+
],
|
|
13
|
+
"test2": ["foo", "bar"]
|
|
14
|
+
},
|
|
15
|
+
"disclosureFrame": {
|
|
16
|
+
"array_with_recursive_sd": {
|
|
17
|
+
"_sd": [1],
|
|
18
|
+
"1": {
|
|
19
|
+
"_sd": ["baz"]
|
|
20
|
+
},
|
|
21
|
+
"2": {
|
|
22
|
+
"_sd": [0, 1]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"test2": {
|
|
26
|
+
"_sd": [0, 1]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"presentationKeys": [],
|
|
30
|
+
"presenatedClaims": {
|
|
31
|
+
"array_with_recursive_sd": ["boring", []],
|
|
32
|
+
"test2": []
|
|
33
|
+
},
|
|
34
|
+
"requiredClaimKeys": ["array_with_recursive_sd.0", "test2"]
|
|
35
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"array_with_recursive_sd": [
|
|
4
|
+
"boring",
|
|
5
|
+
{
|
|
6
|
+
"foo": "bar",
|
|
7
|
+
"baz": {
|
|
8
|
+
"qux": "quxx"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
["foo", "bar"]
|
|
12
|
+
],
|
|
13
|
+
"test2": ["foo", "bar"]
|
|
14
|
+
},
|
|
15
|
+
"disclosureFrame": {
|
|
16
|
+
"array_with_recursive_sd": {
|
|
17
|
+
"1": {
|
|
18
|
+
"_sd": ["baz"]
|
|
19
|
+
},
|
|
20
|
+
"2": {
|
|
21
|
+
"_sd": [0, 1]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"test2": {
|
|
25
|
+
"_sd": [0, 1]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"presentationKeys": [
|
|
29
|
+
"array_with_recursive_sd.1.baz",
|
|
30
|
+
"array_with_recursive_sd.2.1",
|
|
31
|
+
"test2.0",
|
|
32
|
+
"test2.1"
|
|
33
|
+
],
|
|
34
|
+
"presenatedClaims": {
|
|
35
|
+
"array_with_recursive_sd": [
|
|
36
|
+
"boring",
|
|
37
|
+
{
|
|
38
|
+
"foo": "bar",
|
|
39
|
+
"baz": {
|
|
40
|
+
"qux": "quxx"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
["bar"]
|
|
44
|
+
],
|
|
45
|
+
"test2": ["foo", "bar"]
|
|
46
|
+
},
|
|
47
|
+
"requiredClaimKeys": [
|
|
48
|
+
"array_with_recursive_sd.1",
|
|
49
|
+
"array_with_recursive_sd.2",
|
|
50
|
+
"array_with_recursive_sd.1.baz",
|
|
51
|
+
"array_with_recursive_sd.2.1",
|
|
52
|
+
"test2.0",
|
|
53
|
+
"test2.1"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"firstname": "John",
|
|
4
|
+
"lastname": "Doe",
|
|
5
|
+
"ssn": "123-45-6789",
|
|
6
|
+
"id": "1234",
|
|
7
|
+
"data": {
|
|
8
|
+
"firstname": "John",
|
|
9
|
+
"lastname": "Doe",
|
|
10
|
+
"ssn": "123-45-6789",
|
|
11
|
+
"list": [{ "r": "1" }, "b", "c"]
|
|
12
|
+
},
|
|
13
|
+
"data2": {
|
|
14
|
+
"hi": "bye"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"disclosureFrame": {
|
|
18
|
+
"_sd": ["firstname", "id", "data2"],
|
|
19
|
+
"data": {
|
|
20
|
+
"_sd": ["list"],
|
|
21
|
+
"_sd_decoy": 2,
|
|
22
|
+
"list": {
|
|
23
|
+
"_sd": [0, 2],
|
|
24
|
+
"_sd_decoy": 1,
|
|
25
|
+
"0": {
|
|
26
|
+
"_sd": ["r"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"data2": {
|
|
31
|
+
"_sd": ["hi"]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"presentationKeys": ["firstname", "id"],
|
|
35
|
+
"presenatedClaims": {
|
|
36
|
+
"lastname": "Doe",
|
|
37
|
+
"ssn": "123-45-6789",
|
|
38
|
+
"data": { "firstname": "John", "lastname": "Doe", "ssn": "123-45-6789" },
|
|
39
|
+
"id": "1234",
|
|
40
|
+
"firstname": "John"
|
|
41
|
+
},
|
|
42
|
+
"requiredClaimKeys": ["firstname", "id", "data.ssn"]
|
|
43
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"sub": "john_deo_42",
|
|
4
|
+
"given_name": "John",
|
|
5
|
+
"family_name": "Deo",
|
|
6
|
+
"email": "johndeo@example.com",
|
|
7
|
+
"phone": "+1-202-555-0101",
|
|
8
|
+
"address": {
|
|
9
|
+
"street_address": "123 Main St",
|
|
10
|
+
"locality": "Anytown",
|
|
11
|
+
"region": "Anystate",
|
|
12
|
+
"country": "US"
|
|
13
|
+
},
|
|
14
|
+
"birthdate": "1940-01-01"
|
|
15
|
+
},
|
|
16
|
+
"disclosureFrame": {
|
|
17
|
+
"_sd": [
|
|
18
|
+
"sub",
|
|
19
|
+
"given_name",
|
|
20
|
+
"family_name",
|
|
21
|
+
"email",
|
|
22
|
+
"phone",
|
|
23
|
+
"address",
|
|
24
|
+
"birthdate"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"presentationKeys": ["given_name", "family_name", "address"],
|
|
28
|
+
"presenatedClaims": {
|
|
29
|
+
"given_name": "John",
|
|
30
|
+
"family_name": "Deo",
|
|
31
|
+
"address": {
|
|
32
|
+
"street_address": "123 Main St",
|
|
33
|
+
"locality": "Anytown",
|
|
34
|
+
"region": "Anystate",
|
|
35
|
+
"country": "US"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"requiredClaimKeys": [
|
|
39
|
+
"given_name",
|
|
40
|
+
"family_name",
|
|
41
|
+
"address.street_address",
|
|
42
|
+
"address.country"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"sub": "john_deo_42",
|
|
4
|
+
"given_name": "John",
|
|
5
|
+
"family_name": "Deo",
|
|
6
|
+
"email": "johndeo@example.com",
|
|
7
|
+
"phone": "+1-202-555-0101",
|
|
8
|
+
"address": {
|
|
9
|
+
"street_address": "123 Main St",
|
|
10
|
+
"locality": "Anytown",
|
|
11
|
+
"region": "Anystate",
|
|
12
|
+
"country": "US"
|
|
13
|
+
},
|
|
14
|
+
"birthdate": "1940-01-01"
|
|
15
|
+
},
|
|
16
|
+
"disclosureFrame": {
|
|
17
|
+
"_sd": [
|
|
18
|
+
"sub",
|
|
19
|
+
"given_name",
|
|
20
|
+
"family_name",
|
|
21
|
+
"email",
|
|
22
|
+
"phone",
|
|
23
|
+
"address",
|
|
24
|
+
"birthdate"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"presentationKeys": ["given_name", "family_name", "address"],
|
|
28
|
+
"presenatedClaims": {
|
|
29
|
+
"given_name": "John",
|
|
30
|
+
"family_name": "Deo",
|
|
31
|
+
"address": {
|
|
32
|
+
"street_address": "123 Main St",
|
|
33
|
+
"locality": "Anytown",
|
|
34
|
+
"region": "Anystate",
|
|
35
|
+
"country": "US"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"requiredClaimKeys": [
|
|
39
|
+
"given_name",
|
|
40
|
+
"family_name",
|
|
41
|
+
"address.street_address",
|
|
42
|
+
"address.country"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"sub": "john_deo_42",
|
|
4
|
+
"given_name": "John",
|
|
5
|
+
"family_name": "Deo",
|
|
6
|
+
"email": "johndeo@example.com",
|
|
7
|
+
"phone": "+1-202-555-0101",
|
|
8
|
+
"address": {
|
|
9
|
+
"street_address": "123 Main St",
|
|
10
|
+
"locality": "Anytown",
|
|
11
|
+
"region": "Anystate",
|
|
12
|
+
"country": "US"
|
|
13
|
+
},
|
|
14
|
+
"birthdate": "1940-01-01"
|
|
15
|
+
},
|
|
16
|
+
"disclosureFrame": {
|
|
17
|
+
"_sd": [
|
|
18
|
+
"sub",
|
|
19
|
+
"given_name",
|
|
20
|
+
"family_name",
|
|
21
|
+
"email",
|
|
22
|
+
"phone",
|
|
23
|
+
"address",
|
|
24
|
+
"birthdate"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"presentationKeys": ["given_name", "family_name", "address"],
|
|
28
|
+
"presenatedClaims": {
|
|
29
|
+
"given_name": "John",
|
|
30
|
+
"family_name": "Deo",
|
|
31
|
+
"address": {
|
|
32
|
+
"street_address": "123 Main St",
|
|
33
|
+
"locality": "Anytown",
|
|
34
|
+
"region": "Anystate",
|
|
35
|
+
"country": "US"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"requiredClaimKeys": [
|
|
39
|
+
"given_name",
|
|
40
|
+
"family_name",
|
|
41
|
+
"address.street_address",
|
|
42
|
+
"address.country"
|
|
43
|
+
]
|
|
44
|
+
}
|
package/test/no_sd.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"recursive": [
|
|
4
|
+
"boring",
|
|
5
|
+
{
|
|
6
|
+
"foo": "bar",
|
|
7
|
+
"baz": {
|
|
8
|
+
"qux": "quxx"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
["foo", "bar"]
|
|
12
|
+
],
|
|
13
|
+
"test2": ["foo", "bar"]
|
|
14
|
+
},
|
|
15
|
+
"disclosureFrame": {},
|
|
16
|
+
"presentationKeys": [],
|
|
17
|
+
"presenatedClaims": {
|
|
18
|
+
"recursive": [
|
|
19
|
+
"boring",
|
|
20
|
+
{
|
|
21
|
+
"foo": "bar",
|
|
22
|
+
"baz": {
|
|
23
|
+
"qux": "quxx"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
["foo", "bar"]
|
|
27
|
+
],
|
|
28
|
+
"test2": ["foo", "bar"]
|
|
29
|
+
},
|
|
30
|
+
"requiredClaimKeys": [
|
|
31
|
+
"recursive.0",
|
|
32
|
+
"recursive.1.baz.qux",
|
|
33
|
+
"recursive.2.1",
|
|
34
|
+
"test2.1"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"value_Data_types": {
|
|
4
|
+
"test_null": null,
|
|
5
|
+
"test_int": 42,
|
|
6
|
+
"test_float": 3.14,
|
|
7
|
+
"test_str": "foo",
|
|
8
|
+
"test_bool": true,
|
|
9
|
+
"test_arr": ["Test"],
|
|
10
|
+
"test_object": {
|
|
11
|
+
"foo": "bar"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"disclosureFrame": {
|
|
16
|
+
"value_Data_types": {
|
|
17
|
+
"_sd": [
|
|
18
|
+
"test_null",
|
|
19
|
+
"test_int",
|
|
20
|
+
"test_float",
|
|
21
|
+
"test_str",
|
|
22
|
+
"test_bool",
|
|
23
|
+
"test_arr",
|
|
24
|
+
"test_object"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"presentationKeys": [
|
|
29
|
+
"value_Data_types.test_null",
|
|
30
|
+
"value_Data_types.test_int",
|
|
31
|
+
"value_Data_types.test_float",
|
|
32
|
+
"value_Data_types.test_str",
|
|
33
|
+
"value_Data_types.test_bool",
|
|
34
|
+
"value_Data_types.test_arr",
|
|
35
|
+
"value_Data_types.test_object"
|
|
36
|
+
],
|
|
37
|
+
"presenatedClaims": {
|
|
38
|
+
"value_Data_types": {
|
|
39
|
+
"test_null": null,
|
|
40
|
+
"test_int": 42,
|
|
41
|
+
"test_float": 3.14,
|
|
42
|
+
"test_str": "foo",
|
|
43
|
+
"test_bool": true,
|
|
44
|
+
"test_arr": ["Test"],
|
|
45
|
+
"test_object": {
|
|
46
|
+
"foo": "bar"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"requiredClaimKeys": [
|
|
51
|
+
"value_Data_types.test_null",
|
|
52
|
+
"value_Data_types.test_int",
|
|
53
|
+
"value_Data_types.test_float",
|
|
54
|
+
"value_Data_types.test_str",
|
|
55
|
+
"value_Data_types.test_bool",
|
|
56
|
+
"value_Data_types.test_arr",
|
|
57
|
+
"value_Data_types.test_object",
|
|
58
|
+
"value_Data_types.test_object.foo"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claims": {
|
|
3
|
+
"foo": ["one", "two"],
|
|
4
|
+
"bar": {
|
|
5
|
+
"red": 1,
|
|
6
|
+
"green": 2
|
|
7
|
+
},
|
|
8
|
+
"qux": [["blue", "yellow"]],
|
|
9
|
+
"baz": [["orange", "purple"], ["black", "white"]],
|
|
10
|
+
"animals": {
|
|
11
|
+
"snake": {
|
|
12
|
+
"name": "python",
|
|
13
|
+
"age": 10
|
|
14
|
+
},
|
|
15
|
+
"bird": {
|
|
16
|
+
"name": "eagle",
|
|
17
|
+
"age": 20
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"disclosureFrame": {
|
|
22
|
+
"foo": {
|
|
23
|
+
"_sd": [0, 1]
|
|
24
|
+
},
|
|
25
|
+
"bar": {
|
|
26
|
+
"_sd": ["red", "green"]
|
|
27
|
+
},
|
|
28
|
+
"qux": {
|
|
29
|
+
"_sd": [0],
|
|
30
|
+
"0": {
|
|
31
|
+
"_sd": [0, 1]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"baz": {
|
|
35
|
+
"_sd": [0, 1],
|
|
36
|
+
"0": {
|
|
37
|
+
"_sd": [0, 1]
|
|
38
|
+
},
|
|
39
|
+
"1": {
|
|
40
|
+
"_sd": [0, 1]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"animals": {
|
|
44
|
+
"_sd": ["snake", "bird"],
|
|
45
|
+
"snake": {
|
|
46
|
+
"_sd": ["name", "age"]
|
|
47
|
+
},
|
|
48
|
+
"bird": {
|
|
49
|
+
"_sd": ["name", "age"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"presentationKeys": [
|
|
54
|
+
"foo.1",
|
|
55
|
+
"bar.green",
|
|
56
|
+
"qux.0",
|
|
57
|
+
"qux.0.0",
|
|
58
|
+
"qux.0.1",
|
|
59
|
+
"baz.0",
|
|
60
|
+
"baz.0.0",
|
|
61
|
+
"baz.0.1",
|
|
62
|
+
"baz.1",
|
|
63
|
+
"baz.1.0",
|
|
64
|
+
"baz.1.1",
|
|
65
|
+
"animals.snake",
|
|
66
|
+
"animals.snake.age",
|
|
67
|
+
"animals.bird",
|
|
68
|
+
"animals.bird.age"
|
|
69
|
+
],
|
|
70
|
+
"presenatedClaims": {
|
|
71
|
+
"foo": ["two"],
|
|
72
|
+
"bar": {
|
|
73
|
+
"green": 2
|
|
74
|
+
},
|
|
75
|
+
"qux": [["blue", "yellow"]],
|
|
76
|
+
"baz": [["orange", "purple"], ["black", "white"]],
|
|
77
|
+
"animals": {
|
|
78
|
+
"snake": {
|
|
79
|
+
"age": 10
|
|
80
|
+
},
|
|
81
|
+
"bird": {
|
|
82
|
+
"age": 20
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"requiredClaimKeys": [
|
|
87
|
+
"foo.1",
|
|
88
|
+
"bar.green",
|
|
89
|
+
"qux.0.0",
|
|
90
|
+
"qux.0.1",
|
|
91
|
+
"baz.0.0",
|
|
92
|
+
"baz.0.1",
|
|
93
|
+
"baz.1.0",
|
|
94
|
+
"baz.1.1",
|
|
95
|
+
"animals.snake.age",
|
|
96
|
+
"animals.bird.age"
|
|
97
|
+
]
|
|
98
|
+
}
|
package/tsconfig.json
ADDED
package/README.md
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Selective Disclosure JWT (SD-JWT) Draft 06 & Selective Disclosure JWT VC 01
|
|
2
|
-
|
|
3
|
-
## Compliant with
|
|
4
|
-
|
|
5
|
-
- [sd-jwt
|
|
6
|
-
06](https://datatracker.ietf.org/doc/draft-ietf-oauth-selective-disclosure-jwt/06/)
|
|
7
|
-
- [sd-jwt-vc
|
|
8
|
-
01](https://datatracker.ietf.org/doc/draft-ietf-oauth-sd-jwt-vc/01/)
|
|
9
|
-
|
|
10
|
-
## Design decisions
|
|
11
|
-
|
|
12
|
-
### Bring your own crypto
|
|
13
|
-
|
|
14
|
-
This library does not provide any of the cryptographic primitives required for
|
|
15
|
-
encryption, decryption, signing, verification and hashing. It is expected that
|
|
16
|
-
the user of this library provides this. The main reason for this is that most
|
|
17
|
-
libraries have their own library and KMS. Providing private keys to this
|
|
18
|
-
library adds another layer of insecurity which should be avoided. Hashing has
|
|
19
|
-
not been added for platform compatibility between node,js, browser and React
|
|
20
|
-
Native. In the future a platform-independent sha2-256 may be provided.
|
|
21
|
-
|
|
22
|
-
### Specification backwards compatibility
|
|
23
|
-
|
|
24
|
-
Since these specifications are in early drafts, no time will be spend in
|
|
25
|
-
supporting earlier versions of the specifications. This library may work for
|
|
26
|
-
older versions, e.g. the addition of selectively disclosable items in an array
|
|
27
|
-
does not break previous implementations. Once a non-draft specification is
|
|
28
|
-
released it will stay up-to-date with that version.
|
|
29
|
-
|
|
30
|
-
### Dependencies
|
|
31
|
-
|
|
32
|
-
This library only has one dependency on `buffer` which makes sure this library
|
|
33
|
-
works in Node.js, the browser and React Native. Buffer is used internally for
|
|
34
|
-
`base64-url-no-pad` encoding.
|
|
35
|
-
|
|
36
|
-
### Usage
|
|
37
|
-
|
|
38
|
-
I'd highly recommend to check out the [examples folder](example) to see how
|
|
39
|
-
this library can be leveraged.
|
|
40
|
-
|
|
41
|
-
### Issuance API
|
|
42
|
-
|
|
43
|
-
The issuance API takes an object called a `disclosureFrame`. This
|
|
44
|
-
`disclosureFrame` is a Boolean Map of the payload which allows you to specify
|
|
45
|
-
which attributes of the payload may be selectively disclosed. If an attribute is not provided in the `disclosureFrame`, it will be included in the clear-text payload. For example:
|
|
46
|
-
|
|
47
|
-
```jsonc
|
|
48
|
-
// The payload
|
|
49
|
-
{
|
|
50
|
-
"iss": "https://example.org/issuer",
|
|
51
|
-
"is_age_over_21": true,
|
|
52
|
-
"is_age_over_24": true,
|
|
53
|
-
"is_age_over_65": false,
|
|
54
|
-
"date_of_birth": "1990-01-01",
|
|
55
|
-
"address": {
|
|
56
|
-
"street": "some street",
|
|
57
|
-
"house_number": 200,
|
|
58
|
-
"zipcode": "2344GH"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
```jsonc
|
|
64
|
-
// The disclosure frame
|
|
65
|
-
{
|
|
66
|
-
"is_age_over_21": true,
|
|
67
|
-
"is_age_over_24": true,
|
|
68
|
-
"is_age_over_65": true,
|
|
69
|
-
"date_of_birth": true,
|
|
70
|
-
"address": {
|
|
71
|
-
"street": true,
|
|
72
|
-
"house_number": true,
|
|
73
|
-
"zipcode": true
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// or to only disclose the address as a group
|
|
78
|
-
{
|
|
79
|
-
"is_age_over_21": true,
|
|
80
|
-
"is_age_over_24": true,
|
|
81
|
-
"is_age_over_65": true,
|
|
82
|
-
"date_of_birth": true,
|
|
83
|
-
"address": true
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Presentation and verification API
|
|
88
|
-
|
|
89
|
-
Since there is officially standardized way to request and present a
|
|
90
|
-
presentation, [High Assurance Interoperability
|
|
91
|
-
Profile](https://vcstuff.github.io/oid4vc-haip-sd-jwt-vc/draft-oid4vc-haip-sd-jwt-vc.html)
|
|
92
|
-
may be used, the API is defined in a way which works in a primitive manner for
|
|
93
|
-
now. For example, to present you can provide a list of indices of the
|
|
94
|
-
disclosures which will be included. Examples of this can be found in the
|
|
95
|
-
[examples folder](example). For verification a list of keys or required
|
|
96
|
-
claims can be provided. It does not matter whether these are selectively
|
|
97
|
-
disclosable claims, or if they are included inside the payload.
|