@sd-jwt/sd-jwt-vc 0.18.1-next.1 → 0.18.1
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 +11 -0
- package/dist/index.d.mts +133 -29
- package/dist/index.d.ts +133 -29
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/package.json +7 -7
- package/src/sd-jwt-vc-type-metadata-format.ts +9 -9
- package/src/test/vct.spec.ts +37 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.18.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.18.0...v0.18.1) (2026-01-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* keep custom properties on type metadata ([#357](https://github.com/openwallet-foundation/sd-jwt-js/issues/357)) ([2b1f0ba](https://github.com/openwallet-foundation/sd-jwt-js/commit/2b1f0badd7fcc4096e12c38dae227f0ed9d30ec3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.18.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.17.1...v0.18.0) (2026-01-11)
|
|
7
18
|
|
|
8
19
|
|
package/dist/index.d.mts
CHANGED
|
@@ -6,23 +6,32 @@ import { SdJwtPayload, SDJwtInstance, VerifierOptions } from '@sd-jwt/core';
|
|
|
6
6
|
* Logo metadata used in rendering a credential.
|
|
7
7
|
*/
|
|
8
8
|
declare const LogoSchema: z.ZodObject<{
|
|
9
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
9
10
|
uri: z.ZodString;
|
|
11
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
10
12
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
13
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
11
14
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, z.core.$
|
|
15
|
+
}, z.core.$loose>;
|
|
13
16
|
type Logo = z.infer<typeof LogoSchema>;
|
|
14
17
|
/**
|
|
15
18
|
* The simple rendering method is intended for applications that do not support SVG.
|
|
16
19
|
*/
|
|
17
20
|
declare const SimpleRenderingSchema: z.ZodObject<{
|
|
21
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
18
22
|
logo: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
19
24
|
uri: z.ZodString;
|
|
25
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
20
26
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
27
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
21
28
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
22
|
-
}, z.core.$
|
|
29
|
+
}, z.core.$loose>>;
|
|
30
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
23
31
|
background_color: z.ZodOptional<z.ZodString>;
|
|
32
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
24
33
|
text_color: z.ZodOptional<z.ZodString>;
|
|
25
|
-
}, z.core.$
|
|
34
|
+
}, z.core.$loose>;
|
|
26
35
|
type SimpleRendering = z.infer<typeof SimpleRenderingSchema>;
|
|
27
36
|
/** Enum of valid values for rendering orientation. */
|
|
28
37
|
declare const OrientationSchema: z.ZodEnum<{
|
|
@@ -43,112 +52,153 @@ declare const ContrastSchema: z.ZodEnum<{
|
|
|
43
52
|
* Properties that describe the display preferences for an SVG template rendering.
|
|
44
53
|
*/
|
|
45
54
|
declare const SvgTemplatePropertiesSchema: z.ZodObject<{
|
|
55
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
46
56
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
47
57
|
portrait: "portrait";
|
|
48
58
|
landscape: "landscape";
|
|
49
59
|
}>>;
|
|
60
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
50
61
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
51
62
|
light: "light";
|
|
52
63
|
dark: "dark";
|
|
53
64
|
}>>;
|
|
65
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
54
66
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
55
67
|
normal: "normal";
|
|
56
68
|
high: "high";
|
|
57
69
|
}>>;
|
|
58
|
-
}, z.core.$
|
|
70
|
+
}, z.core.$loose>;
|
|
59
71
|
type SvgTemplateProperties = z.infer<typeof SvgTemplatePropertiesSchema>;
|
|
60
72
|
/**
|
|
61
73
|
* SVG rendering metadata containing URI and optional integrity and properties.
|
|
62
74
|
*/
|
|
63
75
|
declare const SvgTemplateRenderingSchema: z.ZodObject<{
|
|
76
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
64
77
|
uri: z.ZodString;
|
|
78
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
65
79
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
80
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
66
81
|
properties: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
67
83
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
68
84
|
portrait: "portrait";
|
|
69
85
|
landscape: "landscape";
|
|
70
86
|
}>>;
|
|
87
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
71
88
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
72
89
|
light: "light";
|
|
73
90
|
dark: "dark";
|
|
74
91
|
}>>;
|
|
92
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
75
93
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
76
94
|
normal: "normal";
|
|
77
95
|
high: "high";
|
|
78
96
|
}>>;
|
|
79
|
-
}, z.core.$
|
|
80
|
-
}, z.core.$
|
|
97
|
+
}, z.core.$loose>>;
|
|
98
|
+
}, z.core.$loose>;
|
|
81
99
|
type SvgTemplateRendering = z.infer<typeof SvgTemplateRenderingSchema>;
|
|
82
100
|
/**
|
|
83
101
|
* Rendering metadata, either simple or SVG-based, for a credential.
|
|
84
102
|
*/
|
|
85
103
|
declare const RenderingSchema: z.ZodObject<{
|
|
104
|
+
/** OPTIONAL. Simple rendering metadata. */
|
|
86
105
|
simple: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
87
107
|
logo: z.ZodOptional<z.ZodObject<{
|
|
108
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
88
109
|
uri: z.ZodString;
|
|
110
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
89
111
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
112
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
90
113
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
91
|
-
}, z.core.$
|
|
114
|
+
}, z.core.$loose>>;
|
|
115
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
92
116
|
background_color: z.ZodOptional<z.ZodString>;
|
|
117
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
93
118
|
text_color: z.ZodOptional<z.ZodString>;
|
|
94
|
-
}, z.core.$
|
|
119
|
+
}, z.core.$loose>>;
|
|
120
|
+
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
95
121
|
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
122
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
96
123
|
uri: z.ZodString;
|
|
124
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
97
125
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
126
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
98
127
|
properties: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
99
129
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
100
130
|
portrait: "portrait";
|
|
101
131
|
landscape: "landscape";
|
|
102
132
|
}>>;
|
|
133
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
103
134
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
104
135
|
light: "light";
|
|
105
136
|
dark: "dark";
|
|
106
137
|
}>>;
|
|
138
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
107
139
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
108
140
|
normal: "normal";
|
|
109
141
|
high: "high";
|
|
110
142
|
}>>;
|
|
111
|
-
}, z.core.$
|
|
112
|
-
}, z.core.$
|
|
113
|
-
}, z.core.$
|
|
143
|
+
}, z.core.$loose>>;
|
|
144
|
+
}, z.core.$loose>>>;
|
|
145
|
+
}, z.core.$loose>;
|
|
114
146
|
type Rendering = z.infer<typeof RenderingSchema>;
|
|
115
147
|
/**
|
|
116
148
|
* Display metadata associated with a credential type.
|
|
117
149
|
*/
|
|
118
150
|
declare const DisplaySchema: z.ZodObject<{
|
|
151
|
+
/** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
|
|
119
152
|
lang: z.ZodString;
|
|
153
|
+
/** REQUIRED. Human-readable name for the credential type. */
|
|
120
154
|
name: z.ZodString;
|
|
155
|
+
/** OPTIONAL. Description of the credential type for end users. */
|
|
121
156
|
description: z.ZodOptional<z.ZodString>;
|
|
157
|
+
/** OPTIONAL. Rendering information (simple or SVG) for the credential. */
|
|
122
158
|
rendering: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
/** OPTIONAL. Simple rendering metadata. */
|
|
123
160
|
simple: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
124
162
|
logo: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
125
164
|
uri: z.ZodString;
|
|
165
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
126
166
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
167
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
127
168
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
128
|
-
}, z.core.$
|
|
169
|
+
}, z.core.$loose>>;
|
|
170
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
129
171
|
background_color: z.ZodOptional<z.ZodString>;
|
|
172
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
130
173
|
text_color: z.ZodOptional<z.ZodString>;
|
|
131
|
-
}, z.core.$
|
|
174
|
+
}, z.core.$loose>>;
|
|
175
|
+
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
132
176
|
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
133
178
|
uri: z.ZodString;
|
|
179
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
134
180
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
181
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
135
182
|
properties: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
136
184
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
137
185
|
portrait: "portrait";
|
|
138
186
|
landscape: "landscape";
|
|
139
187
|
}>>;
|
|
188
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
140
189
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
141
190
|
light: "light";
|
|
142
191
|
dark: "dark";
|
|
143
192
|
}>>;
|
|
193
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
144
194
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
145
195
|
normal: "normal";
|
|
146
196
|
high: "high";
|
|
147
197
|
}>>;
|
|
148
|
-
}, z.core.$
|
|
149
|
-
}, z.core.$
|
|
150
|
-
}, z.core.$
|
|
151
|
-
}, z.core.$
|
|
198
|
+
}, z.core.$loose>>;
|
|
199
|
+
}, z.core.$loose>>>;
|
|
200
|
+
}, z.core.$loose>>;
|
|
201
|
+
}, z.core.$loose>;
|
|
152
202
|
type Display = z.infer<typeof DisplaySchema>;
|
|
153
203
|
/**
|
|
154
204
|
* Claim path within the credential's JSON structure.
|
|
@@ -160,10 +210,13 @@ type ClaimPath = z.infer<typeof ClaimPathSchema>;
|
|
|
160
210
|
* Display metadata for a specific claim.
|
|
161
211
|
*/
|
|
162
212
|
declare const ClaimDisplaySchema: z.ZodObject<{
|
|
213
|
+
/** REQUIRED. Language tag according to RFC 5646. */
|
|
163
214
|
lang: z.ZodString;
|
|
215
|
+
/** REQUIRED. Human-readable label for the claim. */
|
|
164
216
|
label: z.ZodString;
|
|
217
|
+
/** OPTIONAL. Description of the claim for end users. */
|
|
165
218
|
description: z.ZodOptional<z.ZodString>;
|
|
166
|
-
}, z.core.$
|
|
219
|
+
}, z.core.$loose>;
|
|
167
220
|
type ClaimDisplay = z.infer<typeof ClaimDisplaySchema>;
|
|
168
221
|
/**
|
|
169
222
|
* Indicates whether a claim is selectively disclosable.
|
|
@@ -178,79 +231,130 @@ type ClaimSelectiveDisclosure = z.infer<typeof ClaimSelectiveDisclosureSchema>;
|
|
|
178
231
|
* Metadata for individual claims in the credential type.
|
|
179
232
|
*/
|
|
180
233
|
declare const ClaimSchema: z.ZodObject<{
|
|
234
|
+
/**
|
|
235
|
+
* REQUIRED. Array of one or more paths to the claim in the credential subject.
|
|
236
|
+
* Each path is an array of strings (or null for array elements).
|
|
237
|
+
*/
|
|
181
238
|
path: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
239
|
+
/** OPTIONAL. Display metadata in multiple languages. */
|
|
182
240
|
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
241
|
+
/** REQUIRED. Language tag according to RFC 5646. */
|
|
183
242
|
lang: z.ZodString;
|
|
243
|
+
/** REQUIRED. Human-readable label for the claim. */
|
|
184
244
|
label: z.ZodString;
|
|
245
|
+
/** OPTIONAL. Description of the claim for end users. */
|
|
185
246
|
description: z.ZodOptional<z.ZodString>;
|
|
186
|
-
}, z.core.$
|
|
247
|
+
}, z.core.$loose>>>;
|
|
248
|
+
/** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
|
|
187
249
|
sd: z.ZodOptional<z.ZodEnum<{
|
|
188
250
|
never: "never";
|
|
189
251
|
always: "always";
|
|
190
252
|
allowed: "allowed";
|
|
191
253
|
}>>;
|
|
254
|
+
/**
|
|
255
|
+
* OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
|
|
256
|
+
* Must consist of alphanumeric characters or underscores and must not start with a digit.
|
|
257
|
+
*/
|
|
192
258
|
svg_id: z.ZodOptional<z.ZodString>;
|
|
193
|
-
}, z.core.$
|
|
259
|
+
}, z.core.$loose>;
|
|
194
260
|
type Claim = z.infer<typeof ClaimSchema>;
|
|
195
261
|
/**
|
|
196
262
|
* Type metadata for a specific Verifiable Credential (VC) type.
|
|
197
263
|
* Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
|
|
198
264
|
*/
|
|
199
265
|
declare const TypeMetadataFormatSchema: z.ZodObject<{
|
|
266
|
+
/** REQUIRED. A URI uniquely identifying the credential type. */
|
|
200
267
|
vct: z.ZodString;
|
|
268
|
+
/** OPTIONAL. Human-readable name for developers. */
|
|
201
269
|
name: z.ZodOptional<z.ZodString>;
|
|
270
|
+
/** OPTIONAL. Human-readable description for developers. */
|
|
202
271
|
description: z.ZodOptional<z.ZodString>;
|
|
272
|
+
/** OPTIONAL. URI of another type that this one extends. */
|
|
203
273
|
extends: z.ZodOptional<z.ZodString>;
|
|
274
|
+
/** OPTIONAL. Integrity metadata for the 'extends' field. */
|
|
204
275
|
'extends#integrity': z.ZodOptional<z.ZodString>;
|
|
276
|
+
/** OPTIONAL. Array of localized display metadata for the type. */
|
|
205
277
|
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
278
|
+
/** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
|
|
206
279
|
lang: z.ZodString;
|
|
280
|
+
/** REQUIRED. Human-readable name for the credential type. */
|
|
207
281
|
name: z.ZodString;
|
|
282
|
+
/** OPTIONAL. Description of the credential type for end users. */
|
|
208
283
|
description: z.ZodOptional<z.ZodString>;
|
|
284
|
+
/** OPTIONAL. Rendering information (simple or SVG) for the credential. */
|
|
209
285
|
rendering: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
/** OPTIONAL. Simple rendering metadata. */
|
|
210
287
|
simple: z.ZodOptional<z.ZodObject<{
|
|
288
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
211
289
|
logo: z.ZodOptional<z.ZodObject<{
|
|
290
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
212
291
|
uri: z.ZodString;
|
|
292
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
213
293
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
294
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
214
295
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
215
|
-
}, z.core.$
|
|
296
|
+
}, z.core.$loose>>;
|
|
297
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
216
298
|
background_color: z.ZodOptional<z.ZodString>;
|
|
299
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
217
300
|
text_color: z.ZodOptional<z.ZodString>;
|
|
218
|
-
}, z.core.$
|
|
301
|
+
}, z.core.$loose>>;
|
|
302
|
+
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
219
303
|
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
304
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
220
305
|
uri: z.ZodString;
|
|
306
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
221
307
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
308
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
222
309
|
properties: z.ZodOptional<z.ZodObject<{
|
|
310
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
223
311
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
224
312
|
portrait: "portrait";
|
|
225
313
|
landscape: "landscape";
|
|
226
314
|
}>>;
|
|
315
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
227
316
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
228
317
|
light: "light";
|
|
229
318
|
dark: "dark";
|
|
230
319
|
}>>;
|
|
320
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
231
321
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
232
322
|
normal: "normal";
|
|
233
323
|
high: "high";
|
|
234
324
|
}>>;
|
|
235
|
-
}, z.core.$
|
|
236
|
-
}, z.core.$
|
|
237
|
-
}, z.core.$
|
|
238
|
-
}, z.core.$
|
|
325
|
+
}, z.core.$loose>>;
|
|
326
|
+
}, z.core.$loose>>>;
|
|
327
|
+
}, z.core.$loose>>;
|
|
328
|
+
}, z.core.$loose>>>;
|
|
329
|
+
/** OPTIONAL. Array of claim metadata. */
|
|
239
330
|
claims: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
331
|
+
/**
|
|
332
|
+
* REQUIRED. Array of one or more paths to the claim in the credential subject.
|
|
333
|
+
* Each path is an array of strings (or null for array elements).
|
|
334
|
+
*/
|
|
240
335
|
path: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
336
|
+
/** OPTIONAL. Display metadata in multiple languages. */
|
|
241
337
|
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
338
|
+
/** REQUIRED. Language tag according to RFC 5646. */
|
|
242
339
|
lang: z.ZodString;
|
|
340
|
+
/** REQUIRED. Human-readable label for the claim. */
|
|
243
341
|
label: z.ZodString;
|
|
342
|
+
/** OPTIONAL. Description of the claim for end users. */
|
|
244
343
|
description: z.ZodOptional<z.ZodString>;
|
|
245
|
-
}, z.core.$
|
|
344
|
+
}, z.core.$loose>>>;
|
|
345
|
+
/** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
|
|
246
346
|
sd: z.ZodOptional<z.ZodEnum<{
|
|
247
347
|
never: "never";
|
|
248
348
|
always: "always";
|
|
249
349
|
allowed: "allowed";
|
|
250
350
|
}>>;
|
|
351
|
+
/**
|
|
352
|
+
* OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
|
|
353
|
+
* Must consist of alphanumeric characters or underscores and must not start with a digit.
|
|
354
|
+
*/
|
|
251
355
|
svg_id: z.ZodOptional<z.ZodString>;
|
|
252
|
-
}, z.core.$
|
|
253
|
-
}, z.core.$
|
|
356
|
+
}, z.core.$loose>>>;
|
|
357
|
+
}, z.core.$loose>;
|
|
254
358
|
/**
|
|
255
359
|
* The resolved type metadata. If you just want to use the type metadata, you should use `typeMetadata`.
|
|
256
360
|
* In case additional processing is needed (e.g. for extensions in type metadata), you can use the `typeMetadataChain`
|
package/dist/index.d.ts
CHANGED
|
@@ -6,23 +6,32 @@ import { SdJwtPayload, SDJwtInstance, VerifierOptions } from '@sd-jwt/core';
|
|
|
6
6
|
* Logo metadata used in rendering a credential.
|
|
7
7
|
*/
|
|
8
8
|
declare const LogoSchema: z.ZodObject<{
|
|
9
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
9
10
|
uri: z.ZodString;
|
|
11
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
10
12
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
13
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
11
14
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, z.core.$
|
|
15
|
+
}, z.core.$loose>;
|
|
13
16
|
type Logo = z.infer<typeof LogoSchema>;
|
|
14
17
|
/**
|
|
15
18
|
* The simple rendering method is intended for applications that do not support SVG.
|
|
16
19
|
*/
|
|
17
20
|
declare const SimpleRenderingSchema: z.ZodObject<{
|
|
21
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
18
22
|
logo: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
19
24
|
uri: z.ZodString;
|
|
25
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
20
26
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
27
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
21
28
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
22
|
-
}, z.core.$
|
|
29
|
+
}, z.core.$loose>>;
|
|
30
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
23
31
|
background_color: z.ZodOptional<z.ZodString>;
|
|
32
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
24
33
|
text_color: z.ZodOptional<z.ZodString>;
|
|
25
|
-
}, z.core.$
|
|
34
|
+
}, z.core.$loose>;
|
|
26
35
|
type SimpleRendering = z.infer<typeof SimpleRenderingSchema>;
|
|
27
36
|
/** Enum of valid values for rendering orientation. */
|
|
28
37
|
declare const OrientationSchema: z.ZodEnum<{
|
|
@@ -43,112 +52,153 @@ declare const ContrastSchema: z.ZodEnum<{
|
|
|
43
52
|
* Properties that describe the display preferences for an SVG template rendering.
|
|
44
53
|
*/
|
|
45
54
|
declare const SvgTemplatePropertiesSchema: z.ZodObject<{
|
|
55
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
46
56
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
47
57
|
portrait: "portrait";
|
|
48
58
|
landscape: "landscape";
|
|
49
59
|
}>>;
|
|
60
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
50
61
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
51
62
|
light: "light";
|
|
52
63
|
dark: "dark";
|
|
53
64
|
}>>;
|
|
65
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
54
66
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
55
67
|
normal: "normal";
|
|
56
68
|
high: "high";
|
|
57
69
|
}>>;
|
|
58
|
-
}, z.core.$
|
|
70
|
+
}, z.core.$loose>;
|
|
59
71
|
type SvgTemplateProperties = z.infer<typeof SvgTemplatePropertiesSchema>;
|
|
60
72
|
/**
|
|
61
73
|
* SVG rendering metadata containing URI and optional integrity and properties.
|
|
62
74
|
*/
|
|
63
75
|
declare const SvgTemplateRenderingSchema: z.ZodObject<{
|
|
76
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
64
77
|
uri: z.ZodString;
|
|
78
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
65
79
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
80
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
66
81
|
properties: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
67
83
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
68
84
|
portrait: "portrait";
|
|
69
85
|
landscape: "landscape";
|
|
70
86
|
}>>;
|
|
87
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
71
88
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
72
89
|
light: "light";
|
|
73
90
|
dark: "dark";
|
|
74
91
|
}>>;
|
|
92
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
75
93
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
76
94
|
normal: "normal";
|
|
77
95
|
high: "high";
|
|
78
96
|
}>>;
|
|
79
|
-
}, z.core.$
|
|
80
|
-
}, z.core.$
|
|
97
|
+
}, z.core.$loose>>;
|
|
98
|
+
}, z.core.$loose>;
|
|
81
99
|
type SvgTemplateRendering = z.infer<typeof SvgTemplateRenderingSchema>;
|
|
82
100
|
/**
|
|
83
101
|
* Rendering metadata, either simple or SVG-based, for a credential.
|
|
84
102
|
*/
|
|
85
103
|
declare const RenderingSchema: z.ZodObject<{
|
|
104
|
+
/** OPTIONAL. Simple rendering metadata. */
|
|
86
105
|
simple: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
87
107
|
logo: z.ZodOptional<z.ZodObject<{
|
|
108
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
88
109
|
uri: z.ZodString;
|
|
110
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
89
111
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
112
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
90
113
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
91
|
-
}, z.core.$
|
|
114
|
+
}, z.core.$loose>>;
|
|
115
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
92
116
|
background_color: z.ZodOptional<z.ZodString>;
|
|
117
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
93
118
|
text_color: z.ZodOptional<z.ZodString>;
|
|
94
|
-
}, z.core.$
|
|
119
|
+
}, z.core.$loose>>;
|
|
120
|
+
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
95
121
|
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
122
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
96
123
|
uri: z.ZodString;
|
|
124
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
97
125
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
126
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
98
127
|
properties: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
99
129
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
100
130
|
portrait: "portrait";
|
|
101
131
|
landscape: "landscape";
|
|
102
132
|
}>>;
|
|
133
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
103
134
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
104
135
|
light: "light";
|
|
105
136
|
dark: "dark";
|
|
106
137
|
}>>;
|
|
138
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
107
139
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
108
140
|
normal: "normal";
|
|
109
141
|
high: "high";
|
|
110
142
|
}>>;
|
|
111
|
-
}, z.core.$
|
|
112
|
-
}, z.core.$
|
|
113
|
-
}, z.core.$
|
|
143
|
+
}, z.core.$loose>>;
|
|
144
|
+
}, z.core.$loose>>>;
|
|
145
|
+
}, z.core.$loose>;
|
|
114
146
|
type Rendering = z.infer<typeof RenderingSchema>;
|
|
115
147
|
/**
|
|
116
148
|
* Display metadata associated with a credential type.
|
|
117
149
|
*/
|
|
118
150
|
declare const DisplaySchema: z.ZodObject<{
|
|
151
|
+
/** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
|
|
119
152
|
lang: z.ZodString;
|
|
153
|
+
/** REQUIRED. Human-readable name for the credential type. */
|
|
120
154
|
name: z.ZodString;
|
|
155
|
+
/** OPTIONAL. Description of the credential type for end users. */
|
|
121
156
|
description: z.ZodOptional<z.ZodString>;
|
|
157
|
+
/** OPTIONAL. Rendering information (simple or SVG) for the credential. */
|
|
122
158
|
rendering: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
/** OPTIONAL. Simple rendering metadata. */
|
|
123
160
|
simple: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
124
162
|
logo: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
125
164
|
uri: z.ZodString;
|
|
165
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
126
166
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
167
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
127
168
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
128
|
-
}, z.core.$
|
|
169
|
+
}, z.core.$loose>>;
|
|
170
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
129
171
|
background_color: z.ZodOptional<z.ZodString>;
|
|
172
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
130
173
|
text_color: z.ZodOptional<z.ZodString>;
|
|
131
|
-
}, z.core.$
|
|
174
|
+
}, z.core.$loose>>;
|
|
175
|
+
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
132
176
|
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
133
178
|
uri: z.ZodString;
|
|
179
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
134
180
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
181
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
135
182
|
properties: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
136
184
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
137
185
|
portrait: "portrait";
|
|
138
186
|
landscape: "landscape";
|
|
139
187
|
}>>;
|
|
188
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
140
189
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
141
190
|
light: "light";
|
|
142
191
|
dark: "dark";
|
|
143
192
|
}>>;
|
|
193
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
144
194
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
145
195
|
normal: "normal";
|
|
146
196
|
high: "high";
|
|
147
197
|
}>>;
|
|
148
|
-
}, z.core.$
|
|
149
|
-
}, z.core.$
|
|
150
|
-
}, z.core.$
|
|
151
|
-
}, z.core.$
|
|
198
|
+
}, z.core.$loose>>;
|
|
199
|
+
}, z.core.$loose>>>;
|
|
200
|
+
}, z.core.$loose>>;
|
|
201
|
+
}, z.core.$loose>;
|
|
152
202
|
type Display = z.infer<typeof DisplaySchema>;
|
|
153
203
|
/**
|
|
154
204
|
* Claim path within the credential's JSON structure.
|
|
@@ -160,10 +210,13 @@ type ClaimPath = z.infer<typeof ClaimPathSchema>;
|
|
|
160
210
|
* Display metadata for a specific claim.
|
|
161
211
|
*/
|
|
162
212
|
declare const ClaimDisplaySchema: z.ZodObject<{
|
|
213
|
+
/** REQUIRED. Language tag according to RFC 5646. */
|
|
163
214
|
lang: z.ZodString;
|
|
215
|
+
/** REQUIRED. Human-readable label for the claim. */
|
|
164
216
|
label: z.ZodString;
|
|
217
|
+
/** OPTIONAL. Description of the claim for end users. */
|
|
165
218
|
description: z.ZodOptional<z.ZodString>;
|
|
166
|
-
}, z.core.$
|
|
219
|
+
}, z.core.$loose>;
|
|
167
220
|
type ClaimDisplay = z.infer<typeof ClaimDisplaySchema>;
|
|
168
221
|
/**
|
|
169
222
|
* Indicates whether a claim is selectively disclosable.
|
|
@@ -178,79 +231,130 @@ type ClaimSelectiveDisclosure = z.infer<typeof ClaimSelectiveDisclosureSchema>;
|
|
|
178
231
|
* Metadata for individual claims in the credential type.
|
|
179
232
|
*/
|
|
180
233
|
declare const ClaimSchema: z.ZodObject<{
|
|
234
|
+
/**
|
|
235
|
+
* REQUIRED. Array of one or more paths to the claim in the credential subject.
|
|
236
|
+
* Each path is an array of strings (or null for array elements).
|
|
237
|
+
*/
|
|
181
238
|
path: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
239
|
+
/** OPTIONAL. Display metadata in multiple languages. */
|
|
182
240
|
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
241
|
+
/** REQUIRED. Language tag according to RFC 5646. */
|
|
183
242
|
lang: z.ZodString;
|
|
243
|
+
/** REQUIRED. Human-readable label for the claim. */
|
|
184
244
|
label: z.ZodString;
|
|
245
|
+
/** OPTIONAL. Description of the claim for end users. */
|
|
185
246
|
description: z.ZodOptional<z.ZodString>;
|
|
186
|
-
}, z.core.$
|
|
247
|
+
}, z.core.$loose>>>;
|
|
248
|
+
/** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
|
|
187
249
|
sd: z.ZodOptional<z.ZodEnum<{
|
|
188
250
|
never: "never";
|
|
189
251
|
always: "always";
|
|
190
252
|
allowed: "allowed";
|
|
191
253
|
}>>;
|
|
254
|
+
/**
|
|
255
|
+
* OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
|
|
256
|
+
* Must consist of alphanumeric characters or underscores and must not start with a digit.
|
|
257
|
+
*/
|
|
192
258
|
svg_id: z.ZodOptional<z.ZodString>;
|
|
193
|
-
}, z.core.$
|
|
259
|
+
}, z.core.$loose>;
|
|
194
260
|
type Claim = z.infer<typeof ClaimSchema>;
|
|
195
261
|
/**
|
|
196
262
|
* Type metadata for a specific Verifiable Credential (VC) type.
|
|
197
263
|
* Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
|
|
198
264
|
*/
|
|
199
265
|
declare const TypeMetadataFormatSchema: z.ZodObject<{
|
|
266
|
+
/** REQUIRED. A URI uniquely identifying the credential type. */
|
|
200
267
|
vct: z.ZodString;
|
|
268
|
+
/** OPTIONAL. Human-readable name for developers. */
|
|
201
269
|
name: z.ZodOptional<z.ZodString>;
|
|
270
|
+
/** OPTIONAL. Human-readable description for developers. */
|
|
202
271
|
description: z.ZodOptional<z.ZodString>;
|
|
272
|
+
/** OPTIONAL. URI of another type that this one extends. */
|
|
203
273
|
extends: z.ZodOptional<z.ZodString>;
|
|
274
|
+
/** OPTIONAL. Integrity metadata for the 'extends' field. */
|
|
204
275
|
'extends#integrity': z.ZodOptional<z.ZodString>;
|
|
276
|
+
/** OPTIONAL. Array of localized display metadata for the type. */
|
|
205
277
|
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
278
|
+
/** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
|
|
206
279
|
lang: z.ZodString;
|
|
280
|
+
/** REQUIRED. Human-readable name for the credential type. */
|
|
207
281
|
name: z.ZodString;
|
|
282
|
+
/** OPTIONAL. Description of the credential type for end users. */
|
|
208
283
|
description: z.ZodOptional<z.ZodString>;
|
|
284
|
+
/** OPTIONAL. Rendering information (simple or SVG) for the credential. */
|
|
209
285
|
rendering: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
/** OPTIONAL. Simple rendering metadata. */
|
|
210
287
|
simple: z.ZodOptional<z.ZodObject<{
|
|
288
|
+
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
211
289
|
logo: z.ZodOptional<z.ZodObject<{
|
|
290
|
+
/** REQUIRED. A URI pointing to the logo image. */
|
|
212
291
|
uri: z.ZodString;
|
|
292
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
213
293
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
294
|
+
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
214
295
|
alt_text: z.ZodOptional<z.ZodString>;
|
|
215
|
-
}, z.core.$
|
|
296
|
+
}, z.core.$loose>>;
|
|
297
|
+
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
216
298
|
background_color: z.ZodOptional<z.ZodString>;
|
|
299
|
+
/** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
|
|
217
300
|
text_color: z.ZodOptional<z.ZodString>;
|
|
218
|
-
}, z.core.$
|
|
301
|
+
}, z.core.$loose>>;
|
|
302
|
+
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
219
303
|
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
304
|
+
/** REQUIRED. A URI pointing to the SVG template. */
|
|
220
305
|
uri: z.ZodString;
|
|
306
|
+
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
221
307
|
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
308
|
+
/** REQUIRED if more than one SVG template is present. */
|
|
222
309
|
properties: z.ZodOptional<z.ZodObject<{
|
|
310
|
+
/** OPTIONAL. Orientation optimized for the template. */
|
|
223
311
|
orientation: z.ZodOptional<z.ZodEnum<{
|
|
224
312
|
portrait: "portrait";
|
|
225
313
|
landscape: "landscape";
|
|
226
314
|
}>>;
|
|
315
|
+
/** OPTIONAL. Color scheme optimized for the template. */
|
|
227
316
|
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
228
317
|
light: "light";
|
|
229
318
|
dark: "dark";
|
|
230
319
|
}>>;
|
|
320
|
+
/** OPTIONAL. Contrast level optimized for the template. */
|
|
231
321
|
contrast: z.ZodOptional<z.ZodEnum<{
|
|
232
322
|
normal: "normal";
|
|
233
323
|
high: "high";
|
|
234
324
|
}>>;
|
|
235
|
-
}, z.core.$
|
|
236
|
-
}, z.core.$
|
|
237
|
-
}, z.core.$
|
|
238
|
-
}, z.core.$
|
|
325
|
+
}, z.core.$loose>>;
|
|
326
|
+
}, z.core.$loose>>>;
|
|
327
|
+
}, z.core.$loose>>;
|
|
328
|
+
}, z.core.$loose>>>;
|
|
329
|
+
/** OPTIONAL. Array of claim metadata. */
|
|
239
330
|
claims: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
331
|
+
/**
|
|
332
|
+
* REQUIRED. Array of one or more paths to the claim in the credential subject.
|
|
333
|
+
* Each path is an array of strings (or null for array elements).
|
|
334
|
+
*/
|
|
240
335
|
path: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
336
|
+
/** OPTIONAL. Display metadata in multiple languages. */
|
|
241
337
|
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
338
|
+
/** REQUIRED. Language tag according to RFC 5646. */
|
|
242
339
|
lang: z.ZodString;
|
|
340
|
+
/** REQUIRED. Human-readable label for the claim. */
|
|
243
341
|
label: z.ZodString;
|
|
342
|
+
/** OPTIONAL. Description of the claim for end users. */
|
|
244
343
|
description: z.ZodOptional<z.ZodString>;
|
|
245
|
-
}, z.core.$
|
|
344
|
+
}, z.core.$loose>>>;
|
|
345
|
+
/** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
|
|
246
346
|
sd: z.ZodOptional<z.ZodEnum<{
|
|
247
347
|
never: "never";
|
|
248
348
|
always: "always";
|
|
249
349
|
allowed: "allowed";
|
|
250
350
|
}>>;
|
|
351
|
+
/**
|
|
352
|
+
* OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
|
|
353
|
+
* Must consist of alphanumeric characters or underscores and must not start with a digit.
|
|
354
|
+
*/
|
|
251
355
|
svg_id: z.ZodOptional<z.ZodString>;
|
|
252
|
-
}, z.core.$
|
|
253
|
-
}, z.core.$
|
|
356
|
+
}, z.core.$loose>>>;
|
|
357
|
+
}, z.core.$loose>;
|
|
254
358
|
/**
|
|
255
359
|
* The resolved type metadata. If you just want to use the type metadata, you should use `typeMetadata`.
|
|
256
360
|
* In case additional processing is needed (e.g. for extensions in type metadata), you can use the `typeMetadataChain`
|
package/dist/index.js
CHANGED
|
@@ -92,7 +92,7 @@ var import_zod2 = __toESM(require("zod"));
|
|
|
92
92
|
|
|
93
93
|
// src/sd-jwt-vc-type-metadata-format.ts
|
|
94
94
|
var import_zod = require("zod");
|
|
95
|
-
var LogoSchema = import_zod.z.
|
|
95
|
+
var LogoSchema = import_zod.z.looseObject({
|
|
96
96
|
/** REQUIRED. A URI pointing to the logo image. */
|
|
97
97
|
uri: import_zod.z.string(),
|
|
98
98
|
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
@@ -100,7 +100,7 @@ var LogoSchema = import_zod.z.object({
|
|
|
100
100
|
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
101
101
|
alt_text: import_zod.z.string().optional()
|
|
102
102
|
});
|
|
103
|
-
var SimpleRenderingSchema = import_zod.z.
|
|
103
|
+
var SimpleRenderingSchema = import_zod.z.looseObject({
|
|
104
104
|
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
105
105
|
logo: LogoSchema.optional(),
|
|
106
106
|
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
@@ -111,7 +111,7 @@ var SimpleRenderingSchema = import_zod.z.object({
|
|
|
111
111
|
var OrientationSchema = import_zod.z.enum(["portrait", "landscape"]);
|
|
112
112
|
var ColorSchemeSchema = import_zod.z.enum(["light", "dark"]);
|
|
113
113
|
var ContrastSchema = import_zod.z.enum(["normal", "high"]);
|
|
114
|
-
var SvgTemplatePropertiesSchema = import_zod.z.
|
|
114
|
+
var SvgTemplatePropertiesSchema = import_zod.z.looseObject({
|
|
115
115
|
/** OPTIONAL. Orientation optimized for the template. */
|
|
116
116
|
orientation: OrientationSchema.optional(),
|
|
117
117
|
/** OPTIONAL. Color scheme optimized for the template. */
|
|
@@ -119,7 +119,7 @@ var SvgTemplatePropertiesSchema = import_zod.z.object({
|
|
|
119
119
|
/** OPTIONAL. Contrast level optimized for the template. */
|
|
120
120
|
contrast: ContrastSchema.optional()
|
|
121
121
|
});
|
|
122
|
-
var SvgTemplateRenderingSchema = import_zod.z.
|
|
122
|
+
var SvgTemplateRenderingSchema = import_zod.z.looseObject({
|
|
123
123
|
/** REQUIRED. A URI pointing to the SVG template. */
|
|
124
124
|
uri: import_zod.z.string(),
|
|
125
125
|
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
@@ -127,13 +127,13 @@ var SvgTemplateRenderingSchema = import_zod.z.object({
|
|
|
127
127
|
/** REQUIRED if more than one SVG template is present. */
|
|
128
128
|
properties: SvgTemplatePropertiesSchema.optional()
|
|
129
129
|
});
|
|
130
|
-
var RenderingSchema = import_zod.z.
|
|
130
|
+
var RenderingSchema = import_zod.z.looseObject({
|
|
131
131
|
/** OPTIONAL. Simple rendering metadata. */
|
|
132
132
|
simple: SimpleRenderingSchema.optional(),
|
|
133
133
|
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
134
134
|
svg_template: import_zod.z.array(SvgTemplateRenderingSchema).optional()
|
|
135
135
|
});
|
|
136
|
-
var DisplaySchema = import_zod.z.
|
|
136
|
+
var DisplaySchema = import_zod.z.looseObject({
|
|
137
137
|
/** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
|
|
138
138
|
lang: import_zod.z.string(),
|
|
139
139
|
/** REQUIRED. Human-readable name for the credential type. */
|
|
@@ -144,7 +144,7 @@ var DisplaySchema = import_zod.z.object({
|
|
|
144
144
|
rendering: RenderingSchema.optional()
|
|
145
145
|
});
|
|
146
146
|
var ClaimPathSchema = import_zod.z.array(import_zod.z.string().nullable());
|
|
147
|
-
var ClaimDisplaySchema = import_zod.z.
|
|
147
|
+
var ClaimDisplaySchema = import_zod.z.looseObject({
|
|
148
148
|
/** REQUIRED. Language tag according to RFC 5646. */
|
|
149
149
|
lang: import_zod.z.string(),
|
|
150
150
|
/** REQUIRED. Human-readable label for the claim. */
|
|
@@ -157,7 +157,7 @@ var ClaimSelectiveDisclosureSchema = import_zod.z.enum([
|
|
|
157
157
|
"allowed",
|
|
158
158
|
"never"
|
|
159
159
|
]);
|
|
160
|
-
var ClaimSchema = import_zod.z.
|
|
160
|
+
var ClaimSchema = import_zod.z.looseObject({
|
|
161
161
|
/**
|
|
162
162
|
* REQUIRED. Array of one or more paths to the claim in the credential subject.
|
|
163
163
|
* Each path is an array of strings (or null for array elements).
|
|
@@ -173,7 +173,7 @@ var ClaimSchema = import_zod.z.object({
|
|
|
173
173
|
*/
|
|
174
174
|
svg_id: import_zod.z.string().optional()
|
|
175
175
|
});
|
|
176
|
-
var TypeMetadataFormatSchema = import_zod.z.
|
|
176
|
+
var TypeMetadataFormatSchema = import_zod.z.looseObject({
|
|
177
177
|
/** REQUIRED. A URI uniquely identifying the credential type. */
|
|
178
178
|
vct: import_zod.z.string(),
|
|
179
179
|
/** OPTIONAL. Human-readable name for developers. */
|
package/dist/index.mjs
CHANGED
|
@@ -49,7 +49,7 @@ import z2 from "zod";
|
|
|
49
49
|
|
|
50
50
|
// src/sd-jwt-vc-type-metadata-format.ts
|
|
51
51
|
import { z } from "zod";
|
|
52
|
-
var LogoSchema = z.
|
|
52
|
+
var LogoSchema = z.looseObject({
|
|
53
53
|
/** REQUIRED. A URI pointing to the logo image. */
|
|
54
54
|
uri: z.string(),
|
|
55
55
|
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
@@ -57,7 +57,7 @@ var LogoSchema = z.object({
|
|
|
57
57
|
/** OPTIONAL. A string containing alternative text for the logo image. */
|
|
58
58
|
alt_text: z.string().optional()
|
|
59
59
|
});
|
|
60
|
-
var SimpleRenderingSchema = z.
|
|
60
|
+
var SimpleRenderingSchema = z.looseObject({
|
|
61
61
|
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
62
62
|
logo: LogoSchema.optional(),
|
|
63
63
|
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
@@ -68,7 +68,7 @@ var SimpleRenderingSchema = z.object({
|
|
|
68
68
|
var OrientationSchema = z.enum(["portrait", "landscape"]);
|
|
69
69
|
var ColorSchemeSchema = z.enum(["light", "dark"]);
|
|
70
70
|
var ContrastSchema = z.enum(["normal", "high"]);
|
|
71
|
-
var SvgTemplatePropertiesSchema = z.
|
|
71
|
+
var SvgTemplatePropertiesSchema = z.looseObject({
|
|
72
72
|
/** OPTIONAL. Orientation optimized for the template. */
|
|
73
73
|
orientation: OrientationSchema.optional(),
|
|
74
74
|
/** OPTIONAL. Color scheme optimized for the template. */
|
|
@@ -76,7 +76,7 @@ var SvgTemplatePropertiesSchema = z.object({
|
|
|
76
76
|
/** OPTIONAL. Contrast level optimized for the template. */
|
|
77
77
|
contrast: ContrastSchema.optional()
|
|
78
78
|
});
|
|
79
|
-
var SvgTemplateRenderingSchema = z.
|
|
79
|
+
var SvgTemplateRenderingSchema = z.looseObject({
|
|
80
80
|
/** REQUIRED. A URI pointing to the SVG template. */
|
|
81
81
|
uri: z.string(),
|
|
82
82
|
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
@@ -84,13 +84,13 @@ var SvgTemplateRenderingSchema = z.object({
|
|
|
84
84
|
/** REQUIRED if more than one SVG template is present. */
|
|
85
85
|
properties: SvgTemplatePropertiesSchema.optional()
|
|
86
86
|
});
|
|
87
|
-
var RenderingSchema = z.
|
|
87
|
+
var RenderingSchema = z.looseObject({
|
|
88
88
|
/** OPTIONAL. Simple rendering metadata. */
|
|
89
89
|
simple: SimpleRenderingSchema.optional(),
|
|
90
90
|
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
91
91
|
svg_template: z.array(SvgTemplateRenderingSchema).optional()
|
|
92
92
|
});
|
|
93
|
-
var DisplaySchema = z.
|
|
93
|
+
var DisplaySchema = z.looseObject({
|
|
94
94
|
/** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
|
|
95
95
|
lang: z.string(),
|
|
96
96
|
/** REQUIRED. Human-readable name for the credential type. */
|
|
@@ -101,7 +101,7 @@ var DisplaySchema = z.object({
|
|
|
101
101
|
rendering: RenderingSchema.optional()
|
|
102
102
|
});
|
|
103
103
|
var ClaimPathSchema = z.array(z.string().nullable());
|
|
104
|
-
var ClaimDisplaySchema = z.
|
|
104
|
+
var ClaimDisplaySchema = z.looseObject({
|
|
105
105
|
/** REQUIRED. Language tag according to RFC 5646. */
|
|
106
106
|
lang: z.string(),
|
|
107
107
|
/** REQUIRED. Human-readable label for the claim. */
|
|
@@ -114,7 +114,7 @@ var ClaimSelectiveDisclosureSchema = z.enum([
|
|
|
114
114
|
"allowed",
|
|
115
115
|
"never"
|
|
116
116
|
]);
|
|
117
|
-
var ClaimSchema = z.
|
|
117
|
+
var ClaimSchema = z.looseObject({
|
|
118
118
|
/**
|
|
119
119
|
* REQUIRED. Array of one or more paths to the claim in the credential subject.
|
|
120
120
|
* Each path is an array of strings (or null for array elements).
|
|
@@ -130,7 +130,7 @@ var ClaimSchema = z.object({
|
|
|
130
130
|
*/
|
|
131
131
|
svg_id: z.string().optional()
|
|
132
132
|
});
|
|
133
|
-
var TypeMetadataFormatSchema = z.
|
|
133
|
+
var TypeMetadataFormatSchema = z.looseObject({
|
|
134
134
|
/** REQUIRED. A URI uniquely identifying the credential type. */
|
|
135
135
|
vct: z.string(),
|
|
136
136
|
/** OPTIONAL. Human-readable name for developers. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/sd-jwt-vc",
|
|
3
|
-
"version": "0.18.1
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@sd-jwt/core": "0.18.1
|
|
42
|
-
"@sd-jwt/jwt-status-list": "0.18.1
|
|
43
|
-
"@sd-jwt/utils": "0.18.1
|
|
41
|
+
"@sd-jwt/core": "0.18.1",
|
|
42
|
+
"@sd-jwt/jwt-status-list": "0.18.1",
|
|
43
|
+
"@sd-jwt/utils": "0.18.1",
|
|
44
44
|
"zod": "^4.3.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@sd-jwt/crypto-nodejs": "0.18.
|
|
48
|
-
"@sd-jwt/types": "0.18.1
|
|
47
|
+
"@sd-jwt/crypto-nodejs": "0.18.0",
|
|
48
|
+
"@sd-jwt/types": "0.18.1",
|
|
49
49
|
"jose": "^6.1.2",
|
|
50
50
|
"msw": "^2.12.3"
|
|
51
51
|
},
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"esm"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "fa573e11233ccefd99911693a849c2a5241f610b"
|
|
69
69
|
}
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
/**
|
|
4
4
|
* Logo metadata used in rendering a credential.
|
|
5
5
|
*/
|
|
6
|
-
export const LogoSchema = z.
|
|
6
|
+
export const LogoSchema = z.looseObject({
|
|
7
7
|
/** REQUIRED. A URI pointing to the logo image. */
|
|
8
8
|
uri: z.string(),
|
|
9
9
|
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
@@ -17,7 +17,7 @@ export type Logo = z.infer<typeof LogoSchema>;
|
|
|
17
17
|
/**
|
|
18
18
|
* The simple rendering method is intended for applications that do not support SVG.
|
|
19
19
|
*/
|
|
20
|
-
export const SimpleRenderingSchema = z.
|
|
20
|
+
export const SimpleRenderingSchema = z.looseObject({
|
|
21
21
|
/** OPTIONAL. Logo metadata to display for the credential. */
|
|
22
22
|
logo: LogoSchema.optional(),
|
|
23
23
|
/** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
|
|
@@ -40,7 +40,7 @@ export const ContrastSchema = z.enum(['normal', 'high']);
|
|
|
40
40
|
/**
|
|
41
41
|
* Properties that describe the display preferences for an SVG template rendering.
|
|
42
42
|
*/
|
|
43
|
-
export const SvgTemplatePropertiesSchema = z.
|
|
43
|
+
export const SvgTemplatePropertiesSchema = z.looseObject({
|
|
44
44
|
/** OPTIONAL. Orientation optimized for the template. */
|
|
45
45
|
orientation: OrientationSchema.optional(),
|
|
46
46
|
/** OPTIONAL. Color scheme optimized for the template. */
|
|
@@ -54,7 +54,7 @@ export type SvgTemplateProperties = z.infer<typeof SvgTemplatePropertiesSchema>;
|
|
|
54
54
|
/**
|
|
55
55
|
* SVG rendering metadata containing URI and optional integrity and properties.
|
|
56
56
|
*/
|
|
57
|
-
export const SvgTemplateRenderingSchema = z.
|
|
57
|
+
export const SvgTemplateRenderingSchema = z.looseObject({
|
|
58
58
|
/** REQUIRED. A URI pointing to the SVG template. */
|
|
59
59
|
uri: z.string(),
|
|
60
60
|
/** OPTIONAL. An "integrity metadata" string as described in Section 7. */
|
|
@@ -68,7 +68,7 @@ export type SvgTemplateRendering = z.infer<typeof SvgTemplateRenderingSchema>;
|
|
|
68
68
|
/**
|
|
69
69
|
* Rendering metadata, either simple or SVG-based, for a credential.
|
|
70
70
|
*/
|
|
71
|
-
export const RenderingSchema = z.
|
|
71
|
+
export const RenderingSchema = z.looseObject({
|
|
72
72
|
/** OPTIONAL. Simple rendering metadata. */
|
|
73
73
|
simple: SimpleRenderingSchema.optional(),
|
|
74
74
|
/** OPTIONAL. Array of SVG template rendering objects. */
|
|
@@ -80,7 +80,7 @@ export type Rendering = z.infer<typeof RenderingSchema>;
|
|
|
80
80
|
/**
|
|
81
81
|
* Display metadata associated with a credential type.
|
|
82
82
|
*/
|
|
83
|
-
export const DisplaySchema = z.
|
|
83
|
+
export const DisplaySchema = z.looseObject({
|
|
84
84
|
/** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
|
|
85
85
|
lang: z.string(),
|
|
86
86
|
/** REQUIRED. Human-readable name for the credential type. */
|
|
@@ -104,7 +104,7 @@ export type ClaimPath = z.infer<typeof ClaimPathSchema>;
|
|
|
104
104
|
/**
|
|
105
105
|
* Display metadata for a specific claim.
|
|
106
106
|
*/
|
|
107
|
-
export const ClaimDisplaySchema = z.
|
|
107
|
+
export const ClaimDisplaySchema = z.looseObject({
|
|
108
108
|
/** REQUIRED. Language tag according to RFC 5646. */
|
|
109
109
|
lang: z.string(),
|
|
110
110
|
/** REQUIRED. Human-readable label for the claim. */
|
|
@@ -131,7 +131,7 @@ export type ClaimSelectiveDisclosure = z.infer<
|
|
|
131
131
|
/**
|
|
132
132
|
* Metadata for individual claims in the credential type.
|
|
133
133
|
*/
|
|
134
|
-
export const ClaimSchema = z.
|
|
134
|
+
export const ClaimSchema = z.looseObject({
|
|
135
135
|
/**
|
|
136
136
|
* REQUIRED. Array of one or more paths to the claim in the credential subject.
|
|
137
137
|
* Each path is an array of strings (or null for array elements).
|
|
@@ -154,7 +154,7 @@ export type Claim = z.infer<typeof ClaimSchema>;
|
|
|
154
154
|
* Type metadata for a specific Verifiable Credential (VC) type.
|
|
155
155
|
* Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
|
|
156
156
|
*/
|
|
157
|
-
export const TypeMetadataFormatSchema = z.
|
|
157
|
+
export const TypeMetadataFormatSchema = z.looseObject({
|
|
158
158
|
/** REQUIRED. A URI uniquely identifying the credential type. */
|
|
159
159
|
vct: z.string(),
|
|
160
160
|
/** OPTIONAL. Human-readable name for developers. */
|
package/src/test/vct.spec.ts
CHANGED
|
@@ -140,6 +140,20 @@ const validExtendingSdChange: TypeMetadataFormat = {
|
|
|
140
140
|
],
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
+
const vctWithCustomProperties: TypeMetadataFormat = {
|
|
144
|
+
vct: 'http://example.com/custom-properties',
|
|
145
|
+
name: 'CustomProperties',
|
|
146
|
+
claims: [
|
|
147
|
+
{
|
|
148
|
+
path: ['firstName'],
|
|
149
|
+
sd: 'always' as const, // Valid: base doesn't have sd or has 'allowed'
|
|
150
|
+
display: [{ lang: 'en', label: 'First Name' }],
|
|
151
|
+
anotherCustom: 'property',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
test: 'something',
|
|
155
|
+
};
|
|
156
|
+
|
|
143
157
|
const restHandlers = [
|
|
144
158
|
http.get('http://example.com/example', () => {
|
|
145
159
|
const res: TypeMetadataFormat = exampleVctm;
|
|
@@ -179,6 +193,9 @@ const restHandlers = [
|
|
|
179
193
|
http.get('http://example.com/valid-sd-change', () => {
|
|
180
194
|
return HttpResponse.json(validExtendingSdChange);
|
|
181
195
|
}),
|
|
196
|
+
http.get('http://example.com/custom-properties', () => {
|
|
197
|
+
return HttpResponse.json(vctWithCustomProperties);
|
|
198
|
+
}),
|
|
182
199
|
http.get('http://example.com/invalid', () => {
|
|
183
200
|
// Return invalid type metadata (missing required 'vct' field)
|
|
184
201
|
return HttpResponse.json({
|
|
@@ -644,4 +661,24 @@ describe('App', () => {
|
|
|
644
661
|
expect(resolvedTypeMetadata?.typeMetadataChain).toHaveLength(3);
|
|
645
662
|
expect(resolvedTypeMetadata?.vctValues).toHaveLength(3);
|
|
646
663
|
});
|
|
664
|
+
|
|
665
|
+
test('VCT with custom properties are kept', async () => {
|
|
666
|
+
const expectedPayload: SdJwtVcPayload = {
|
|
667
|
+
iat,
|
|
668
|
+
iss,
|
|
669
|
+
vct: 'http://example.com/custom-properties',
|
|
670
|
+
...claims,
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
const encodedSdjwt = await sdjwt.issue(
|
|
674
|
+
expectedPayload,
|
|
675
|
+
disclosureFrame as unknown as DisclosureFrame<SdJwtVcPayload>,
|
|
676
|
+
);
|
|
677
|
+
|
|
678
|
+
const resolvedTypeMetadata = await sdjwt.getVct(encodedSdjwt);
|
|
679
|
+
|
|
680
|
+
expect(resolvedTypeMetadata?.mergedTypeMetadata).toEqual(
|
|
681
|
+
vctWithCustomProperties,
|
|
682
|
+
);
|
|
683
|
+
});
|
|
647
684
|
});
|