@sd-jwt/sd-jwt-vc 0.17.2-next.0 → 0.17.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/dist/index.d.mts +287 -106
- package/dist/index.d.ts +287 -106
- package/dist/index.js +341 -52
- package/dist/index.mjs +320 -52
- package/package.json +10 -9
- package/src/sd-jwt-vc-config.ts +2 -0
- package/src/sd-jwt-vc-instance.ts +276 -68
- package/src/sd-jwt-vc-payload.ts +1 -1
- package/src/sd-jwt-vc-type-metadata-format.ts +106 -54
- package/src/sd-jwt-vc-vct.ts +1 -1
- package/src/test/index.spec.ts +2 -2
- package/src/test/vct.spec.ts +505 -21
- package/src/verification-result.ts +3 -2
- package/test/app-e2e.spec.ts +13 -7
- package/test/array_data_types.json +1 -1
- package/test/array_full_sd.json +1 -1
- package/test/array_in_sd.json +1 -1
- package/test/array_nested_in_plain.json +1 -1
- package/test/array_none_disclosed.json +1 -1
- package/test/array_of_nulls.json +1 -1
- package/test/array_of_objects.json +1 -1
- package/test/array_of_scalars.json +1 -1
- package/test/array_recursive_sd.json +1 -1
- package/test/array_recursive_sd_some_disclosed.json +1 -1
- package/test/complex.json +1 -1
- package/test/header_mod.json +1 -1
- package/test/json_serialization.json +1 -1
- package/test/key_binding.json +1 -1
- package/test/no_sd.json +1 -1
- package/test/object_data_types.json +1 -1
- package/test/recursions.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,139 +1,278 @@
|
|
|
1
1
|
import { SDJWTConfig, Verifier, kbPayload, kbHeader, DisclosureFrame } from '@sd-jwt/types';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import { SdJwtPayload, SDJwtInstance, VerifierOptions } from '@sd-jwt/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Logo metadata used in rendering a credential.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
uri:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
alt_text?: string;
|
|
14
|
-
};
|
|
8
|
+
declare const LogoSchema: z.ZodObject<{
|
|
9
|
+
uri: z.ZodString;
|
|
10
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
11
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
type Logo = z.infer<typeof LogoSchema>;
|
|
15
14
|
/**
|
|
16
15
|
* The simple rendering method is intended for applications that do not support SVG.
|
|
17
16
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
declare const SimpleRenderingSchema: z.ZodObject<{
|
|
18
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
uri: z.ZodString;
|
|
20
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
21
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
background_color: z.ZodOptional<z.ZodString>;
|
|
24
|
+
text_color: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
type SimpleRendering = z.infer<typeof SimpleRenderingSchema>;
|
|
26
27
|
/** Enum of valid values for rendering orientation. */
|
|
27
|
-
|
|
28
|
+
declare const OrientationSchema: z.ZodEnum<{
|
|
29
|
+
portrait: "portrait";
|
|
30
|
+
landscape: "landscape";
|
|
31
|
+
}>;
|
|
28
32
|
/** Enum of valid values for rendering color schemes. */
|
|
29
|
-
|
|
33
|
+
declare const ColorSchemeSchema: z.ZodEnum<{
|
|
34
|
+
light: "light";
|
|
35
|
+
dark: "dark";
|
|
36
|
+
}>;
|
|
30
37
|
/** Enum of valid values for rendering contrast. */
|
|
31
|
-
|
|
38
|
+
declare const ContrastSchema: z.ZodEnum<{
|
|
39
|
+
normal: "normal";
|
|
40
|
+
high: "high";
|
|
41
|
+
}>;
|
|
32
42
|
/**
|
|
33
43
|
* Properties that describe the display preferences for an SVG template rendering.
|
|
34
44
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
declare const SvgTemplatePropertiesSchema: z.ZodObject<{
|
|
46
|
+
orientation: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
portrait: "portrait";
|
|
48
|
+
landscape: "landscape";
|
|
49
|
+
}>>;
|
|
50
|
+
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
51
|
+
light: "light";
|
|
52
|
+
dark: "dark";
|
|
53
|
+
}>>;
|
|
54
|
+
contrast: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
normal: "normal";
|
|
56
|
+
high: "high";
|
|
57
|
+
}>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
type SvgTemplateProperties = z.infer<typeof SvgTemplatePropertiesSchema>;
|
|
43
60
|
/**
|
|
44
61
|
* SVG rendering metadata containing URI and optional integrity and properties.
|
|
45
62
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
uri:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
63
|
+
declare const SvgTemplateRenderingSchema: z.ZodObject<{
|
|
64
|
+
uri: z.ZodString;
|
|
65
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
66
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
orientation: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
portrait: "portrait";
|
|
69
|
+
landscape: "landscape";
|
|
70
|
+
}>>;
|
|
71
|
+
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
light: "light";
|
|
73
|
+
dark: "dark";
|
|
74
|
+
}>>;
|
|
75
|
+
contrast: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
normal: "normal";
|
|
77
|
+
high: "high";
|
|
78
|
+
}>>;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
type SvgTemplateRendering = z.infer<typeof SvgTemplateRenderingSchema>;
|
|
54
82
|
/**
|
|
55
83
|
* Rendering metadata, either simple or SVG-based, for a credential.
|
|
56
84
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
85
|
+
declare const RenderingSchema: z.ZodObject<{
|
|
86
|
+
simple: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
uri: z.ZodString;
|
|
89
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
90
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>>;
|
|
92
|
+
background_color: z.ZodOptional<z.ZodString>;
|
|
93
|
+
text_color: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
96
|
+
uri: z.ZodString;
|
|
97
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
98
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
orientation: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
portrait: "portrait";
|
|
101
|
+
landscape: "landscape";
|
|
102
|
+
}>>;
|
|
103
|
+
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
light: "light";
|
|
105
|
+
dark: "dark";
|
|
106
|
+
}>>;
|
|
107
|
+
contrast: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
normal: "normal";
|
|
109
|
+
high: "high";
|
|
110
|
+
}>>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
}, z.core.$strip>>>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
type Rendering = z.infer<typeof RenderingSchema>;
|
|
63
115
|
/**
|
|
64
116
|
* Display metadata associated with a credential type.
|
|
65
117
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
118
|
+
declare const DisplaySchema: z.ZodObject<{
|
|
119
|
+
lang: z.ZodString;
|
|
120
|
+
name: z.ZodString;
|
|
121
|
+
description: z.ZodOptional<z.ZodString>;
|
|
122
|
+
rendering: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
simple: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
uri: z.ZodString;
|
|
126
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
127
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
background_color: z.ZodOptional<z.ZodString>;
|
|
130
|
+
text_color: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
133
|
+
uri: z.ZodString;
|
|
134
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
135
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
136
|
+
orientation: z.ZodOptional<z.ZodEnum<{
|
|
137
|
+
portrait: "portrait";
|
|
138
|
+
landscape: "landscape";
|
|
139
|
+
}>>;
|
|
140
|
+
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
141
|
+
light: "light";
|
|
142
|
+
dark: "dark";
|
|
143
|
+
}>>;
|
|
144
|
+
contrast: z.ZodOptional<z.ZodEnum<{
|
|
145
|
+
normal: "normal";
|
|
146
|
+
high: "high";
|
|
147
|
+
}>>;
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
}, z.core.$strip>>>;
|
|
150
|
+
}, z.core.$strip>>;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
type Display = z.infer<typeof DisplaySchema>;
|
|
76
153
|
/**
|
|
77
154
|
* Claim path within the credential's JSON structure.
|
|
78
155
|
* Example: ["address", "street_address"]
|
|
79
156
|
*/
|
|
80
|
-
|
|
157
|
+
declare const ClaimPathSchema: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
158
|
+
type ClaimPath = z.infer<typeof ClaimPathSchema>;
|
|
81
159
|
/**
|
|
82
160
|
* Display metadata for a specific claim.
|
|
83
161
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
description?: string;
|
|
91
|
-
};
|
|
162
|
+
declare const ClaimDisplaySchema: z.ZodObject<{
|
|
163
|
+
lang: z.ZodString;
|
|
164
|
+
label: z.ZodString;
|
|
165
|
+
description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
type ClaimDisplay = z.infer<typeof ClaimDisplaySchema>;
|
|
92
168
|
/**
|
|
93
169
|
* Indicates whether a claim is selectively disclosable.
|
|
94
170
|
*/
|
|
95
|
-
|
|
171
|
+
declare const ClaimSelectiveDisclosureSchema: z.ZodEnum<{
|
|
172
|
+
never: "never";
|
|
173
|
+
always: "always";
|
|
174
|
+
allowed: "allowed";
|
|
175
|
+
}>;
|
|
176
|
+
type ClaimSelectiveDisclosure = z.infer<typeof ClaimSelectiveDisclosureSchema>;
|
|
96
177
|
/**
|
|
97
178
|
* Metadata for individual claims in the credential type.
|
|
98
179
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
180
|
+
declare const ClaimSchema: z.ZodObject<{
|
|
181
|
+
path: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
183
|
+
lang: z.ZodString;
|
|
184
|
+
label: z.ZodString;
|
|
185
|
+
description: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, z.core.$strip>>>;
|
|
187
|
+
sd: z.ZodOptional<z.ZodEnum<{
|
|
188
|
+
never: "never";
|
|
189
|
+
always: "always";
|
|
190
|
+
allowed: "allowed";
|
|
191
|
+
}>>;
|
|
192
|
+
svg_id: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
type Claim = z.infer<typeof ClaimSchema>;
|
|
115
195
|
/**
|
|
116
196
|
* Type metadata for a specific Verifiable Credential (VC) type.
|
|
117
197
|
* Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
|
|
118
198
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
199
|
+
declare const TypeMetadataFormatSchema: z.ZodObject<{
|
|
200
|
+
vct: z.ZodString;
|
|
201
|
+
name: z.ZodOptional<z.ZodString>;
|
|
202
|
+
description: z.ZodOptional<z.ZodString>;
|
|
203
|
+
extends: z.ZodOptional<z.ZodString>;
|
|
204
|
+
'extends#integrity': z.ZodOptional<z.ZodString>;
|
|
205
|
+
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
206
|
+
lang: z.ZodString;
|
|
207
|
+
name: z.ZodString;
|
|
208
|
+
description: z.ZodOptional<z.ZodString>;
|
|
209
|
+
rendering: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
simple: z.ZodOptional<z.ZodObject<{
|
|
211
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
212
|
+
uri: z.ZodString;
|
|
213
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
214
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
background_color: z.ZodOptional<z.ZodString>;
|
|
217
|
+
text_color: z.ZodOptional<z.ZodString>;
|
|
218
|
+
}, z.core.$strip>>;
|
|
219
|
+
svg_template: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
220
|
+
uri: z.ZodString;
|
|
221
|
+
'uri#integrity': z.ZodOptional<z.ZodString>;
|
|
222
|
+
properties: z.ZodOptional<z.ZodObject<{
|
|
223
|
+
orientation: z.ZodOptional<z.ZodEnum<{
|
|
224
|
+
portrait: "portrait";
|
|
225
|
+
landscape: "landscape";
|
|
226
|
+
}>>;
|
|
227
|
+
color_scheme: z.ZodOptional<z.ZodEnum<{
|
|
228
|
+
light: "light";
|
|
229
|
+
dark: "dark";
|
|
230
|
+
}>>;
|
|
231
|
+
contrast: z.ZodOptional<z.ZodEnum<{
|
|
232
|
+
normal: "normal";
|
|
233
|
+
high: "high";
|
|
234
|
+
}>>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
236
|
+
}, z.core.$strip>>>;
|
|
237
|
+
}, z.core.$strip>>;
|
|
238
|
+
}, z.core.$strip>>>;
|
|
239
|
+
claims: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
240
|
+
path: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
241
|
+
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
242
|
+
lang: z.ZodString;
|
|
243
|
+
label: z.ZodString;
|
|
244
|
+
description: z.ZodOptional<z.ZodString>;
|
|
245
|
+
}, z.core.$strip>>>;
|
|
246
|
+
sd: z.ZodOptional<z.ZodEnum<{
|
|
247
|
+
never: "never";
|
|
248
|
+
always: "always";
|
|
249
|
+
allowed: "allowed";
|
|
250
|
+
}>>;
|
|
251
|
+
svg_id: z.ZodOptional<z.ZodString>;
|
|
252
|
+
}, z.core.$strip>>>;
|
|
253
|
+
}, z.core.$strip>;
|
|
254
|
+
/**
|
|
255
|
+
* The resolved type metadata. If you just want to use the type metadata, you should use `typeMetadata`.
|
|
256
|
+
* In case additional processing is needed (e.g. for extensions in type metadata), you can use the `typeMetadataChain`
|
|
257
|
+
*/
|
|
258
|
+
type ResolvedTypeMetadata = {
|
|
259
|
+
/**
|
|
260
|
+
* The merged type metadata based on the resolved `vct` document and all `extends` values.
|
|
261
|
+
*/
|
|
262
|
+
mergedTypeMetadata: TypeMetadataFormat;
|
|
263
|
+
/**
|
|
264
|
+
* The original type metadata documents, ordered from the extending type to the last extended type.
|
|
265
|
+
*/
|
|
266
|
+
typeMetadataChain: [TypeMetadataFormat, ...TypeMetadataFormat[]];
|
|
267
|
+
/**
|
|
268
|
+
* The vct values present in the type metadata chain. This can be used for matching against e.g.
|
|
269
|
+
* DCQL queries which can query an underlying type.
|
|
270
|
+
*/
|
|
271
|
+
vctValues: [string, ...string[]];
|
|
134
272
|
};
|
|
273
|
+
type TypeMetadataFormat = z.infer<typeof TypeMetadataFormatSchema>;
|
|
135
274
|
|
|
136
|
-
type VcTFetcher = (uri: string, integrity?: string) => Promise<TypeMetadataFormat>;
|
|
275
|
+
type VcTFetcher = (uri: string, integrity?: string) => Promise<TypeMetadataFormat | undefined>;
|
|
137
276
|
|
|
138
277
|
type StatusListFetcher = (uri: string) => Promise<string>;
|
|
139
278
|
type StatusValidator = (status: number) => Promise<void>;
|
|
@@ -147,6 +286,7 @@ type SDJWTVCConfig = SDJWTConfig & {
|
|
|
147
286
|
statusVerifier?: Verifier;
|
|
148
287
|
loadTypeMetadataFormat?: boolean;
|
|
149
288
|
timeout?: number;
|
|
289
|
+
maxVctExtendsDepth?: number;
|
|
150
290
|
};
|
|
151
291
|
|
|
152
292
|
interface SDJWTVCStatusReference {
|
|
@@ -162,7 +302,7 @@ interface SdJwtVcPayload extends SdJwtPayload {
|
|
|
162
302
|
exp?: number;
|
|
163
303
|
cnf?: unknown;
|
|
164
304
|
vct: string;
|
|
165
|
-
'vct#
|
|
305
|
+
'vct#integrity'?: string;
|
|
166
306
|
status?: SDJWTVCStatusReference;
|
|
167
307
|
sub?: string;
|
|
168
308
|
iat?: number;
|
|
@@ -175,7 +315,7 @@ type VerificationResult = {
|
|
|
175
315
|
payload: kbPayload;
|
|
176
316
|
header: kbHeader;
|
|
177
317
|
} | undefined;
|
|
178
|
-
|
|
318
|
+
typeMetadata?: ResolvedTypeMetadata;
|
|
179
319
|
};
|
|
180
320
|
|
|
181
321
|
declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
@@ -209,10 +349,13 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
209
349
|
verify(encodedSDJwt: string, options?: VerifierOptions): Promise<VerificationResult>;
|
|
210
350
|
/**
|
|
211
351
|
* Gets VCT Metadata of the raw SD-JWT-VC. Returns the type metadata format. If the SD-JWT-VC is invalid or does not contain a vct claim, an error is thrown.
|
|
352
|
+
*
|
|
353
|
+
* It may return `undefined` if the fetcher returned an undefined value (instead of throwing an error).
|
|
354
|
+
*
|
|
212
355
|
* @param encodedSDJwt
|
|
213
356
|
* @returns
|
|
214
357
|
*/
|
|
215
|
-
getVct(encodedSDJwt: string): Promise<
|
|
358
|
+
getVct(encodedSDJwt: string): Promise<ResolvedTypeMetadata | undefined>;
|
|
216
359
|
/**
|
|
217
360
|
* Validates the integrity of the response if the integrity is passed. If the integrity does not match, an error is thrown.
|
|
218
361
|
* @param integrity
|
|
@@ -224,25 +367,63 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
224
367
|
* @param url
|
|
225
368
|
* @returns
|
|
226
369
|
*/
|
|
227
|
-
private
|
|
370
|
+
private fetchWithIntegrity;
|
|
228
371
|
/**
|
|
229
372
|
* Verifies the VCT of the SD-JWT-VC. Returns the type metadata format.
|
|
373
|
+
* Resolves the full extends chain according to spec sections 6.4, 8.2, and 9.5.
|
|
230
374
|
* @param result
|
|
231
375
|
* @returns
|
|
232
376
|
*/
|
|
233
|
-
private
|
|
377
|
+
private fetchVct;
|
|
234
378
|
/**
|
|
235
|
-
*
|
|
236
|
-
* @param
|
|
237
|
-
* @
|
|
379
|
+
* Checks if two claim paths are equal by comparing each element.
|
|
380
|
+
* @param path1 First claim path
|
|
381
|
+
* @param path2 Second claim path
|
|
382
|
+
* @returns True if paths are equal, false otherwise
|
|
238
383
|
*/
|
|
239
|
-
private
|
|
384
|
+
private claimPathsEqual;
|
|
385
|
+
/**
|
|
386
|
+
* Validates that extending claim metadata respects the constraints from spec section 9.5.1.
|
|
387
|
+
* @param baseClaim The base claim metadata
|
|
388
|
+
* @param extendingClaim The extending claim metadata
|
|
389
|
+
* @throws SDJWTException if validation fails
|
|
390
|
+
*/
|
|
391
|
+
private validateClaimExtension;
|
|
392
|
+
/**
|
|
393
|
+
* Merges two type metadata formats, with the extending metadata overriding the base metadata.
|
|
394
|
+
* According to spec section 9.5:
|
|
395
|
+
* - All claim metadata from the extended type are inherited
|
|
396
|
+
* - The child type can add new claims or properties
|
|
397
|
+
* - If the child type defines claim metadata with the same path as the extended type,
|
|
398
|
+
* the child type's object will override the corresponding object from the extended type
|
|
399
|
+
* According to spec section 9.5.1:
|
|
400
|
+
* - sd property can only be changed from 'allowed' (or omitted) to 'always' or 'never'
|
|
401
|
+
* - sd property cannot be changed from 'always' or 'never' to a different value
|
|
402
|
+
* According to spec section 8.2:
|
|
403
|
+
* - If the extending type defines its own display property, the original display metadata is ignored
|
|
404
|
+
* Note: The spec also mentions 'mandatory' property constraints, but this is not currently
|
|
405
|
+
* defined in the Claim type and will be validated when that property is added to the type.
|
|
406
|
+
* @param base The base type metadata format
|
|
407
|
+
* @param extending The extending type metadata format
|
|
408
|
+
* @returns The merged type metadata format
|
|
409
|
+
*/
|
|
410
|
+
private mergeTypeMetadata;
|
|
411
|
+
/**
|
|
412
|
+
* Resolves the full VCT chain by recursively fetching extended type metadata.
|
|
413
|
+
* Implements security considerations from spec section 10.3 for circular dependencies.
|
|
414
|
+
* @param vct The VCT URI to resolve
|
|
415
|
+
* @param integrity Optional integrity metadata for the VCT
|
|
416
|
+
* @param depth Current depth in the chain
|
|
417
|
+
* @param visitedVcts Set of already visited VCT URIs to detect circular dependencies
|
|
418
|
+
* @returns The fully resolved and merged type metadata format
|
|
419
|
+
*/
|
|
420
|
+
private resolveVctExtendsChain;
|
|
240
421
|
/**
|
|
241
|
-
* Fetches
|
|
422
|
+
* Fetches and verifies the VCT Metadata for a VCT value.
|
|
242
423
|
* @param result
|
|
243
|
-
* @
|
|
424
|
+
* @returns
|
|
244
425
|
*/
|
|
245
|
-
private
|
|
426
|
+
private fetchSingleVct;
|
|
246
427
|
/**
|
|
247
428
|
* Verifies the status of the SD-JWT-VC.
|
|
248
429
|
* @param result
|
|
@@ -251,4 +432,4 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
251
432
|
private verifyStatus;
|
|
252
433
|
}
|
|
253
434
|
|
|
254
|
-
export { type Claim, type ClaimDisplay, type ClaimPath, type ClaimSelectiveDisclosure, type Display, type Logo, type Rendering, type SDJWTVCConfig, type SDJWTVCStatusReference, SDJwtVcInstance, type SdJwtVcPayload, type SimpleRendering, type StatusListFetcher, type StatusValidator, type SvgTemplateProperties, type SvgTemplateRendering, type TypeMetadataFormat, type VcTFetcher, type VerificationResult };
|
|
435
|
+
export { type Claim, type ClaimDisplay, ClaimDisplaySchema, type ClaimPath, ClaimPathSchema, ClaimSchema, type ClaimSelectiveDisclosure, ClaimSelectiveDisclosureSchema, ColorSchemeSchema, ContrastSchema, type Display, DisplaySchema, type Logo, LogoSchema, OrientationSchema, type Rendering, RenderingSchema, type ResolvedTypeMetadata, type SDJWTVCConfig, type SDJWTVCStatusReference, SDJwtVcInstance, type SdJwtVcPayload, type SimpleRendering, SimpleRenderingSchema, type StatusListFetcher, type StatusValidator, type SvgTemplateProperties, SvgTemplatePropertiesSchema, type SvgTemplateRendering, SvgTemplateRenderingSchema, type TypeMetadataFormat, TypeMetadataFormatSchema, type VcTFetcher, type VerificationResult };
|