@sd-jwt/sd-jwt-vc 0.11.0 → 0.11.1-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.d.mts CHANGED
@@ -2,16 +2,146 @@ import { SDJWTConfig, kbPayload, kbHeader, DisclosureFrame } from '@sd-jwt/types
2
2
  import { SdJwtPayload, SDJwtInstance } from '@sd-jwt/core';
3
3
 
4
4
  /**
5
- * https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-08.html#name-type-metadata-format
5
+ * Logo metadata used in rendering a credential.
6
+ */
7
+ type Logo = {
8
+ /** REQUIRED. A URI pointing to the logo image. */
9
+ uri: string;
10
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
11
+ 'uri#integrity'?: string;
12
+ /** OPTIONAL. A string containing alternative text for the logo image. */
13
+ alt_text?: string;
14
+ };
15
+ /**
16
+ * The simple rendering method is intended for applications that do not support SVG.
17
+ */
18
+ type SimpleRendering = {
19
+ /** OPTIONAL. Logo metadata to display for the credential. */
20
+ logo?: Logo;
21
+ /** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
22
+ background_color?: string;
23
+ /** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
24
+ text_color?: string;
25
+ };
26
+ /** Enum of valid values for rendering orientation. */
27
+ type Orientation = 'portrait' | 'landscape';
28
+ /** Enum of valid values for rendering color schemes. */
29
+ type ColorScheme = 'light' | 'dark';
30
+ /** Enum of valid values for rendering contrast. */
31
+ type Contrast = 'normal' | 'high';
32
+ /**
33
+ * Properties that describe the display preferences for an SVG template rendering.
34
+ */
35
+ type SvgTemplateProperties = {
36
+ /** OPTIONAL. Orientation optimized for the template. */
37
+ orientation?: Orientation;
38
+ /** OPTIONAL. Color scheme optimized for the template. */
39
+ color_scheme?: ColorScheme;
40
+ /** OPTIONAL. Contrast level optimized for the template. */
41
+ contrast?: Contrast;
42
+ };
43
+ /**
44
+ * SVG rendering metadata containing URI and optional integrity and properties.
45
+ */
46
+ type SvgTemplateRendering = {
47
+ /** REQUIRED. A URI pointing to the SVG template. */
48
+ uri: string;
49
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
50
+ 'uri#integrity'?: string;
51
+ /** REQUIRED if more than one SVG template is present. */
52
+ properties?: SvgTemplateProperties;
53
+ };
54
+ /**
55
+ * Rendering metadata, either simple or SVG-based, for a credential.
56
+ */
57
+ type Rendering = {
58
+ /** OPTIONAL. Simple rendering metadata. */
59
+ simple?: SimpleRendering;
60
+ /** OPTIONAL. Array of SVG template rendering objects. */
61
+ svg_template?: SvgTemplateRendering[];
62
+ };
63
+ /**
64
+ * Display metadata associated with a credential type.
65
+ */
66
+ type Display = {
67
+ /** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
68
+ lang: string;
69
+ /** REQUIRED. Human-readable name for the credential type. */
70
+ name: string;
71
+ /** OPTIONAL. Description of the credential type for end users. */
72
+ description?: string;
73
+ /** OPTIONAL. Rendering information (simple or SVG) for the credential. */
74
+ rendering?: Rendering;
75
+ };
76
+ /**
77
+ * Claim path within the credential's JSON structure.
78
+ * Example: ["address", "street_address"]
79
+ */
80
+ type ClaimPath = Array<string | null>;
81
+ /**
82
+ * Display metadata for a specific claim.
83
+ */
84
+ type ClaimDisplay = {
85
+ /** REQUIRED. Language tag according to RFC 5646. */
86
+ lang: string;
87
+ /** REQUIRED. Human-readable label for the claim. */
88
+ label: string;
89
+ /** OPTIONAL. Description of the claim for end users. */
90
+ description?: string;
91
+ };
92
+ /**
93
+ * Indicates whether a claim is selectively disclosable.
94
+ */
95
+ type ClaimSelectiveDisclosure = 'always' | 'allowed' | 'never';
96
+ /**
97
+ * Metadata for individual claims in the credential type.
98
+ */
99
+ type Claim = {
100
+ /**
101
+ * REQUIRED. Array of one or more paths to the claim in the credential subject.
102
+ * Each path is an array of strings (or null for array elements).
103
+ */
104
+ path: ClaimPath[];
105
+ /** OPTIONAL. Display metadata in multiple languages. */
106
+ display?: ClaimDisplay[];
107
+ /** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
108
+ sd?: ClaimSelectiveDisclosure;
109
+ /**
110
+ * OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
111
+ * Must consist of alphanumeric characters or underscores and must not start with a digit.
112
+ */
113
+ svg_id?: string;
114
+ };
115
+ /**
116
+ * Type metadata for a specific Verifiable Credential (VC) type.
117
+ * Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
6
118
  */
7
119
  type TypeMetadataFormat = {
120
+ /** REQUIRED. A URI uniquely identifying the credential type. */
8
121
  vct: string;
122
+ /** OPTIONAL. Human-readable name for developers. */
9
123
  name?: string;
124
+ /** OPTIONAL. Human-readable description for developers. */
10
125
  description?: string;
126
+ /** OPTIONAL. URI of another type that this one extends. */
11
127
  extends?: string;
128
+ /** OPTIONAL. Integrity metadata for the 'extends' field. */
12
129
  'extends#Integrity'?: string;
130
+ /** OPTIONAL. Array of localized display metadata for the type. */
131
+ display?: Display[];
132
+ /** OPTIONAL. Array of claim metadata. */
133
+ claims?: Claim[];
134
+ /**
135
+ * OPTIONAL. Embedded JSON Schema describing the VC structure.
136
+ * Must not be present if schema_uri is provided.
137
+ */
13
138
  schema?: object;
139
+ /**
140
+ * OPTIONAL. URI pointing to a JSON Schema for the VC structure.
141
+ * Must not be present if schema is provided.
142
+ */
14
143
  schema_uri?: string;
144
+ /** OPTIONAL. Integrity metadata for the schema_uri field. */
15
145
  'schema_uri#Integrity'?: string;
16
146
  };
17
147
 
package/dist/index.d.ts CHANGED
@@ -2,16 +2,146 @@ import { SDJWTConfig, kbPayload, kbHeader, DisclosureFrame } from '@sd-jwt/types
2
2
  import { SdJwtPayload, SDJwtInstance } from '@sd-jwt/core';
3
3
 
4
4
  /**
5
- * https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-08.html#name-type-metadata-format
5
+ * Logo metadata used in rendering a credential.
6
+ */
7
+ type Logo = {
8
+ /** REQUIRED. A URI pointing to the logo image. */
9
+ uri: string;
10
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
11
+ 'uri#integrity'?: string;
12
+ /** OPTIONAL. A string containing alternative text for the logo image. */
13
+ alt_text?: string;
14
+ };
15
+ /**
16
+ * The simple rendering method is intended for applications that do not support SVG.
17
+ */
18
+ type SimpleRendering = {
19
+ /** OPTIONAL. Logo metadata to display for the credential. */
20
+ logo?: Logo;
21
+ /** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
22
+ background_color?: string;
23
+ /** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
24
+ text_color?: string;
25
+ };
26
+ /** Enum of valid values for rendering orientation. */
27
+ type Orientation = 'portrait' | 'landscape';
28
+ /** Enum of valid values for rendering color schemes. */
29
+ type ColorScheme = 'light' | 'dark';
30
+ /** Enum of valid values for rendering contrast. */
31
+ type Contrast = 'normal' | 'high';
32
+ /**
33
+ * Properties that describe the display preferences for an SVG template rendering.
34
+ */
35
+ type SvgTemplateProperties = {
36
+ /** OPTIONAL. Orientation optimized for the template. */
37
+ orientation?: Orientation;
38
+ /** OPTIONAL. Color scheme optimized for the template. */
39
+ color_scheme?: ColorScheme;
40
+ /** OPTIONAL. Contrast level optimized for the template. */
41
+ contrast?: Contrast;
42
+ };
43
+ /**
44
+ * SVG rendering metadata containing URI and optional integrity and properties.
45
+ */
46
+ type SvgTemplateRendering = {
47
+ /** REQUIRED. A URI pointing to the SVG template. */
48
+ uri: string;
49
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
50
+ 'uri#integrity'?: string;
51
+ /** REQUIRED if more than one SVG template is present. */
52
+ properties?: SvgTemplateProperties;
53
+ };
54
+ /**
55
+ * Rendering metadata, either simple or SVG-based, for a credential.
56
+ */
57
+ type Rendering = {
58
+ /** OPTIONAL. Simple rendering metadata. */
59
+ simple?: SimpleRendering;
60
+ /** OPTIONAL. Array of SVG template rendering objects. */
61
+ svg_template?: SvgTemplateRendering[];
62
+ };
63
+ /**
64
+ * Display metadata associated with a credential type.
65
+ */
66
+ type Display = {
67
+ /** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
68
+ lang: string;
69
+ /** REQUIRED. Human-readable name for the credential type. */
70
+ name: string;
71
+ /** OPTIONAL. Description of the credential type for end users. */
72
+ description?: string;
73
+ /** OPTIONAL. Rendering information (simple or SVG) for the credential. */
74
+ rendering?: Rendering;
75
+ };
76
+ /**
77
+ * Claim path within the credential's JSON structure.
78
+ * Example: ["address", "street_address"]
79
+ */
80
+ type ClaimPath = Array<string | null>;
81
+ /**
82
+ * Display metadata for a specific claim.
83
+ */
84
+ type ClaimDisplay = {
85
+ /** REQUIRED. Language tag according to RFC 5646. */
86
+ lang: string;
87
+ /** REQUIRED. Human-readable label for the claim. */
88
+ label: string;
89
+ /** OPTIONAL. Description of the claim for end users. */
90
+ description?: string;
91
+ };
92
+ /**
93
+ * Indicates whether a claim is selectively disclosable.
94
+ */
95
+ type ClaimSelectiveDisclosure = 'always' | 'allowed' | 'never';
96
+ /**
97
+ * Metadata for individual claims in the credential type.
98
+ */
99
+ type Claim = {
100
+ /**
101
+ * REQUIRED. Array of one or more paths to the claim in the credential subject.
102
+ * Each path is an array of strings (or null for array elements).
103
+ */
104
+ path: ClaimPath[];
105
+ /** OPTIONAL. Display metadata in multiple languages. */
106
+ display?: ClaimDisplay[];
107
+ /** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
108
+ sd?: ClaimSelectiveDisclosure;
109
+ /**
110
+ * OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
111
+ * Must consist of alphanumeric characters or underscores and must not start with a digit.
112
+ */
113
+ svg_id?: string;
114
+ };
115
+ /**
116
+ * Type metadata for a specific Verifiable Credential (VC) type.
117
+ * Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
6
118
  */
7
119
  type TypeMetadataFormat = {
120
+ /** REQUIRED. A URI uniquely identifying the credential type. */
8
121
  vct: string;
122
+ /** OPTIONAL. Human-readable name for developers. */
9
123
  name?: string;
124
+ /** OPTIONAL. Human-readable description for developers. */
10
125
  description?: string;
126
+ /** OPTIONAL. URI of another type that this one extends. */
11
127
  extends?: string;
128
+ /** OPTIONAL. Integrity metadata for the 'extends' field. */
12
129
  'extends#Integrity'?: string;
130
+ /** OPTIONAL. Array of localized display metadata for the type. */
131
+ display?: Display[];
132
+ /** OPTIONAL. Array of claim metadata. */
133
+ claims?: Claim[];
134
+ /**
135
+ * OPTIONAL. Embedded JSON Schema describing the VC structure.
136
+ * Must not be present if schema_uri is provided.
137
+ */
13
138
  schema?: object;
139
+ /**
140
+ * OPTIONAL. URI pointing to a JSON Schema for the VC structure.
141
+ * Must not be present if schema is provided.
142
+ */
14
143
  schema_uri?: string;
144
+ /** OPTIONAL. Integrity metadata for the schema_uri field. */
15
145
  'schema_uri#Integrity'?: string;
16
146
  };
17
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-jwt/sd-jwt-vc",
3
- "version": "0.11.0",
3
+ "version": "0.11.1-next.1+506b876",
4
4
  "description": "sd-jwt draft 7 implementation in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -39,15 +39,15 @@
39
39
  },
40
40
  "license": "Apache-2.0",
41
41
  "dependencies": {
42
- "@sd-jwt/core": "0.11.0",
43
- "@sd-jwt/jwt-status-list": "0.11.0",
44
- "@sd-jwt/utils": "0.11.0",
42
+ "@sd-jwt/core": "0.11.1-next.1+506b876",
43
+ "@sd-jwt/jwt-status-list": "0.11.1-next.1+506b876",
44
+ "@sd-jwt/utils": "0.11.1-next.1+506b876",
45
45
  "ajv": "^8.17.1",
46
46
  "ajv-formats": "^3.0.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@sd-jwt/crypto-nodejs": "0.11.0",
50
- "@sd-jwt/types": "0.11.0",
49
+ "@sd-jwt/crypto-nodejs": "0.11.1-next.1+506b876",
50
+ "@sd-jwt/types": "0.11.1-next.1+506b876",
51
51
  "jose": "^5.2.2",
52
52
  "msw": "^2.3.5"
53
53
  },
@@ -67,5 +67,5 @@
67
67
  "esm"
68
68
  ]
