@sd-jwt/sd-jwt-vc 0.18.2-next.0 → 0.18.2-next.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/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
9
  var __getProtoOf = Object.getPrototypeOf;
@@ -20,6 +22,19 @@ var __spreadValues = (a, b) => {
20
22
  }
21
23
  return a;
22
24
  };
25
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
+ var __objRest = (source, exclude) => {
27
+ var target = {};
28
+ for (var prop in source)
29
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ target[prop] = source[prop];
31
+ if (source != null && __getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
+ target[prop] = source[prop];
35
+ }
36
+ return target;
37
+ };
23
38
  var __export = (target, all) => {
24
39
  for (var name in all)
25
40
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -66,6 +81,7 @@ var __async = (__this, __arguments, generator) => {
66
81
  // src/index.ts
67
82
  var index_exports = {};
68
83
  __export(index_exports, {
84
+ BackgroundImageSchema: () => BackgroundImageSchema,
69
85
  ClaimDisplaySchema: () => ClaimDisplaySchema,
70
86
  ClaimPathSchema: () => ClaimPathSchema,
71
87
  ClaimSchema: () => ClaimSchema,
@@ -92,6 +108,12 @@ var import_zod2 = __toESM(require("zod"));
92
108
 
93
109
  // src/sd-jwt-vc-type-metadata-format.ts
94
110
  var import_zod = require("zod");
111
+ var BackgroundImageSchema = import_zod.z.looseObject({
112
+ /** REQUIRED. A URI pointing to the background image. */
113
+ uri: import_zod.z.string(),
114
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
115
+ "uri#integrity": import_zod.z.string().optional()
116
+ });
95
117
  var LogoSchema = import_zod.z.looseObject({
96
118
  /** REQUIRED. A URI pointing to the logo image. */
97
119
  uri: import_zod.z.string(),
@@ -106,7 +128,9 @@ var SimpleRenderingSchema = import_zod.z.looseObject({
106
128
  /** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
107
129
  background_color: import_zod.z.string().optional(),
108
130
  /** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
109
- text_color: import_zod.z.string().optional()
131
+ text_color: import_zod.z.string().optional(),
132
+ /** OPTIONAL. An object containing information about the background image to be displayed for the type. */
133
+ background_image: BackgroundImageSchema.optional()
110
134
  });
111
135
  var OrientationSchema = import_zod.z.enum(["portrait", "landscape"]);
112
136
  var ColorSchemeSchema = import_zod.z.enum(["light", "dark"]);
@@ -131,26 +155,66 @@ var RenderingSchema = import_zod.z.looseObject({
131
155
  /** OPTIONAL. Simple rendering metadata. */
132
156
  simple: SimpleRenderingSchema.optional(),
133
157
  /** OPTIONAL. Array of SVG template rendering objects. */
158
+ svg_templates: import_zod.z.array(SvgTemplateRenderingSchema).optional(),
159
+ /**
160
+ * OPTIONAL. Array of SVG template rendering objects.
161
+ * @deprecated use `svg_templates` (plural) instead.
162
+ */
134
163
  svg_template: import_zod.z.array(SvgTemplateRenderingSchema).optional()
164
+ }).transform((_a) => {
165
+ var _b = _a, { svg_template, svg_templates } = _b, rest = __objRest(_b, ["svg_template", "svg_templates"]);
166
+ return __spreadProps(__spreadValues({}, rest), {
167
+ svg_templates: svg_templates != null ? svg_templates : svg_template
168
+ });
135
169
  });
136
170
  var DisplaySchema = import_zod.z.looseObject({
137
- /** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
138
- lang: import_zod.z.string(),
171
+ /**
172
+ * Language tag according to RFC 5646 (e.g., "en", "de").
173
+ * @deprecated - use `locale` instead
174
+ */
175
+ lang: import_zod.z.string().optional(),
176
+ /**
177
+ * REQUIRED (preferred). Language tag according to RFC 5646.
178
+ * Alias for `lang` - either `lang` or `locale` must be provided.
179
+ */
180
+ locale: import_zod.z.string().optional(),
139
181
  /** REQUIRED. Human-readable name for the credential type. */
140
182
  name: import_zod.z.string(),
141
183
  /** OPTIONAL. Description of the credential type for end users. */
142
184
  description: import_zod.z.string().optional(),
143
185
  /** OPTIONAL. Rendering information (simple or SVG) for the credential. */
144
186
  rendering: RenderingSchema.optional()
187
+ }).transform((_a) => {
188
+ var _b = _a, { lang, locale } = _b, rest = __objRest(_b, ["lang", "locale"]);
189
+ return __spreadProps(__spreadValues({}, rest), {
190
+ locale: locale != null ? locale : lang
191
+ });
192
+ }).refine(({ locale }) => locale !== void 0, {
193
+ message: "Either locale (preferred) or lang (spec name, deprecated) MUST be defined on claim display entry."
145
194
  });
146
195
  var ClaimPathSchema = import_zod.z.array(import_zod.z.string().nullable());
147
196
  var ClaimDisplaySchema = import_zod.z.looseObject({
148
- /** REQUIRED. Language tag according to RFC 5646. */
149
- lang: import_zod.z.string(),
197
+ /**
198
+ * Language tag according to RFC 5646.
199
+ * @deprecated - use `locale` instead
200
+ */
201
+ lang: import_zod.z.string().optional(),
202
+ /**
203
+ * REQUIRED (preferred). Language tag according to RFC 5646.
204
+ * Alias for `lang` - either `lang` or `locale` must be provided.
205
+ */
206
+ locale: import_zod.z.string().optional(),
150
207
  /** REQUIRED. Human-readable label for the claim. */
151
208
  label: import_zod.z.string(),
152
209
  /** OPTIONAL. Description of the claim for end users. */
153
210
  description: import_zod.z.string().optional()
211
+ }).transform((_a) => {
212
+ var _b = _a, { lang, locale } = _b, rest = __objRest(_b, ["lang", "locale"]);
213
+ return __spreadProps(__spreadValues({}, rest), {
214
+ locale: locale != null ? locale : lang
215
+ });
216
+ }).refine(({ locale }) => locale !== void 0, {
217
+ message: "Either locale (preferred) or lang (spec name, deprecated) MUST be defined on claim display entry."
154
218
  });
155
219
  var ClaimSelectiveDisclosureSchema = import_zod.z.enum([
156
220
  "always",
@@ -167,6 +231,11 @@ var ClaimSchema = import_zod.z.looseObject({
167
231
  display: import_zod.z.array(ClaimDisplaySchema).optional(),
168
232
  /** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
169
233
  sd: ClaimSelectiveDisclosureSchema.optional(),
234
+ /**
235
+ * OPTIONAL. A boolean indicating whether the claim must be present in the Unsecured Payload
236
+ * of the SD-JWT VC. Default is false if not specified.
237
+ */
238
+ mandatory: import_zod.z.boolean().optional(),
170
239
  /**
171
240
  * OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
172
241
  * Must consist of alphanumeric characters or underscores and must not start with a digit.
@@ -576,6 +645,7 @@ ${import_zod2.default.prettifyError(validated.error)}`
576
645
  };
577
646
  // Annotate the CommonJS export names for ESM import in node:
578
647
  0 && (module.exports = {
648
+ BackgroundImageSchema,
579
649
  ClaimDisplaySchema,
580
650
  ClaimPathSchema,
581
651
  ClaimSchema,
package/dist/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -16,6 +18,19 @@ var __spreadValues = (a, b) => {
16
18
  }
17
19
  return a;
18
20
  };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
19
34
  var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
20
35
  var __async = (__this, __arguments, generator) => {
21
36
  return new Promise((resolve, reject) => {
@@ -49,6 +64,12 @@ import z2 from "zod";
49
64
 
50
65
  // src/sd-jwt-vc-type-metadata-format.ts
51
66
  import { z } from "zod";
67
+ var BackgroundImageSchema = z.looseObject({
68
+ /** REQUIRED. A URI pointing to the background image. */
69
+ uri: z.string(),
70
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
71
+ "uri#integrity": z.string().optional()
72
+ });
52
73
  var LogoSchema = z.looseObject({
53
74
  /** REQUIRED. A URI pointing to the logo image. */
54
75
  uri: z.string(),
@@ -63,7 +84,9 @@ var SimpleRenderingSchema = z.looseObject({
63
84
  /** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
64
85
  background_color: z.string().optional(),
65
86
  /** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
66
- text_color: z.string().optional()
87
+ text_color: z.string().optional(),
88
+ /** OPTIONAL. An object containing information about the background image to be displayed for the type. */
89
+ background_image: BackgroundImageSchema.optional()
67
90
  });
68
91
  var OrientationSchema = z.enum(["portrait", "landscape"]);
69
92
  var ColorSchemeSchema = z.enum(["light", "dark"]);
@@ -88,26 +111,66 @@ var RenderingSchema = z.looseObject({
88
111
  /** OPTIONAL. Simple rendering metadata. */
89
112
  simple: SimpleRenderingSchema.optional(),
90
113
  /** OPTIONAL. Array of SVG template rendering objects. */
114
+ svg_templates: z.array(SvgTemplateRenderingSchema).optional(),
115
+ /**
116
+ * OPTIONAL. Array of SVG template rendering objects.
117
+ * @deprecated use `svg_templates` (plural) instead.
118
+ */
91
119
  svg_template: z.array(SvgTemplateRenderingSchema).optional()
120
+ }).transform((_a) => {
121
+ var _b = _a, { svg_template, svg_templates } = _b, rest = __objRest(_b, ["svg_template", "svg_templates"]);
122
+ return __spreadProps(__spreadValues({}, rest), {
123
+ svg_templates: svg_templates != null ? svg_templates : svg_template
124
+ });
92
125
  });
93
126
  var DisplaySchema = z.looseObject({
94
- /** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
95
- lang: z.string(),
127
+ /**
128
+ * Language tag according to RFC 5646 (e.g., "en", "de").
129
+ * @deprecated - use `locale` instead
130
+ */
131
+ lang: z.string().optional(),
132
+ /**
133
+ * REQUIRED (preferred). Language tag according to RFC 5646.
134
+ * Alias for `lang` - either `lang` or `locale` must be provided.
135
+ */
136
+ locale: z.string().optional(),
96
137
  /** REQUIRED. Human-readable name for the credential type. */
97
138
  name: z.string(),
98
139
  /** OPTIONAL. Description of the credential type for end users. */
99
140
  description: z.string().optional(),
100
141
  /** OPTIONAL. Rendering information (simple or SVG) for the credential. */
101
142
  rendering: RenderingSchema.optional()
143
+ }).transform((_a) => {
144
+ var _b = _a, { lang, locale } = _b, rest = __objRest(_b, ["lang", "locale"]);
145
+ return __spreadProps(__spreadValues({}, rest), {
146
+ locale: locale != null ? locale : lang
147
+ });
148
+ }).refine(({ locale }) => locale !== void 0, {
149
+ message: "Either locale (preferred) or lang (spec name, deprecated) MUST be defined on claim display entry."
102
150
  });
103
151
  var ClaimPathSchema = z.array(z.string().nullable());
104
152
  var ClaimDisplaySchema = z.looseObject({
105
- /** REQUIRED. Language tag according to RFC 5646. */
106
- lang: z.string(),
153
+ /**
154
+ * Language tag according to RFC 5646.
155
+ * @deprecated - use `locale` instead
156
+ */
157
+ lang: z.string().optional(),
158
+ /**
159
+ * REQUIRED (preferred). Language tag according to RFC 5646.
160
+ * Alias for `lang` - either `lang` or `locale` must be provided.
161
+ */
162
+ locale: z.string().optional(),
107
163
  /** REQUIRED. Human-readable label for the claim. */
108
164
  label: z.string(),
109
165
  /** OPTIONAL. Description of the claim for end users. */
110
166
  description: z.string().optional()
167
+ }).transform((_a) => {
168
+ var _b = _a, { lang, locale } = _b, rest = __objRest(_b, ["lang", "locale"]);
169
+ return __spreadProps(__spreadValues({}, rest), {
170
+ locale: locale != null ? locale : lang
171
+ });
172
+ }).refine(({ locale }) => locale !== void 0, {
173
+ message: "Either locale (preferred) or lang (spec name, deprecated) MUST be defined on claim display entry."
111
174
  });
112
175
  var ClaimSelectiveDisclosureSchema = z.enum([
113
176
  "always",
@@ -124,6 +187,11 @@ var ClaimSchema = z.looseObject({
124
187
  display: z.array(ClaimDisplaySchema).optional(),
125
188
  /** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
126
189
  sd: ClaimSelectiveDisclosureSchema.optional(),
190
+ /**
191
+ * OPTIONAL. A boolean indicating whether the claim must be present in the Unsecured Payload
192
+ * of the SD-JWT VC. Default is false if not specified.
193
+ */
194
+ mandatory: z.boolean().optional(),
127
195
  /**
128
196
  * OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
129
197
  * Must consist of alphanumeric characters or underscores and must not start with a digit.
@@ -532,6 +600,7 @@ ${z2.prettifyError(validated.error)}`
532
600
  }
533
601
  };
534
602
  export {
603
+ BackgroundImageSchema,
535
604
  ClaimDisplaySchema,
536
605
  ClaimPathSchema,
537
606
  ClaimSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-jwt/sd-jwt-vc",
3
- "version": "0.18.2-next.0+fa573e1",
3
+ "version": "0.18.2-next.1+d230a8d",
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.2-next.0+fa573e1",
42
- "@sd-jwt/jwt-status-list": "0.18.2-next.0+fa573e1",
43
- "@sd-jwt/utils": "0.18.2-next.0+fa573e1",
41
+ "@sd-jwt/core": "0.18.2-next.1+d230a8d",
42
+ "@sd-jwt/jwt-status-list": "0.18.2-next.1+d230a8d",
43
+ "@sd-jwt/utils": "0.18.2-next.1+d230a8d",
44
44
  "zod": "^4.3.5"
45
45
  },
46
46
  "devDependencies": {
47
- "@sd-jwt/crypto-nodejs": "0.18.2-next.0+fa573e1",
48
- "@sd-jwt/types": "0.18.2-next.0+fa573e1",
47
+ "@sd-jwt/crypto-nodejs": "0.18.2-next.1+d230a8d",
48
+ "@sd-jwt/types": "0.18.2-next.1+d230a8d",
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": "fa573e11233ccefd99911693a849c2a5241f610b"
68
+ "gitHead": "d230a8df2899b342b98a1d72eb606fb31de41924"
69
69
  }
@@ -1,5 +1,13 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ export const BackgroundImageSchema = z.looseObject({
4
+ /** REQUIRED. A URI pointing to the background image. */
5
+ uri: z.string(),
6
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
7
+ 'uri#integrity': z.string().optional(),
8
+ });
9
+ export type BackgroundImage = z.infer<typeof BackgroundImageSchema>;
10
+
3
11
  /**
4
12
  * Logo metadata used in rendering a credential.
5
13
  */
@@ -24,6 +32,8 @@ export const SimpleRenderingSchema = z.looseObject({
24
32
  background_color: z.string().optional(),
25
33
  /** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
26
34
  text_color: z.string().optional(),
35
+ /** OPTIONAL. An object containing information about the background image to be displayed for the type. */
36
+ background_image: BackgroundImageSchema.optional(),
27
37
  });
28
38
 
29
39
  export type SimpleRendering = z.infer<typeof SimpleRenderingSchema>;
@@ -68,28 +78,57 @@ export type SvgTemplateRendering = z.infer<typeof SvgTemplateRenderingSchema>;
68
78
  /**
69
79
  * Rendering metadata, either simple or SVG-based, for a credential.
70
80
  */
71
- export const RenderingSchema = z.looseObject({
72
- /** OPTIONAL. Simple rendering metadata. */
73
- simple: SimpleRenderingSchema.optional(),
74
- /** OPTIONAL. Array of SVG template rendering objects. */
75
- svg_template: z.array(SvgTemplateRenderingSchema).optional(),
76
- });
81
+ export const RenderingSchema = z
82
+ .looseObject({
83
+ /** OPTIONAL. Simple rendering metadata. */
84
+ simple: SimpleRenderingSchema.optional(),
85
+ /** OPTIONAL. Array of SVG template rendering objects. */
86
+ svg_templates: z.array(SvgTemplateRenderingSchema).optional(),
87
+ /**
88
+ * OPTIONAL. Array of SVG template rendering objects.
89
+ * @deprecated use `svg_templates` (plural) instead.
90
+ */
91
+ svg_template: z.array(SvgTemplateRenderingSchema).optional(),
92
+ })
93
+ .transform(({ svg_template, svg_templates, ...rest }) => ({
94
+ ...rest,
95
+ svg_templates: svg_templates ?? svg_template,
96
+ }));
77
97
 
78
98
  export type Rendering = z.infer<typeof RenderingSchema>;
79
99
 
80
100
  /**
81
101
  * Display metadata associated with a credential type.
82
102
  */
83
- export const DisplaySchema = z.looseObject({
84
- /** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
85
- lang: z.string(),
86
- /** REQUIRED. Human-readable name for the credential type. */
87
- name: z.string(),
88
- /** OPTIONAL. Description of the credential type for end users. */
89
- description: z.string().optional(),
90
- /** OPTIONAL. Rendering information (simple or SVG) for the credential. */
91
- rendering: RenderingSchema.optional(),
92
- });
103
+ export const DisplaySchema = z
104
+ .looseObject({
105
+ /**
106
+ * Language tag according to RFC 5646 (e.g., "en", "de").
107
+ * @deprecated - use `locale` instead
108
+ */
109
+ lang: z.string().optional(),
110
+
111
+ /**
112
+ * REQUIRED (preferred). Language tag according to RFC 5646.
113
+ * Alias for `lang` - either `lang` or `locale` must be provided.
114
+ */
115
+ locale: z.string().optional(),
116
+
117
+ /** REQUIRED. Human-readable name for the credential type. */
118
+ name: z.string(),
119
+ /** OPTIONAL. Description of the credential type for end users. */
120
+ description: z.string().optional(),
121
+ /** OPTIONAL. Rendering information (simple or SVG) for the credential. */
122
+ rendering: RenderingSchema.optional(),
123
+ })
124
+ .transform(({ lang, locale, ...rest }) => ({
125
+ ...rest,
126
+ locale: locale ?? lang,
127
+ }))
128
+ .refine(({ locale }) => locale !== undefined, {
129
+ message:
130
+ 'Either locale (preferred) or lang (spec name, deprecated) MUST be defined on claim display entry.',
131
+ });
93
132
 
94
133
  export type Display = z.infer<typeof DisplaySchema>;
95
134
 
@@ -104,14 +143,33 @@ export type ClaimPath = z.infer<typeof ClaimPathSchema>;
104
143
  /**
105
144
  * Display metadata for a specific claim.
106
145
  */
107
- export const ClaimDisplaySchema = z.looseObject({
108
- /** REQUIRED. Language tag according to RFC 5646. */
109
- lang: z.string(),
110
- /** REQUIRED. Human-readable label for the claim. */
111
- label: z.string(),
112
- /** OPTIONAL. Description of the claim for end users. */
113
- description: z.string().optional(),
114
- });
146
+ export const ClaimDisplaySchema = z
147
+ .looseObject({
148
+ /**
149
+ * Language tag according to RFC 5646.
150
+ * @deprecated - use `locale` instead
151
+ */
152
+ lang: z.string().optional(),
153
+
154
+ /**
155
+ * REQUIRED (preferred). Language tag according to RFC 5646.
156
+ * Alias for `lang` - either `lang` or `locale` must be provided.
157
+ */
158
+ locale: z.string().optional(),
159
+
160
+ /** REQUIRED. Human-readable label for the claim. */
161
+ label: z.string(),
162
+ /** OPTIONAL. Description of the claim for end users. */
163
+ description: z.string().optional(),
164
+ })
165
+ .transform(({ lang, locale, ...rest }) => ({
166
+ ...rest,
167
+ locale: locale ?? lang,
168
+ }))
169
+ .refine(({ locale }) => locale !== undefined, {
170
+ message:
171
+ 'Either locale (preferred) or lang (spec name, deprecated) MUST be defined on claim display entry.',
172
+ });
115
173
 
116
174
  export type ClaimDisplay = z.infer<typeof ClaimDisplaySchema>;
117
175
 
@@ -141,6 +199,11 @@ export const ClaimSchema = z.looseObject({
141
199
  display: z.array(ClaimDisplaySchema).optional(),
142
200
  /** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
143
201
  sd: ClaimSelectiveDisclosureSchema.optional(),
202
+ /**
203
+ * OPTIONAL. A boolean indicating whether the claim must be present in the Unsecured Payload
204
+ * of the SD-JWT VC. Default is false if not specified.
205
+ */
206
+ mandatory: z.boolean().optional(),
144
207
  /**
145
208
  * OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
146
209
  * Must consist of alphanumeric characters or underscores and must not start with a digit.
@@ -152,7 +215,7 @@ export type Claim = z.infer<typeof ClaimSchema>;
152
215
 
153
216
  /**
154
217
  * Type metadata for a specific Verifiable Credential (VC) type.
155
- * Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
218
+ * Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-13.html#name-type-metadata-format
156
219
  */
157
220
  export const TypeMetadataFormatSchema = z.looseObject({
158
221
  /** REQUIRED. A URI uniquely identifying the credential type. */
@@ -22,12 +22,12 @@ const baseVctm: TypeMetadataFormat = {
22
22
  claims: [
23
23
  {
24
24
  path: ['firstName'],
25
- display: [{ lang: 'en', label: 'First Name' }],
25
+ display: [{ locale: 'en', label: 'First Name' }],
26
26
  },
27
27
  ],
28
28
  display: [
29
29
  {
30
- lang: 'en',
30
+ locale: 'en',
31
31
  name: 'Base Credential',
32
32
  description: 'Base description',
33
33
  },
@@ -42,17 +42,17 @@ const extendingVctm: TypeMetadataFormat = {
42
42
  claims: [
43
43
  {
44
44
  path: ['lastName'],
45
- display: [{ lang: 'en', label: 'Last Name' }],
45
+ display: [{ locale: 'en', label: 'Last Name' }],
46
46
  },
47
47
  ],
48
48
  display: [
49
49
  {
50
- lang: 'en',
50
+ locale: 'en',
51
51
  name: 'Extended Credential',
52
52
  description: 'Extended description',
53
53
  },
54
54
  {
55
- lang: 'de',
55
+ locale: 'de',
56
56
  name: 'Erweiterte Berechtigung',
57
57
  description: 'Erweiterte Beschreibung',
58
58
  },
@@ -67,7 +67,7 @@ const middleVctm: TypeMetadataFormat = {
67
67
  claims: [
68
68
  {
69
69
  path: ['age'],
70
- display: [{ lang: 'en', label: 'Age' }],
70
+ display: [{ locale: 'en', label: 'Age' }],
71
71
  },
72
72
  ],
73
73
  };
@@ -80,12 +80,12 @@ const overridingVctm: TypeMetadataFormat = {
80
80
  claims: [
81
81
  {
82
82
  path: ['firstName'],
83
- display: [{ lang: 'en', label: 'Given Name' }], // Override with different label
83
+ display: [{ locale: 'en', label: 'Given Name' }], // Override with different label
84
84
  sd: 'always' as const,
85
85
  },
86
86
  {
87
87
  path: ['middleName'],
88
- display: [{ lang: 'en', label: 'Middle Name' }],
88
+ display: [{ locale: 'en', label: 'Middle Name' }],
89
89
  },
90
90
  ],
91
91
  };
@@ -109,7 +109,7 @@ const baseWithSdAlways: TypeMetadataFormat = {
109
109
  {
110
110
  path: ['sensitiveData'],
111
111
  sd: 'always' as const,
112
- display: [{ lang: 'en', label: 'Sensitive Data' }],
112
+ display: [{ locale: 'en', label: 'Sensitive Data' }],
113
113
  },
114
114
  ],
115
115
  };
@@ -122,7 +122,7 @@ const invalidExtendingSdChange: TypeMetadataFormat = {
122
122
  {
123
123
  path: ['sensitiveData'],
124
124
  sd: 'never' as const, // Invalid: trying to change from 'always' to 'never'
125
- display: [{ lang: 'en', label: 'Sensitive Data' }],
125
+ display: [{ locale: 'en', label: 'Sensitive Data' }],
126
126
  },
127
127
  ],
128
128
  };
@@ -135,7 +135,7 @@ const validExtendingSdChange: TypeMetadataFormat = {
135
135
  {
136
136
  path: ['firstName'],
137
137
  sd: 'always' as const, // Valid: base doesn't have sd or has 'allowed'
138
- display: [{ lang: 'en', label: 'First Name' }],
138
+ display: [{ locale: 'en', label: 'First Name' }],
139
139
  },
140
140
  ],
141
141
  };
@@ -147,7 +147,7 @@ const vctWithCustomProperties: TypeMetadataFormat = {
147
147
  {
148
148
  path: ['firstName'],
149
149
  sd: 'always' as const, // Valid: base doesn't have sd or has 'allowed'
150
- display: [{ lang: 'en', label: 'First Name' }],
150
+ display: [{ locale: 'en', label: 'First Name' }],
151
151
  anotherCustom: 'property',
152
152
  },
153
153
  ],
@@ -368,12 +368,12 @@ describe('App', () => {
368
368
  // Display from extending type completely replaces base display (section 8.2)
369
369
  expect(resolvedTypeMetadata?.mergedTypeMetadata.display).toHaveLength(2);
370
370
  expect(resolvedTypeMetadata?.mergedTypeMetadata.display?.[0]).toEqual({
371
- lang: 'en',
371
+ locale: 'en',
372
372
  name: 'Extended Credential',
373
373
  description: 'Extended description',
374
374
  });
375
375
  expect(resolvedTypeMetadata?.mergedTypeMetadata.display?.[1]).toEqual({
376
- lang: 'de',
376
+ locale: 'de',
377
377
  name: 'Erweiterte Berechtigung',
378
378
  description: 'Erweiterte Beschreibung',
379
379
  });
@@ -650,10 +650,10 @@ describe('App', () => {
650
650
 
651
651
  // Check mergedTypeMetadata - since middle doesn't define display, it should inherit from extending which has display
652
652
  expect(resolvedTypeMetadata?.mergedTypeMetadata.display).toHaveLength(2);
653
- expect(resolvedTypeMetadata?.mergedTypeMetadata.display?.[0].lang).toBe(
653
+ expect(resolvedTypeMetadata?.mergedTypeMetadata.display?.[0].locale).toBe(
654
654
  'en',
655
655
  );
656
- expect(resolvedTypeMetadata?.mergedTypeMetadata.display?.[1].lang).toBe(
656
+ expect(resolvedTypeMetadata?.mergedTypeMetadata.display?.[1].locale).toBe(
657
657
  'de',
658
658
  );
659
659