@sd-jwt/core 0.15.2-next.1 → 0.15.2-next.10
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 +39 -39
- package/README.md +4 -4
- package/dist/index.d.mts +92 -92
- package/dist/index.d.ts +92 -92
- package/dist/index.js +232 -232
- package/dist/index.mjs +218 -218
- package/package.json +11 -12
- package/src/flattenJSON.ts +1 -1
- package/src/generalJSON.ts +1 -1
- package/src/index.ts +18 -18
- package/src/jwt.ts +2 -2
- package/src/kbjwt.ts +3 -3
- package/src/sdjwt.ts +13 -14
- package/src/test/decoy.spec.ts +3 -3
- package/src/test/generalJSON.spec.ts +2 -2
- package/src/test/index.spec.ts +8 -8
- package/src/test/jwt.spec.ts +9 -9
- package/src/test/kbjwt.spec.ts +8 -9
- package/src/test/pass.spec.ts +1 -0
- package/src/test/sdjwt.spec.ts +6 -6
- package/test/app-e2e.spec.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.15.0](https://github.com/openwallet-foundation
|
|
6
|
+
# [0.15.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.14.1...v0.15.0) (2025-08-20)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @sd-jwt/core
|
|
9
9
|
|
|
@@ -11,29 +11,29 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
## [0.14.1](https://github.com/openwallet-foundation
|
|
14
|
+
## [0.14.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.14.0...v0.14.1) (2025-08-02)
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
### Bug Fixes
|
|
18
18
|
|
|
19
|
-
* pass required options parameter ([#303](https://github.com/openwallet-foundation
|
|
19
|
+
* pass required options parameter ([#303](https://github.com/openwallet-foundation/sd-jwt-js/issues/303)) ([f3aed2d](https://github.com/openwallet-foundation/sd-jwt-js/commit/f3aed2d54fa4c365c41014c9ba65bf7dd5b7c413))
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
# [0.14.0](https://github.com/openwallet-foundation
|
|
25
|
+
# [0.14.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.13.0...v0.14.0) (2025-06-30)
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
### Features
|
|
29
29
|
|
|
30
|
-
* Add Verifier options ([#297](https://github.com/openwallet-foundation
|
|
30
|
+
* Add Verifier options ([#297](https://github.com/openwallet-foundation/sd-jwt-js/issues/297)) ([2a6a367](https://github.com/openwallet-foundation/sd-jwt-js/commit/2a6a3674f94742f48feaf660056226b1a54145e7))
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
# [0.13.0](https://github.com/openwallet-foundation
|
|
36
|
+
# [0.13.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.12.0...v0.13.0) (2025-06-25)
|
|
37
37
|
|
|
38
38
|
**Note:** Version bump only for package @sd-jwt/core
|
|
39
39
|
|
|
@@ -41,7 +41,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
# [0.12.0](https://github.com/openwallet-foundation
|
|
44
|
+
# [0.12.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.11.0...v0.12.0) (2025-06-21)
|
|
45
45
|
|
|
46
46
|
**Note:** Version bump only for package @sd-jwt/core
|
|
47
47
|
|
|
@@ -49,29 +49,29 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
# [0.11.0](https://github.com/openwallet-foundation
|
|
52
|
+
# [0.11.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.10.0...v0.11.0) (2025-06-17)
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
### Features
|
|
56
56
|
|
|
57
|
-
* SD JWT Instances VCT Metadata get separated from verify ([#285](https://github.com/openwallet-foundation
|
|
57
|
+
* SD JWT Instances VCT Metadata get separated from verify ([#285](https://github.com/openwallet-foundation/sd-jwt-js/issues/285)) ([bc91fd7](https://github.com/openwallet-foundation/sd-jwt-js/commit/bc91fd71f7d721298ad5c08d4379bc870903f65f))
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
# [0.10.0](https://github.com/openwallet-foundation
|
|
63
|
+
# [0.10.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.2...v0.10.0) (2025-03-24)
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
### Features
|
|
67
67
|
|
|
68
|
-
* fix encoding bug for flattenJSON and generalJSON ([#277](https://github.com/openwallet-foundation
|
|
68
|
+
* fix encoding bug for flattenJSON and generalJSON ([#277](https://github.com/openwallet-foundation/sd-jwt-js/issues/277)) ([cc455a6](https://github.com/openwallet-foundation/sd-jwt-js/commit/cc455a6f3d431fa59cca1d21dad49daac135d3bc))
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
## [0.9.2](https://github.com/openwallet-foundation
|
|
74
|
+
## [0.9.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.1...v0.9.2) (2025-01-29)
|
|
75
75
|
|
|
76
76
|
**Note:** Version bump only for package @sd-jwt/core
|
|
77
77
|
|
|
@@ -79,7 +79,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
## [0.9.1](https://github.com/openwallet-foundation
|
|
82
|
+
## [0.9.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.0...v0.9.1) (2024-12-13)
|
|
83
83
|
|
|
84
84
|
**Note:** Version bump only for package @sd-jwt/core
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
# [0.9.0](https://github.com/openwallet-foundation
|
|
90
|
+
# [0.9.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.8.0...v0.9.0) (2024-12-10)
|
|
91
91
|
|
|
92
92
|
**Note:** Version bump only for package @sd-jwt/core
|
|
93
93
|
|
|
@@ -95,18 +95,18 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
# [0.8.0](https://github.com/openwallet-foundation
|
|
98
|
+
# [0.8.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.2...v0.8.0) (2024-11-26)
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
### Features
|
|
102
102
|
|
|
103
|
-
* add jws serialization feature ([#253](https://github.com/openwallet-foundation
|
|
103
|
+
* add jws serialization feature ([#253](https://github.com/openwallet-foundation/sd-jwt-js/issues/253)) ([e83b494](https://github.com/openwallet-foundation/sd-jwt-js/commit/e83b4946595d043f56647e6cdc98ad34edf0acde))
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
## [0.7.2](https://github.com/openwallet-foundation
|
|
109
|
+
## [0.7.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.1...v0.7.2) (2024-07-19)
|
|
110
110
|
|
|
111
111
|
**Note:** Version bump only for package @sd-jwt/core
|
|
112
112
|
|
|
@@ -114,7 +114,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
117
|
-
## [0.7.1](https://github.com/openwallet-foundation
|
|
117
|
+
## [0.7.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.0...v0.7.1) (2024-05-21)
|
|
118
118
|
|
|
119
119
|
**Note:** Version bump only for package @sd-jwt/core
|
|
120
120
|
|
|
@@ -122,7 +122,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
# [0.7.0](https://github.com/openwallet-foundation
|
|
125
|
+
# [0.7.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.6.1...v0.7.0) (2024-05-13)
|
|
126
126
|
|
|
127
127
|
**Note:** Version bump only for package @sd-jwt/core
|
|
128
128
|
|
|
@@ -130,18 +130,18 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
|
|
133
|
-
## [0.6.1](https://github.com/openwallet-foundation
|
|
133
|
+
## [0.6.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.6.0...v0.6.1) (2024-03-18)
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
### Bug Fixes
|
|
137
137
|
|
|
138
|
-
* base64url convention ([#179](https://github.com/openwallet-foundation
|
|
138
|
+
* base64url convention ([#179](https://github.com/openwallet-foundation/sd-jwt-js/issues/179)) ([f8db275](https://github.com/openwallet-foundation/sd-jwt-js/commit/f8db275690dab88000a039838680a3478b3b61ec))
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
|
|
143
143
|
|
|
144
|
-
# [0.6.0](https://github.com/openwallet-foundation
|
|
144
|
+
# [0.6.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.5.0...v0.6.0) (2024-03-12)
|
|
145
145
|
|
|
146
146
|
**Note:** Version bump only for package @sd-jwt/core
|
|
147
147
|
|
|
@@ -149,17 +149,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
|
|
152
|
-
# [0.5.0](https://github.com/openwallet-foundation
|
|
152
|
+
# [0.5.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.4.0...v0.5.0) (2024-03-11)
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
### Bug Fixes
|
|
156
156
|
|
|
157
|
-
* validate JWT signed other implemenation ([#158](https://github.com/openwallet-foundation
|
|
157
|
+
* validate JWT signed other implemenation ([#158](https://github.com/openwallet-foundation/sd-jwt-js/issues/158)) ([a0c1ddb](https://github.com/openwallet-foundation/sd-jwt-js/commit/a0c1ddbb4c3785d03fc7302183f9c13e3c3fd955))
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
### Features
|
|
161
161
|
|
|
162
|
-
* make _digest value public in disclosure ([#151](https://github.com/openwallet-foundation
|
|
162
|
+
* make _digest value public in disclosure ([#151](https://github.com/openwallet-foundation/sd-jwt-js/issues/151)) ([7a3fbd7](https://github.com/openwallet-foundation/sd-jwt-js/commit/7a3fbd7db19b6501978340c972b171743d287285))
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
@@ -170,21 +170,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
170
170
|
|
|
171
171
|
### Bug Fixes
|
|
172
172
|
|
|
173
|
-
* add publish config ([#93](https://github.com/openwallet-foundation
|
|
174
|
-
* add the payload that is required ([6c53580](https://github.com/openwallet-foundation
|
|
175
|
-
* change SDJwtPayload to SdJwtPayload ([9f06ef7](https://github.com/openwallet-foundation
|
|
176
|
-
* convert any usage into or typed version ([#80](https://github.com/openwallet-foundation
|
|
177
|
-
* implement kbverify function ([#127](https://github.com/openwallet-foundation
|
|
178
|
-
* make sdjwt instance non abstract ([#122](https://github.com/openwallet-foundation
|
|
173
|
+
* add publish config ([#93](https://github.com/openwallet-foundation/sd-jwt-js/issues/93)) ([2e4c5c1](https://github.com/openwallet-foundation/sd-jwt-js/commit/2e4c5c176dc88e58e49d06783b7658d8ad872313))
|
|
174
|
+
* add the payload that is required ([6c53580](https://github.com/openwallet-foundation/sd-jwt-js/commit/6c53580d12e4361c40435b90628302749fa32b1c))
|
|
175
|
+
* change SDJwtPayload to SdJwtPayload ([9f06ef7](https://github.com/openwallet-foundation/sd-jwt-js/commit/9f06ef7bd31a1dff4e9bf988e425200a5e1aa82d))
|
|
176
|
+
* convert any usage into or typed version ([#80](https://github.com/openwallet-foundation/sd-jwt-js/issues/80)) ([de4df54](https://github.com/openwallet-foundation/sd-jwt-js/commit/de4df54f2a0a77fdbf97e10abac555a98e70c6e0))
|
|
177
|
+
* implement kbverify function ([#127](https://github.com/openwallet-foundation/sd-jwt-js/issues/127)) ([e5609f2](https://github.com/openwallet-foundation/sd-jwt-js/commit/e5609f26fab8c4991d3bd6c36066a95a30cfb972))
|
|
178
|
+
* make sdjwt instance non abstract ([#122](https://github.com/openwallet-foundation/sd-jwt-js/issues/122)) ([e85aae8](https://github.com/openwallet-foundation/sd-jwt-js/commit/e85aae89910f5d9468e29ef14ef3b3d3215b86fd))
|
|
179
179
|
|
|
180
180
|
|
|
181
181
|
### Features
|
|
182
182
|
|
|
183
|
-
* add jwk type ([#130](https://github.com/openwallet-foundation
|
|
184
|
-
* add new package for sd-jwt-vc ([ed99188](https://github.com/openwallet-foundation
|
|
185
|
-
* Apply lerna to move src to core ([#67](https://github.com/openwallet-foundation
|
|
186
|
-
* calcuate sd_hash in kb JWT ([#117](https://github.com/openwallet-foundation
|
|
187
|
-
* checking kb header value ([#133](https://github.com/openwallet-foundation
|
|
188
|
-
* create kb jwt when present all ([#129](https://github.com/openwallet-foundation
|
|
189
|
-
* fix async handling in jwt verify ([#131](https://github.com/openwallet-foundation
|
|
190
|
-
* fixing exclude _sd_alg when no disclosure ([#120](https://github.com/openwallet-foundation
|
|
183
|
+
* add jwk type ([#130](https://github.com/openwallet-foundation/sd-jwt-js/issues/130)) ([8ce255a](https://github.com/openwallet-foundation/sd-jwt-js/commit/8ce255a64b0940e92e647aa544bf5990b48279b7))
|
|
184
|
+
* add new package for sd-jwt-vc ([ed99188](https://github.com/openwallet-foundation/sd-jwt-js/commit/ed99188f13184d58db64b4211e39fb67f3f78cb5))
|
|
185
|
+
* Apply lerna to move src to core ([#67](https://github.com/openwallet-foundation/sd-jwt-js/issues/67)) ([49e272b](https://github.com/openwallet-foundation/sd-jwt-js/commit/49e272b6b51c5226e22732c469e566fd3c14c57c))
|
|
186
|
+
* calcuate sd_hash in kb JWT ([#117](https://github.com/openwallet-foundation/sd-jwt-js/issues/117)) ([3415550](https://github.com/openwallet-foundation/sd-jwt-js/commit/3415550fbcd99f97babff442a4928cc827c5c9cc))
|
|
187
|
+
* checking kb header value ([#133](https://github.com/openwallet-foundation/sd-jwt-js/issues/133)) ([cd2991b](https://github.com/openwallet-foundation/sd-jwt-js/commit/cd2991b88a0522e39251c5ca2b67593130baa585))
|
|
188
|
+
* create kb jwt when present all ([#129](https://github.com/openwallet-foundation/sd-jwt-js/issues/129)) ([72ed1ad](https://github.com/openwallet-foundation/sd-jwt-js/commit/72ed1ad64b850876ba3b5d5e5df6128471fb44ac))
|
|
189
|
+
* fix async handling in jwt verify ([#131](https://github.com/openwallet-foundation/sd-jwt-js/issues/131)) ([76cb930](https://github.com/openwallet-foundation/sd-jwt-js/commit/76cb93021dd62c241c87656975f74dd44b3766cf))
|
|
190
|
+
* fixing exclude _sd_alg when no disclosure ([#120](https://github.com/openwallet-foundation/sd-jwt-js/issues/120)) ([dcaf1f6](https://github.com/openwallet-foundation/sd-jwt-js/commit/dcaf1f6fad3289ea7cbe0f3f410fdc15c0f77fda))
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-

|
|
2
2
|

|
|
3
|
-

|
|
4
|
+

|
|
5
5
|
|
|
6
6
|
# SD-JWT Implementation in JavaScript (TypeScript)
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
Core library for selective disclosure JWTs
|
|
13
13
|
|
|
14
|
-
Check the detail description in our github [repo](https://github.com/openwallet-foundation
|
|
14
|
+
Check the detail description in our github [repo](https://github.com/openwallet-foundation/sd-jwt-js).
|
|
15
15
|
|
|
16
16
|
### Installation
|
|
17
17
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,96 @@
|
|
|
1
1
|
import * as _sd_jwt_types from '@sd-jwt/types';
|
|
2
|
-
import {
|
|
2
|
+
import { Signer, Base64urlString, Verifier, kbHeader, kbPayload, KbVerifier, JwtPayload, SDJWTCompact, Hasher, PresentationFrame, DisclosureFrame, HasherAndAlg, SaltGenerator, SDJWTConfig, KBOptions } from '@sd-jwt/types';
|
|
3
3
|
import { Disclosure } from '@sd-jwt/utils';
|
|
4
4
|
|
|
5
|
+
type FlattenJSONData = {
|
|
6
|
+
jwtData: {
|
|
7
|
+
protected: string;
|
|
8
|
+
payload: string;
|
|
9
|
+
signature: string;
|
|
10
|
+
};
|
|
11
|
+
disclosures: Array<string>;
|
|
12
|
+
kb_jwt?: string;
|
|
13
|
+
};
|
|
14
|
+
type FlattenJSONSerialized = {
|
|
15
|
+
payload: string;
|
|
16
|
+
signature: string;
|
|
17
|
+
protected: string;
|
|
18
|
+
header: {
|
|
19
|
+
disclosures: Array<string>;
|
|
20
|
+
kb_jwt?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare class FlattenJSON {
|
|
24
|
+
disclosures: Array<string>;
|
|
25
|
+
kb_jwt?: string;
|
|
26
|
+
payload: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
protected: string;
|
|
29
|
+
constructor(data: FlattenJSONData);
|
|
30
|
+
static fromEncode(encodedSdJwt: string): FlattenJSON;
|
|
31
|
+
static fromSerialized(json: FlattenJSONSerialized): FlattenJSON;
|
|
32
|
+
toJson(): FlattenJSONSerialized;
|
|
33
|
+
toEncoded(): string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type GeneralJSONData = {
|
|
37
|
+
payload: string;
|
|
38
|
+
disclosures: Array<string>;
|
|
39
|
+
kb_jwt?: string;
|
|
40
|
+
signatures: Array<{
|
|
41
|
+
protected: string;
|
|
42
|
+
signature: string;
|
|
43
|
+
kid?: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
type GeneralJSONSerialized = {
|
|
47
|
+
payload: string;
|
|
48
|
+
signatures: Array<{
|
|
49
|
+
header: {
|
|
50
|
+
disclosures?: Array<string>;
|
|
51
|
+
kid?: string;
|
|
52
|
+
kb_jwt?: string;
|
|
53
|
+
};
|
|
54
|
+
protected: string;
|
|
55
|
+
signature: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
declare class GeneralJSON {
|
|
59
|
+
payload: string;
|
|
60
|
+
disclosures: Array<string>;
|
|
61
|
+
kb_jwt?: string;
|
|
62
|
+
signatures: Array<{
|
|
63
|
+
protected: string;
|
|
64
|
+
signature: string;
|
|
65
|
+
kid?: string;
|
|
66
|
+
}>;
|
|
67
|
+
constructor(data: GeneralJSONData);
|
|
68
|
+
static fromEncode(encodedSdJwt: string): GeneralJSON;
|
|
69
|
+
static fromSerialized(json: GeneralJSONSerialized): GeneralJSON;
|
|
70
|
+
toJson(): {
|
|
71
|
+
payload: string;
|
|
72
|
+
signatures: ({
|
|
73
|
+
header: {
|
|
74
|
+
kid: string | undefined;
|
|
75
|
+
disclosures?: undefined;
|
|
76
|
+
kb_jwt?: undefined;
|
|
77
|
+
};
|
|
78
|
+
protected: string;
|
|
79
|
+
signature: string;
|
|
80
|
+
} | {
|
|
81
|
+
header: {
|
|
82
|
+
disclosures: string[];
|
|
83
|
+
kid: string | undefined;
|
|
84
|
+
kb_jwt: string | undefined;
|
|
85
|
+
};
|
|
86
|
+
protected: string;
|
|
87
|
+
signature: string;
|
|
88
|
+
})[];
|
|
89
|
+
};
|
|
90
|
+
toEncoded(index: number): string;
|
|
91
|
+
addSignature(protectedHeader: Record<string, unknown>, signer: Signer, kid?: string): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
|
|
5
94
|
type JwtData<Header extends Record<string, unknown>, Payload extends Record<string, unknown>> = {
|
|
6
95
|
header?: Header;
|
|
7
96
|
payload?: Payload;
|
|
@@ -102,95 +191,6 @@ declare const pack: <T extends Record<string, unknown>>(claims: T, disclosureFra
|
|
|
102
191
|
disclosures: Array<Disclosure>;
|
|
103
192
|
}>;
|
|
104
193
|
|
|
105
|
-
type FlattenJSONData = {
|
|
106
|
-
jwtData: {
|
|
107
|
-
protected: string;
|
|
108
|
-
payload: string;
|
|
109
|
-
signature: string;
|
|
110
|
-
};
|
|
111
|
-
disclosures: Array<string>;
|
|
112
|
-
kb_jwt?: string;
|
|
113
|
-
};
|
|
114
|
-
type FlattenJSONSerialized = {
|
|
115
|
-
payload: string;
|
|
116
|
-
signature: string;
|
|
117
|
-
protected: string;
|
|
118
|
-
header: {
|
|
119
|
-
disclosures: Array<string>;
|
|
120
|
-
kb_jwt?: string;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
declare class FlattenJSON {
|
|
124
|
-
disclosures: Array<string>;
|
|
125
|
-
kb_jwt?: string;
|
|
126
|
-
payload: string;
|
|
127
|
-
signature: string;
|
|
128
|
-
protected: string;
|
|
129
|
-
constructor(data: FlattenJSONData);
|
|
130
|
-
static fromEncode(encodedSdJwt: string): FlattenJSON;
|
|
131
|
-
static fromSerialized(json: FlattenJSONSerialized): FlattenJSON;
|
|
132
|
-
toJson(): FlattenJSONSerialized;
|
|
133
|
-
toEncoded(): string;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
type GeneralJSONData = {
|
|
137
|
-
payload: string;
|
|
138
|
-
disclosures: Array<string>;
|
|
139
|
-
kb_jwt?: string;
|
|
140
|
-
signatures: Array<{
|
|
141
|
-
protected: string;
|
|
142
|
-
signature: string;
|
|
143
|
-
kid?: string;
|
|
144
|
-
}>;
|
|
145
|
-
};
|
|
146
|
-
type GeneralJSONSerialized = {
|
|
147
|
-
payload: string;
|
|
148
|
-
signatures: Array<{
|
|
149
|
-
header: {
|
|
150
|
-
disclosures?: Array<string>;
|
|
151
|
-
kid?: string;
|
|
152
|
-
kb_jwt?: string;
|
|
153
|
-
};
|
|
154
|
-
protected: string;
|
|
155
|
-
signature: string;
|
|
156
|
-
}>;
|
|
157
|
-
};
|
|
158
|
-
declare class GeneralJSON {
|
|
159
|
-
payload: string;
|
|
160
|
-
disclosures: Array<string>;
|
|
161
|
-
kb_jwt?: string;
|
|
162
|
-
signatures: Array<{
|
|
163
|
-
protected: string;
|
|
164
|
-
signature: string;
|
|
165
|
-
kid?: string;
|
|
166
|
-
}>;
|
|
167
|
-
constructor(data: GeneralJSONData);
|
|
168
|
-
static fromEncode(encodedSdJwt: string): GeneralJSON;
|
|
169
|
-
static fromSerialized(json: GeneralJSONSerialized): GeneralJSON;
|
|
170
|
-
toJson(): {
|
|
171
|
-
payload: string;
|
|
172
|
-
signatures: ({
|
|
173
|
-
header: {
|
|
174
|
-
kid: string | undefined;
|
|
175
|
-
disclosures?: undefined;
|
|
176
|
-
kb_jwt?: undefined;
|
|
177
|
-
};
|
|
178
|
-
protected: string;
|
|
179
|
-
signature: string;
|
|
180
|
-
} | {
|
|
181
|
-
header: {
|
|
182
|
-
disclosures: string[];
|
|
183
|
-
kid: string | undefined;
|
|
184
|
-
kb_jwt: string | undefined;
|
|
185
|
-
};
|
|
186
|
-
protected: string;
|
|
187
|
-
signature: string;
|
|
188
|
-
})[];
|
|
189
|
-
};
|
|
190
|
-
toEncoded(index: number): string;
|
|
191
|
-
addSignature(protectedHeader: Record<string, unknown>, signer: Signer, kid?: string): Promise<void>;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
194
|
declare const createDecoy: (hash: HasherAndAlg, saltGenerator: SaltGenerator) => Promise<string>;
|
|
195
195
|
|
|
196
196
|
type SdJwtPayload = Record<string, unknown>;
|
|
@@ -210,7 +210,7 @@ declare class SDJwtInstance<ExtendedPayload extends SdJwtPayload> {
|
|
|
210
210
|
* @param disclosureFrame
|
|
211
211
|
* @returns
|
|
212
212
|
*/
|
|
213
|
-
protected validateReservedFields<T extends ExtendedPayload>(
|
|
213
|
+
protected validateReservedFields<T extends ExtendedPayload>(_disclosureFrame: DisclosureFrame<T>): void;
|
|
214
214
|
present<T extends Record<string, unknown>>(encodedSDJwt: string, presentationFrame?: PresentationFrame<T>, options?: {
|
|
215
215
|
kb?: KBOptions;
|
|
216
216
|
}): Promise<SDJWTCompact>;
|
|
@@ -267,7 +267,7 @@ declare class SDJwtGeneralJSONInstance<ExtendedPayload extends SdJwtPayload> {
|
|
|
267
267
|
* @param disclosureFrame
|
|
268
268
|
* @returns
|
|
269
269
|
*/
|
|
270
|
-
protected validateReservedFields<T extends ExtendedPayload>(
|
|
270
|
+
protected validateReservedFields<T extends ExtendedPayload>(_disclosureFrame: DisclosureFrame<T>): void;
|
|
271
271
|
present<T extends Record<string, unknown>>(generalJSON: GeneralJSON, presentationFrame?: PresentationFrame<T>, options?: {
|
|
272
272
|
kb?: KBOptions;
|
|
273
273
|
}): Promise<GeneralJSON>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,96 @@
|
|
|
1
1
|
import * as _sd_jwt_types from '@sd-jwt/types';
|
|
2
|
-
import {
|
|
2
|
+
import { Signer, Base64urlString, Verifier, kbHeader, kbPayload, KbVerifier, JwtPayload, SDJWTCompact, Hasher, PresentationFrame, DisclosureFrame, HasherAndAlg, SaltGenerator, SDJWTConfig, KBOptions } from '@sd-jwt/types';
|
|
3
3
|
import { Disclosure } from '@sd-jwt/utils';
|
|
4
4
|
|
|
5
|
+
type FlattenJSONData = {
|
|
6
|
+
jwtData: {
|
|
7
|
+
protected: string;
|
|
8
|
+
payload: string;
|
|
9
|
+
signature: string;
|
|
10
|
+
};
|
|
11
|
+
disclosures: Array<string>;
|
|
12
|
+
kb_jwt?: string;
|
|
13
|
+
};
|
|
14
|
+
type FlattenJSONSerialized = {
|
|
15
|
+
payload: string;
|
|
16
|
+
signature: string;
|
|
17
|
+
protected: string;
|
|
18
|
+
header: {
|
|
19
|
+
disclosures: Array<string>;
|
|
20
|
+
kb_jwt?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare class FlattenJSON {
|
|
24
|
+
disclosures: Array<string>;
|
|
25
|
+
kb_jwt?: string;
|
|
26
|
+
payload: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
protected: string;
|
|
29
|
+
constructor(data: FlattenJSONData);
|
|
30
|
+
static fromEncode(encodedSdJwt: string): FlattenJSON;
|
|
31
|
+
static fromSerialized(json: FlattenJSONSerialized): FlattenJSON;
|
|
32
|
+
toJson(): FlattenJSONSerialized;
|
|
33
|
+
toEncoded(): string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type GeneralJSONData = {
|
|
37
|
+
payload: string;
|
|
38
|
+
disclosures: Array<string>;
|
|
39
|
+
kb_jwt?: string;
|
|
40
|
+
signatures: Array<{
|
|
41
|
+
protected: string;
|
|
42
|
+
signature: string;
|
|
43
|
+
kid?: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
type GeneralJSONSerialized = {
|
|
47
|
+
payload: string;
|
|
48
|
+
signatures: Array<{
|
|
49
|
+
header: {
|
|
50
|
+
disclosures?: Array<string>;
|
|
51
|
+
kid?: string;
|
|
52
|
+
kb_jwt?: string;
|
|
53
|
+
};
|
|
54
|
+
protected: string;
|
|
55
|
+
signature: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
declare class GeneralJSON {
|
|
59
|
+
payload: string;
|
|
60
|
+
disclosures: Array<string>;
|
|
61
|
+
kb_jwt?: string;
|
|
62
|
+
signatures: Array<{
|
|
63
|
+
protected: string;
|
|
64
|
+
signature: string;
|
|
65
|
+
kid?: string;
|
|
66
|
+
}>;
|
|
67
|
+
constructor(data: GeneralJSONData);
|
|
68
|
+
static fromEncode(encodedSdJwt: string): GeneralJSON;
|
|
69
|
+
static fromSerialized(json: GeneralJSONSerialized): GeneralJSON;
|
|
70
|
+
toJson(): {
|
|
71
|
+
payload: string;
|
|
72
|
+
signatures: ({
|
|
73
|
+
header: {
|
|
74
|
+
kid: string | undefined;
|
|
75
|
+
disclosures?: undefined;
|
|
76
|
+
kb_jwt?: undefined;
|
|
77
|
+
};
|
|
78
|
+
protected: string;
|
|
79
|
+
signature: string;
|
|
80
|
+
} | {
|
|
81
|
+
header: {
|
|
82
|
+
disclosures: string[];
|
|
83
|
+
kid: string | undefined;
|
|
84
|
+
kb_jwt: string | undefined;
|
|
85
|
+
};
|
|
86
|
+
protected: string;
|
|
87
|
+
signature: string;
|
|
88
|
+
})[];
|
|
89
|
+
};
|
|
90
|
+
toEncoded(index: number): string;
|
|
91
|
+
addSignature(protectedHeader: Record<string, unknown>, signer: Signer, kid?: string): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
|
|
5
94
|
type JwtData<Header extends Record<string, unknown>, Payload extends Record<string, unknown>> = {
|
|
6
95
|
header?: Header;
|
|
7
96
|
payload?: Payload;
|
|
@@ -102,95 +191,6 @@ declare const pack: <T extends Record<string, unknown>>(claims: T, disclosureFra
|
|
|
102
191
|
disclosures: Array<Disclosure>;
|
|
103
192
|
}>;
|
|
104
193
|
|
|
105
|
-
type FlattenJSONData = {
|
|
106
|
-
jwtData: {
|
|
107
|
-
protected: string;
|
|
108
|
-
payload: string;
|
|
109
|
-
signature: string;
|
|
110
|
-
};
|
|
111
|
-
disclosures: Array<string>;
|
|
112
|
-
kb_jwt?: string;
|
|
113
|
-
};
|
|
114
|
-
type FlattenJSONSerialized = {
|
|
115
|
-
payload: string;
|
|
116
|
-
signature: string;
|
|
117
|
-
protected: string;
|
|
118
|
-
header: {
|
|
119
|
-
disclosures: Array<string>;
|
|
120
|
-
kb_jwt?: string;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
declare class FlattenJSON {
|
|
124
|
-
disclosures: Array<string>;
|
|
125
|
-
kb_jwt?: string;
|
|
126
|
-
payload: string;
|
|
127
|
-
signature: string;
|
|
128
|
-
protected: string;
|
|
129
|
-
constructor(data: FlattenJSONData);
|
|
130
|
-
static fromEncode(encodedSdJwt: string): FlattenJSON;
|
|
131
|
-
static fromSerialized(json: FlattenJSONSerialized): FlattenJSON;
|
|
132
|
-
toJson(): FlattenJSONSerialized;
|
|
133
|
-
toEncoded(): string;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
type GeneralJSONData = {
|
|
137
|
-
payload: string;
|
|
138
|
-
disclosures: Array<string>;
|
|
139
|
-
kb_jwt?: string;
|
|
140
|
-
signatures: Array<{
|
|
141
|
-
protected: string;
|
|
142
|
-
signature: string;
|
|
143
|
-
kid?: string;
|
|
144
|
-
}>;
|
|
145
|
-
};
|
|
146
|
-
type GeneralJSONSerialized = {
|
|
147
|
-
payload: string;
|
|
148
|
-
signatures: Array<{
|
|
149
|
-
header: {
|
|
150
|
-
disclosures?: Array<string>;
|
|
151
|
-
kid?: string;
|
|
152
|
-
kb_jwt?: string;
|
|
153
|
-
};
|
|
154
|
-
protected: string;
|
|
155
|
-
signature: string;
|
|
156
|
-
}>;
|
|
157
|
-
};
|
|
158
|
-
declare class GeneralJSON {
|
|
159
|
-
payload: string;
|
|
160
|
-
disclosures: Array<string>;
|
|
161
|
-
kb_jwt?: string;
|
|
162
|
-
signatures: Array<{
|
|
163
|
-
protected: string;
|
|
164
|
-
signature: string;
|
|
165
|
-
kid?: string;
|
|
166
|
-
}>;
|
|
167
|
-
constructor(data: GeneralJSONData);
|
|
168
|
-
static fromEncode(encodedSdJwt: string): GeneralJSON;
|
|
169
|
-
static fromSerialized(json: GeneralJSONSerialized): GeneralJSON;
|
|
170
|
-
toJson(): {
|
|
171
|
-
payload: string;
|
|
172
|
-
signatures: ({
|
|
173
|
-
header: {
|
|
174
|
-
kid: string | undefined;
|
|
175
|
-
disclosures?: undefined;
|
|
176
|
-
kb_jwt?: undefined;
|
|
177
|
-
};
|
|
178
|
-
protected: string;
|
|
179
|
-
signature: string;
|
|
180
|
-
} | {
|
|
181
|
-
header: {
|
|
182
|
-
disclosures: string[];
|
|
183
|
-
kid: string | undefined;
|
|
184
|
-
kb_jwt: string | undefined;
|
|
185
|
-
};
|
|
186
|
-
protected: string;
|
|
187
|
-
signature: string;
|
|
188
|
-
})[];
|
|
189
|
-
};
|
|
190
|
-
toEncoded(index: number): string;
|
|
191
|
-
addSignature(protectedHeader: Record<string, unknown>, signer: Signer, kid?: string): Promise<void>;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
194
|
declare const createDecoy: (hash: HasherAndAlg, saltGenerator: SaltGenerator) => Promise<string>;
|
|
195
195
|
|
|
196
196
|
type SdJwtPayload = Record<string, unknown>;
|
|
@@ -210,7 +210,7 @@ declare class SDJwtInstance<ExtendedPayload extends SdJwtPayload> {
|
|
|
210
210
|
* @param disclosureFrame
|
|
211
211
|
* @returns
|
|
212
212
|
*/
|
|
213
|
-
protected validateReservedFields<T extends ExtendedPayload>(
|
|
213
|
+
protected validateReservedFields<T extends ExtendedPayload>(_disclosureFrame: DisclosureFrame<T>): void;
|
|
214
214
|
present<T extends Record<string, unknown>>(encodedSDJwt: string, presentationFrame?: PresentationFrame<T>, options?: {
|
|
215
215
|
kb?: KBOptions;
|
|
216
216
|
}): Promise<SDJWTCompact>;
|
|
@@ -267,7 +267,7 @@ declare class SDJwtGeneralJSONInstance<ExtendedPayload extends SdJwtPayload> {
|
|
|
267
267
|
* @param disclosureFrame
|
|
268
268
|
* @returns
|
|
269
269
|
*/
|
|
270
|
-
protected validateReservedFields<T extends ExtendedPayload>(
|
|
270
|
+
protected validateReservedFields<T extends ExtendedPayload>(_disclosureFrame: DisclosureFrame<T>): void;
|
|
271
271
|
present<T extends Record<string, unknown>>(generalJSON: GeneralJSON, presentationFrame?: PresentationFrame<T>, options?: {
|
|
272
272
|
kb?: KBOptions;
|
|
273
273
|
}): Promise<GeneralJSON>;
|