69
69
  },
70
- "gitHead": "2e433e767dd162497f5d9ae93d22fe208e18d801"
70
+ "gitHead": "506b8769ac8e0082ad30544338eace2d0df34294"
71
71
  }
@@ -1,13 +1,156 @@
1
1
  /**
2
- * https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-08.html#name-type-metadata-format
2
+ * Logo metadata used in rendering a credential.
3
+ */
4
+ export type Logo = {
5
+ /** REQUIRED. A URI pointing to the logo image. */
6
+ uri: string;
7
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
8
+ 'uri#integrity'?: string;
9
+ /** OPTIONAL. A string containing alternative text for the logo image. */
10
+ alt_text?: string;
11
+ };
12
+
13
+ /**
14
+ * The simple rendering method is intended for applications that do not support SVG.
15
+ */
16
+ export type SimpleRendering = {
17
+ /** OPTIONAL. Logo metadata to display for the credential. */
18
+ logo?: Logo;
19
+ /** OPTIONAL. RGB color value for the credential background (e.g., "#FFFFFF"). */
20
+ background_color?: string;
21
+ /** OPTIONAL. RGB color value for the credential text (e.g., "#000000"). */
22
+ text_color?: string;
23
+ };
24
+
25
+ /** Enum of valid values for rendering orientation. */
26
+ type Orientation = 'portrait' | 'landscape';
27
+
28
+ /** Enum of valid values for rendering color schemes. */
29
+ type ColorScheme = 'light' | 'dark';
30
+
31
+ /** Enum of valid values for rendering contrast. */
32
+ type Contrast = 'normal' | 'high';
33
+
34
+ /**
35
+ * Properties that describe the display preferences for an SVG template rendering.
36
+ */
37
+ export type SvgTemplateProperties = {
38
+ /** OPTIONAL. Orientation optimized for the template. */
39
+ orientation?: Orientation;
40
+ /** OPTIONAL. Color scheme optimized for the template. */
41
+ color_scheme?: ColorScheme;
42
+ /** OPTIONAL. Contrast level optimized for the template. */
43
+ contrast?: Contrast;
44
+ };
45
+
46
+ /**
47
+ * SVG rendering metadata containing URI and optional integrity and properties.
48
+ */
49
+ export type SvgTemplateRendering = {
50
+ /** REQUIRED. A URI pointing to the SVG template. */
51
+ uri: string;
52
+ /** OPTIONAL. An "integrity metadata" string as described in Section 7. */
53
+ 'uri#integrity'?: string;
54
+ /** REQUIRED if more than one SVG template is present. */
55
+ properties?: SvgTemplateProperties;
56
+ };
57
+
58
+ /**
59
+ * Rendering metadata, either simple or SVG-based, for a credential.
60
+ */
61
+ export type Rendering = {
62
+ /** OPTIONAL. Simple rendering metadata. */
63
+ simple?: SimpleRendering;
64
+ /** OPTIONAL. Array of SVG template rendering objects. */
65
+ svg_template?: SvgTemplateRendering[];
66
+ };
67
+
68
+ /**
69
+ * Display metadata associated with a credential type.
70
+ */
71
+ export type Display = {
72
+ /** REQUIRED. Language tag according to RFC 5646 (e.g., "en", "de"). */
73
+ lang: string;
74
+ /** REQUIRED. Human-readable name for the credential type. */
75
+ name: string;
76
+ /** OPTIONAL. Description of the credential type for end users. */
77
+ description?: string;
78
+ /** OPTIONAL. Rendering information (simple or SVG) for the credential. */
79
+ rendering?: Rendering;
80
+ };
81
+
82
+ /**
83
+ * Claim path within the credential's JSON structure.
84
+ * Example: ["address", "street_address"]
85
+ */
86
+ export type ClaimPath = Array<string | null>;
87
+
88
+ /**
89
+ * Display metadata for a specific claim.
90
+ */
91
+ export type ClaimDisplay = {
92
+ /** REQUIRED. Language tag according to RFC 5646. */
93
+ lang: string;
94
+ /** REQUIRED. Human-readable label for the claim. */
95
+ label: string;
96
+ /** OPTIONAL. Description of the claim for end users. */
97
+ description?: string;
98
+ };
99
+
100
+ /**
101
+ * Indicates whether a claim is selectively disclosable.
102
+ */
103
+ export type ClaimSelectiveDisclosure = 'always' | 'allowed' | 'never';
104
+
105
+ /**
106
+ * Metadata for individual claims in the credential type.
107
+ */
108
+ export type Claim = {
109
+ /**
110
+ * REQUIRED. Array of one or more paths to the claim in the credential subject.
111
+ * Each path is an array of strings (or null for array elements).
112
+ */
113
+ path: ClaimPath[];
114
+ /** OPTIONAL. Display metadata in multiple languages. */
115
+ display?: ClaimDisplay[];
116
+ /** OPTIONAL. Controls whether the claim must, may, or must not be selectively disclosed. */
117
+ sd?: ClaimSelectiveDisclosure;
118
+ /**
119
+ * OPTIONAL. Unique string identifier for referencing the claim in an SVG template.
120
+ * Must consist of alphanumeric characters or underscores and must not start with a digit.
121
+ */
122
+ svg_id?: string;
123
+ };
124
+
125
+ /**
126
+ * Type metadata for a specific Verifiable Credential (VC) type.
127
+ * Reference: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-09.html#name-type-metadata-format
3
128
  */
4
129
  export type TypeMetadataFormat = {
5
- vct: string; // REQUIRED. A URI that uniquely identifies the type. This URI MUST be dereferenceable to a JSON document that describes the type.
6
- name?: string; // OPTIONAL. A human-readable name for the type, intended for developers reading the JSON document.
7
- description?: string; // OPTIONAL. A human-readable description for the type, intended for developers reading the JSON document.
8
- extends?: string; // OPTIONAL. A URI of another type that this type extends, as described in Section 6.4.
9
- 'extends#Integrity'?: string; // OPTIONAL. Validating the ingegrity of the extends field
10
- schema?: object; // OPTIONAL. An embedded JSON Schema document describing the structure of the Verifiable Credential as described in Section 6.5.1. schema MUST NOT be used if schema_uri is present.
11
- schema_uri?: string; // OPTIONAL. A URL pointing to a JSON Schema document describing the structure of the Verifiable Credential as described in Section 6.5.1. schema_uri MUST NOT be used if schema is present.
12
- 'schema_uri#Integrity'?: string; // OPTIONAL. Validating the integrity of the schema_uri field.
130
+ /** REQUIRED. A URI uniquely identifying the credential type. */
131
+ vct: string;
132
+ /** OPTIONAL. Human-readable name for developers. */
133
+ name?: string;
134
+ /** OPTIONAL. Human-readable description for developers. */
135
+ description?: string;
136
+ /** OPTIONAL. URI of another type that this one extends. */
137
+ extends?: string;
138
+ /** OPTIONAL. Integrity metadata for the 'extends' field. */
139
+ 'extends#Integrity'?: string;
140
+ /** OPTIONAL. Array of localized display metadata for the type. */
141
+ display?: Display[];
142
+ /** OPTIONAL. Array of claim metadata. */
143
+ claims?: Claim[];
144
+ /**
145
+ * OPTIONAL. Embedded JSON Schema describing the VC structure.
146
+ * Must not be present if schema_uri is provided.
147
+ */
148
+ schema?: object;
149
+ /**
150
+ * OPTIONAL. URI pointing to a JSON Schema for the VC structure.
151
+ * Must not be present if schema is provided.
152
+ */
153
+ schema_uri?: string;
154
+ /** OPTIONAL. Integrity metadata for the schema_uri field. */
155
+ 'schema_uri#Integrity'?: string;
13
156
  };