@sphereon/ssi-types 0.23.5-unstable.88 → 0.24.0

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.
@@ -1,273 +1,273 @@
1
- import { OriginalType, WrappedVerifiableCredential, WrappedVerifiablePresentation } from './vc'
2
- import { decodeSdJwtSync, decodeSdJwt, getClaims, getClaimsSync } from '@sd-jwt/decode'
3
- import { CompactJWT } from './w3c-vc'
4
-
5
- type JsonValue = string | number | boolean | { [x: string]: JsonValue | undefined } | Array<JsonValue>
6
-
7
- type SdJwtJsonValue =
8
- | string
9
- | number
10
- | boolean
11
- | {
12
- [x: string]: SdJwtJsonValue | undefined
13
- _sd?: string[]
14
- }
15
- | Array<SdJwtJsonValue | { '...': string }>
16
-
17
- /**
18
- * Decoded 'pretty' SD JWT Verifiable Credential. This representation has all the `_sd` properties
19
- * removed, and includes the disclosures directly within the payload.
20
- */
21
- export interface SdJwtDecodedVerifiableCredentialPayload {
22
- vct: string
23
- iss: string
24
- iat: number
25
- nbf?: number
26
- exp?: number
27
- cnf?: {
28
- jwk?: any
29
- kid?: string
30
- }
31
- status?: {
32
- idx: number
33
- uri: string
34
- }
35
- sub?: string
36
-
37
- [key: string]: JsonValue | undefined
38
- }
39
-
40
- /**
41
- * Represents a selective disclosure JWT vc in compact form.
42
- */
43
- export type CompactSdJwtVc = string
44
-
45
- /**
46
- * The signed payload of an SD-JWT. Includes fields such as `_sd`, `...` and `_sd_alg`
47
- */
48
- interface SdJwtSignedVerifiableCredentialPayload extends SdJwtDecodedVerifiableCredentialPayload {
49
- // Only present if there are any selectively discloseable claims
50
- _sd?: string[]
51
- _sd_alg?: string
52
-
53
- [x: string]: SdJwtJsonValue | undefined
54
- }
55
-
56
- type SdJwtFrameValue = boolean | Array<SdJwtFrameValue> | { [x: string]: SdJwtFrameValue }
57
- export type SdJwtDisclosureFrame = Record<string, SdJwtFrameValue>
58
- export type SdJwtPresentationFrame = Record<string, SdJwtFrameValue>
59
-
60
- /**
61
- * Input for creating a SD JWT Verifiable Credential. This representation optionally includes the disclosure frame,
62
- * (as `__disclosureFrame`) to indicate which fields in the signed SD-JWT should be selectively discloseable
63
- */
64
- export interface SdJwtCredentialInput extends SdJwtDecodedVerifiableCredentialPayload {
65
- /**
66
- * Disclosure frame, indicating which fields in the signed SD-JWT should be selectively discloseable
67
- * Will be removed from the actual SD-JWT payload before signing
68
- */
69
- __disclosureFrame?: SdJwtDisclosureFrame
70
- }
71
-
72
- export type SdJwtDecodedDisclosure = [string, string, JsonValue] | [string, JsonValue]
73
- export interface SdJwtDisclosure {
74
- // The encoded disclosure
75
- encoded: string
76
-
77
- // The decoded disclosure, in format [salt, claim, value] or in case of array entry [salt, value]
78
- decoded: SdJwtDecodedDisclosure
79
-
80
- // Digest over disclosure, can be used to match against a value within the SD JWT payload
81
- digest: string
82
- }
83
-
84
- /**
85
- * The decoded SD JWT Verifiable Credential. This representation includes multiple representations of the
86
- * same SD-JWT, and allows to fully process an SD-JWT, as well as create a presentation SD-JWT (minus the KB-JWT) by removing
87
- * certain disclosures from the compact SD-JWT.
88
- *
89
- * This representation is useful as it doesn't require a hasher implementation to match the different digests in the signed SD-JWT
90
- * payload, with the different disclosures.
91
- */
92
- export interface SdJwtDecodedVerifiableCredential {
93
- /**
94
- * The compact sd jwt is the sd-jwt encoded as string. It is a normal JWT,
95
- * with the disclosures and kb-jwt appended separated by ~ */
96
- compactSdJwtVc: string
97
-
98
- /**
99
- * The disclosures included within the SD-JWT in both encoded and decoded format.
100
- * The digests are also included, and allows the disclosures to be linked against
101
- * the digests in the signed payload.
102
- */
103
- disclosures: Array<SdJwtDisclosure>
104
-
105
- /**
106
- * The signed payload is the payload of the sd-jwt that is actually signed, and that includes
107
- * the `_sd` and `...` digests.
108
- */
109
- signedPayload: SdJwtSignedVerifiableCredentialPayload
110
-
111
- /**
112
- * The decoded payload is the payload when all `_sd` and `...` digests have been replaced
113
- * by the actual values from the disclosures. This format could also be seen as the 'pretty`
114
- * version of the SD JWT payload.
115
- *
116
- * This is useful for displaying the contents of the SD JWT VC to the user, or for example
117
- * for querying the contents of the SD JWT VC using a PEX presentation definition path.
118
- */
119
- decodedPayload: SdJwtDecodedVerifiableCredentialPayload
120
-
121
- /**
122
- * Key binding JWT
123
- */
124
- kbJwt?: {
125
- compact: CompactJWT
126
- payload: SdJwtVcKbJwtPayload
127
- }
128
- }
129
-
130
- interface SdJwtVcKbJwtPayload {
131
- iat: number
132
- aud: string
133
- nonce: string
134
- sd_hash: string
135
- [key: string]: unknown
136
- }
137
-
138
- export interface WrappedSdJwtVerifiableCredential {
139
- /**
140
- * Original VC that we've received. Can be either the encoded or decoded variant.
141
- */
142
- original: SdJwtDecodedVerifiableCredential | CompactSdJwtVc
143
- /**
144
- * Decoded version of the SD-JWT payload. This is the decoded payload, rather than the whole SD-JWT as the `decoded` property
145
- * is used in e.g. PEX to check for path filters from fields. The full decoded credential can be found in the `credential` field.
146
- */
147
- decoded: SdJwtDecodedVerifiableCredentialPayload
148
- /**
149
- * Type of this credential.
150
- */
151
- type: OriginalType.SD_JWT_VC_DECODED | OriginalType.SD_JWT_VC_ENCODED
152
- /**
153
- * The claim format, typically used during exchange transport protocols
154
- */
155
- format: 'vc+sd-jwt'
156
- /**
157
- * Internal stable representation of a Credential
158
- */
159
- credential: SdJwtDecodedVerifiableCredential
160
- }
161
-
162
- export interface WrappedSdJwtVerifiablePresentation {
163
- /**
164
- * Original VP that we've received. Can be either the encoded or decoded variant.
165
- */
166
- original: SdJwtDecodedVerifiableCredential | CompactSdJwtVc
167
- /**
168
- * Decoded version of the SD-JWT payload. This is the decoded payload, rather than the whole SD-JWT.
169
- */
170
- decoded: SdJwtDecodedVerifiableCredentialPayload
171
- /**
172
- * Type of this Presentation.
173
- */
174
- type: OriginalType.SD_JWT_VC_DECODED | OriginalType.SD_JWT_VC_ENCODED
175
- /**
176
- * The claim format, typically used during exchange transport protocols
177
- */
178
- format: 'vc+sd-jwt'
179
- /**
180
- * Internal stable representation of a Presentation
181
- */
182
- presentation: SdJwtDecodedVerifiableCredential
183
- /**
184
- * Wrapped Verifiable Credentials belonging to the Presentation. Will always be an array
185
- * with a single SdJwtVerifiableCredential entry.
186
- */
187
- vcs: [WrappedSdJwtVerifiableCredential]
188
- }
189
-
190
- export function isWrappedSdJwtVerifiableCredential(vc: WrappedVerifiableCredential): vc is WrappedSdJwtVerifiableCredential {
191
- return vc.format === 'vc+sd-jwt'
192
- }
193
-
194
- export function isWrappedSdJwtVerifiablePresentation(vp: WrappedVerifiablePresentation): vp is WrappedSdJwtVerifiablePresentation {
195
- return vp.format === 'vc+sd-jwt'
196
- }
197
-
198
- export type Hasher = (data: string, alg: string) => Uint8Array
199
- export type AsyncHasher = (data: string, alg: string) => Promise<Uint8Array>
200
-
201
- /**
202
- * Decode an SD-JWT vc from its compact format (string) to an object containing the disclosures,
203
- * signed payload, decoded payload and the compact SD-JWT vc.
204
- *
205
- * Both the input and output interfaces of this method are defined in `@sphereon/ssi-types`, so
206
- * this method hides the actual implementation of SD-JWT (which is currently based on @sd-jwt/core)
207
- */
208
- export function decodeSdJwtVc(compactSdJwtVc: CompactSdJwtVc, hasher: Hasher): SdJwtDecodedVerifiableCredential {
209
- const { jwt, disclosures, kbJwt } = decodeSdJwtSync(compactSdJwtVc, hasher)
210
-
211
- const signedPayload = jwt.payload as SdJwtSignedVerifiableCredentialPayload
212
- const decodedPayload = getClaimsSync(signedPayload, disclosures, hasher)
213
- const compactKeyBindingJwt = kbJwt ? compactSdJwtVc.split('~').pop() : undefined
214
-
215
- return {
216
- compactSdJwtVc,
217
- decodedPayload: decodedPayload as SdJwtDecodedVerifiableCredentialPayload,
218
- disclosures: disclosures.map((d) => {
219
- const decoded = d.key ? [d.salt, d.key, d.value] : [d.salt, d.value]
220
- if (!d._digest) throw new Error('Implementation error: digest not present in disclosure')
221
- return {
222
- decoded: decoded as SdJwtDecodedDisclosure,
223
- digest: d._digest,
224
- encoded: d.encode(),
225
- } satisfies SdJwtDisclosure
226
- }),
227
- signedPayload: signedPayload as SdJwtSignedVerifiableCredentialPayload,
228
- kbJwt:
229
- compactKeyBindingJwt && kbJwt
230
- ? {
231
- compact: compactKeyBindingJwt,
232
- payload: kbJwt.payload as SdJwtVcKbJwtPayload,
233
- }
234
- : undefined,
235
- }
236
- }
237
-
238
- /**
239
- * Decode an SD-JWT vc from its compact format (string) to an object containing the disclosures,
240
- * signed payload, decoded payload and the compact SD-JWT vc.
241
- *
242
- * Both the input and output interfaces of this method are defined in `@sphereon/ssi-types`, so
243
- * this method hides the actual implementation of SD-JWT (which is currently based on @sd-jwt/core)
244
- */
245
- export async function decodeSdJwtVcAsync(compactSdJwtVc: CompactSdJwtVc, hasher: AsyncHasher): Promise<SdJwtDecodedVerifiableCredential> {
246
- const { jwt, disclosures, kbJwt } = await decodeSdJwt(compactSdJwtVc, hasher)
247
-
248
- const signedPayload = jwt.payload as SdJwtSignedVerifiableCredentialPayload
249
- const decodedPayload = await getClaims(signedPayload, disclosures, hasher)
250
- const compactKeyBindingJwt = kbJwt ? compactSdJwtVc.split('~').pop() : undefined
251
-
252
- return {
253
- compactSdJwtVc,
254
- decodedPayload: decodedPayload as SdJwtDecodedVerifiableCredentialPayload,
255
- disclosures: disclosures.map((d) => {
256
- const decoded = d.key ? [d.salt, d.key, d.value] : [d.salt, d.value]
257
- if (!d._digest) throw new Error('Implementation error: digest not present in disclosure')
258
- return {
259
- decoded: decoded as SdJwtDecodedDisclosure,
260
- digest: d._digest,
261
- encoded: d.encode(),
262
- } satisfies SdJwtDisclosure
263
- }),
264
- signedPayload: signedPayload as SdJwtSignedVerifiableCredentialPayload,
265
- kbJwt:
266
- compactKeyBindingJwt && kbJwt
267
- ? {
268
- compact: compactKeyBindingJwt,
269
- payload: kbJwt.payload as SdJwtVcKbJwtPayload,
270
- }
271
- : undefined,
272
- }
273
- }
1
+ import { OriginalType, WrappedVerifiableCredential, WrappedVerifiablePresentation } from './vc'
2
+ import { decodeSdJwtSync, decodeSdJwt, getClaims, getClaimsSync } from '@sd-jwt/decode'
3
+ import { CompactJWT } from './w3c-vc'
4
+
5
+ type JsonValue = string | number | boolean | { [x: string]: JsonValue | undefined } | Array<JsonValue>
6
+
7
+ type SdJwtJsonValue =
8
+ | string
9
+ | number
10
+ | boolean
11
+ | {
12
+ [x: string]: SdJwtJsonValue | undefined
13
+ _sd?: string[]
14
+ }
15
+ | Array<SdJwtJsonValue | { '...': string }>
16
+
17
+ /**
18
+ * Decoded 'pretty' SD JWT Verifiable Credential. This representation has all the `_sd` properties
19
+ * removed, and includes the disclosures directly within the payload.
20
+ */
21
+ export interface SdJwtDecodedVerifiableCredentialPayload {
22
+ vct: string
23
+ iss: string
24
+ iat: number
25
+ nbf?: number
26
+ exp?: number
27
+ cnf?: {
28
+ jwk?: any
29
+ kid?: string
30
+ }
31
+ status?: {
32
+ idx: number
33
+ uri: string
34
+ }
35
+ sub?: string
36
+
37
+ [key: string]: JsonValue | undefined
38
+ }
39
+
40
+ /**
41
+ * Represents a selective disclosure JWT vc in compact form.
42
+ */
43
+ export type CompactSdJwtVc = string
44
+
45
+ /**
46
+ * The signed payload of an SD-JWT. Includes fields such as `_sd`, `...` and `_sd_alg`
47
+ */
48
+ interface SdJwtSignedVerifiableCredentialPayload extends SdJwtDecodedVerifiableCredentialPayload {
49
+ // Only present if there are any selectively discloseable claims
50
+ _sd?: string[]
51
+ _sd_alg?: string
52
+
53
+ [x: string]: SdJwtJsonValue | undefined
54
+ }
55
+
56
+ type SdJwtFrameValue = boolean | Array<SdJwtFrameValue> | { [x: string]: SdJwtFrameValue }
57
+ export type SdJwtDisclosureFrame = Record<string, SdJwtFrameValue>
58
+ export type SdJwtPresentationFrame = Record<string, SdJwtFrameValue>
59
+
60
+ /**
61
+ * Input for creating a SD JWT Verifiable Credential. This representation optionally includes the disclosure frame,
62
+ * (as `__disclosureFrame`) to indicate which fields in the signed SD-JWT should be selectively discloseable
63
+ */
64
+ export interface SdJwtCredentialInput extends SdJwtDecodedVerifiableCredentialPayload {
65
+ /**
66
+ * Disclosure frame, indicating which fields in the signed SD-JWT should be selectively discloseable
67
+ * Will be removed from the actual SD-JWT payload before signing
68
+ */
69
+ __disclosureFrame?: SdJwtDisclosureFrame
70
+ }
71
+
72
+ export type SdJwtDecodedDisclosure = [string, string, JsonValue] | [string, JsonValue]
73
+ export interface SdJwtDisclosure {
74
+ // The encoded disclosure
75
+ encoded: string
76
+
77
+ // The decoded disclosure, in format [salt, claim, value] or in case of array entry [salt, value]
78
+ decoded: SdJwtDecodedDisclosure
79
+
80
+ // Digest over disclosure, can be used to match against a value within the SD JWT payload
81
+ digest: string
82
+ }
83
+
84
+ /**
85
+ * The decoded SD JWT Verifiable Credential. This representation includes multiple representations of the
86
+ * same SD-JWT, and allows to fully process an SD-JWT, as well as create a presentation SD-JWT (minus the KB-JWT) by removing
87
+ * certain disclosures from the compact SD-JWT.
88
+ *
89
+ * This representation is useful as it doesn't require a hasher implementation to match the different digests in the signed SD-JWT
90
+ * payload, with the different disclosures.
91
+ */
92
+ export interface SdJwtDecodedVerifiableCredential {
93
+ /**
94
+ * The compact sd jwt is the sd-jwt encoded as string. It is a normal JWT,
95
+ * with the disclosures and kb-jwt appended separated by ~ */
96
+ compactSdJwtVc: string
97
+
98
+ /**
99
+ * The disclosures included within the SD-JWT in both encoded and decoded format.
100
+ * The digests are also included, and allows the disclosures to be linked against
101
+ * the digests in the signed payload.
102
+ */
103
+ disclosures: Array<SdJwtDisclosure>
104
+
105
+ /**
106
+ * The signed payload is the payload of the sd-jwt that is actually signed, and that includes
107
+ * the `_sd` and `...` digests.
108
+ */
109
+ signedPayload: SdJwtSignedVerifiableCredentialPayload
110
+
111
+ /**
112
+ * The decoded payload is the payload when all `_sd` and `...` digests have been replaced
113
+ * by the actual values from the disclosures. This format could also be seen as the 'pretty`
114
+ * version of the SD JWT payload.
115
+ *
116
+ * This is useful for displaying the contents of the SD JWT VC to the user, or for example
117
+ * for querying the contents of the SD JWT VC using a PEX presentation definition path.
118
+ */
119
+ decodedPayload: SdJwtDecodedVerifiableCredentialPayload
120
+
121
+ /**
122
+ * Key binding JWT
123
+ */
124
+ kbJwt?: {
125
+ compact: CompactJWT
126
+ payload: SdJwtVcKbJwtPayload
127
+ }
128
+ }
129
+
130
+ interface SdJwtVcKbJwtPayload {
131
+ iat: number
132
+ aud: string
133
+ nonce: string
134
+ sd_hash: string
135
+ [key: string]: unknown
136
+ }
137
+
138
+ export interface WrappedSdJwtVerifiableCredential {
139
+ /**
140
+ * Original VC that we've received. Can be either the encoded or decoded variant.
141
+ */
142
+ original: SdJwtDecodedVerifiableCredential | CompactSdJwtVc
143
+ /**
144
+ * Decoded version of the SD-JWT payload. This is the decoded payload, rather than the whole SD-JWT as the `decoded` property
145
+ * is used in e.g. PEX to check for path filters from fields. The full decoded credential can be found in the `credential` field.
146
+ */
147
+ decoded: SdJwtDecodedVerifiableCredentialPayload
148
+ /**
149
+ * Type of this credential.
150
+ */
151
+ type: OriginalType.SD_JWT_VC_DECODED | OriginalType.SD_JWT_VC_ENCODED
152
+ /**
153
+ * The claim format, typically used during exchange transport protocols
154
+ */
155
+ format: 'vc+sd-jwt'
156
+ /**
157
+ * Internal stable representation of a Credential
158
+ */
159
+ credential: SdJwtDecodedVerifiableCredential
160
+ }
161
+
162
+ export interface WrappedSdJwtVerifiablePresentation {
163
+ /**
164
+ * Original VP that we've received. Can be either the encoded or decoded variant.
165
+ */
166
+ original: SdJwtDecodedVerifiableCredential | CompactSdJwtVc
167
+ /**
168
+ * Decoded version of the SD-JWT payload. This is the decoded payload, rather than the whole SD-JWT.
169
+ */
170
+ decoded: SdJwtDecodedVerifiableCredentialPayload
171
+ /**
172
+ * Type of this Presentation.
173
+ */
174
+ type: OriginalType.SD_JWT_VC_DECODED | OriginalType.SD_JWT_VC_ENCODED
175
+ /**
176
+ * The claim format, typically used during exchange transport protocols
177
+ */
178
+ format: 'vc+sd-jwt'
179
+ /**
180
+ * Internal stable representation of a Presentation
181
+ */
182
+ presentation: SdJwtDecodedVerifiableCredential
183
+ /**
184
+ * Wrapped Verifiable Credentials belonging to the Presentation. Will always be an array
185
+ * with a single SdJwtVerifiableCredential entry.
186
+ */
187
+ vcs: [WrappedSdJwtVerifiableCredential]
188
+ }
189
+
190
+ export function isWrappedSdJwtVerifiableCredential(vc: WrappedVerifiableCredential): vc is WrappedSdJwtVerifiableCredential {
191
+ return vc.format === 'vc+sd-jwt'
192
+ }
193
+
194
+ export function isWrappedSdJwtVerifiablePresentation(vp: WrappedVerifiablePresentation): vp is WrappedSdJwtVerifiablePresentation {
195
+ return vp.format === 'vc+sd-jwt'
196
+ }
197
+
198
+ export type Hasher = (data: string, alg: string) => Uint8Array
199
+ export type AsyncHasher = (data: string, alg: string) => Promise<Uint8Array>
200
+
201
+ /**
202
+ * Decode an SD-JWT vc from its compact format (string) to an object containing the disclosures,
203
+ * signed payload, decoded payload and the compact SD-JWT vc.
204
+ *
205
+ * Both the input and output interfaces of this method are defined in `@sphereon/ssi-types`, so
206
+ * this method hides the actual implementation of SD-JWT (which is currently based on @sd-jwt/core)
207
+ */
208
+ export function decodeSdJwtVc(compactSdJwtVc: CompactSdJwtVc, hasher: Hasher): SdJwtDecodedVerifiableCredential {
209
+ const { jwt, disclosures, kbJwt } = decodeSdJwtSync(compactSdJwtVc, hasher)
210
+
211
+ const signedPayload = jwt.payload as SdJwtSignedVerifiableCredentialPayload
212
+ const decodedPayload = getClaimsSync(signedPayload, disclosures, hasher)
213
+ const compactKeyBindingJwt = kbJwt ? compactSdJwtVc.split('~').pop() : undefined
214
+
215
+ return {
216
+ compactSdJwtVc,
217
+ decodedPayload: decodedPayload as SdJwtDecodedVerifiableCredentialPayload,
218
+ disclosures: disclosures.map((d) => {
219
+ const decoded = d.key ? [d.salt, d.key, d.value] : [d.salt, d.value]
220
+ if (!d._digest) throw new Error('Implementation error: digest not present in disclosure')
221
+ return {
222
+ decoded: decoded as SdJwtDecodedDisclosure,
223
+ digest: d._digest,
224
+ encoded: d.encode(),
225
+ } satisfies SdJwtDisclosure
226
+ }),
227
+ signedPayload: signedPayload as SdJwtSignedVerifiableCredentialPayload,
228
+ kbJwt:
229
+ compactKeyBindingJwt && kbJwt
230
+ ? {
231
+ compact: compactKeyBindingJwt,
232
+ payload: kbJwt.payload as SdJwtVcKbJwtPayload,
233
+ }
234
+ : undefined,
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Decode an SD-JWT vc from its compact format (string) to an object containing the disclosures,
240
+ * signed payload, decoded payload and the compact SD-JWT vc.
241
+ *
242
+ * Both the input and output interfaces of this method are defined in `@sphereon/ssi-types`, so
243
+ * this method hides the actual implementation of SD-JWT (which is currently based on @sd-jwt/core)
244
+ */
245
+ export async function decodeSdJwtVcAsync(compactSdJwtVc: CompactSdJwtVc, hasher: AsyncHasher): Promise<SdJwtDecodedVerifiableCredential> {
246
+ const { jwt, disclosures, kbJwt } = await decodeSdJwt(compactSdJwtVc, hasher)
247
+
248
+ const signedPayload = jwt.payload as SdJwtSignedVerifiableCredentialPayload
249
+ const decodedPayload = await getClaims(signedPayload, disclosures, hasher)
250
+ const compactKeyBindingJwt = kbJwt ? compactSdJwtVc.split('~').pop() : undefined
251
+
252
+ return {
253
+ compactSdJwtVc,
254
+ decodedPayload: decodedPayload as SdJwtDecodedVerifiableCredentialPayload,
255
+ disclosures: disclosures.map((d) => {
256
+ const decoded = d.key ? [d.salt, d.key, d.value] : [d.salt, d.value]
257
+ if (!d._digest) throw new Error('Implementation error: digest not present in disclosure')
258
+ return {
259
+ decoded: decoded as SdJwtDecodedDisclosure,
260
+ digest: d._digest,
261
+ encoded: d.encode(),
262
+ } satisfies SdJwtDisclosure
263
+ }),
264
+ signedPayload: signedPayload as SdJwtSignedVerifiableCredentialPayload,
265
+ kbJwt:
266
+ compactKeyBindingJwt && kbJwt
267
+ ? {
268
+ compact: compactKeyBindingJwt,
269
+ payload: kbJwt.payload as SdJwtVcKbJwtPayload,
270
+ }
271
+ : undefined,
272
+ }
273
+ }
package/src/types/vc.ts CHANGED
@@ -1,62 +1,62 @@
1
- import { SdJwtDecodedVerifiableCredential, WrappedSdJwtVerifiableCredential, WrappedSdJwtVerifiablePresentation } from './sd-jwt-vc'
2
- import {
3
- JwtDecodedVerifiableCredential,
4
- JwtDecodedVerifiablePresentation,
5
- W3CVerifiableCredential,
6
- W3CVerifiablePresentation,
7
- WrappedW3CVerifiableCredential,
8
- WrappedW3CVerifiablePresentation,
9
- } from './w3c-vc'
10
-
11
- export type WrappedVerifiableCredential = WrappedW3CVerifiableCredential | WrappedSdJwtVerifiableCredential
12
-
13
- export type WrappedVerifiablePresentation = WrappedW3CVerifiablePresentation | WrappedSdJwtVerifiablePresentation
14
-
15
- export enum OriginalType {
16
- // W3C
17
- JSONLD = 'json-ld',
18
- JWT_ENCODED = 'jwt-encoded',
19
- JWT_DECODED = 'jwt-decoded',
20
-
21
- // SD-JWT
22
- SD_JWT_VC_ENCODED = 'sd-jwt-vc-encoded',
23
- SD_JWT_VC_DECODED = 'sd-jwt-vc-decoded',
24
- }
25
-
26
- export type CredentialFormat =
27
- // W3C
28
- | 'jwt_vc'
29
- | 'ldp_vc'
30
- // SD-JWT
31
- | 'vc+sd-jwt'
32
- // Remaining
33
- | 'jwt'
34
- | 'ldp'
35
- | string
36
-
37
- export type PresentationFormat =
38
- // W3C
39
- | 'jwt_vp'
40
- | 'ldp_vp'
41
- // SD-JWT
42
- | 'vc+sd-jwt'
43
- // Remaining
44
- | 'jwt'
45
- | 'ldp'
46
- | string
47
-
48
- export type ClaimFormat = CredentialFormat | PresentationFormat
49
-
50
- export type OriginalVerifiableCredential = W3CVerifiableCredential | JwtDecodedVerifiableCredential | SdJwtDecodedVerifiableCredential
51
- export type OriginalVerifiablePresentation = W3CVerifiablePresentation | JwtDecodedVerifiablePresentation | SdJwtDecodedVerifiableCredential
52
- export type Original = OriginalVerifiablePresentation | OriginalVerifiableCredential
53
-
54
- export const enum DocumentFormat {
55
- // W3C
56
- JWT,
57
- JSONLD,
58
- // SD-JWT
59
- SD_JWT_VC,
60
- // Remaining
61
- EIP712,
62
- }
1
+ import { SdJwtDecodedVerifiableCredential, WrappedSdJwtVerifiableCredential, WrappedSdJwtVerifiablePresentation } from './sd-jwt-vc'
2
+ import {
3
+ JwtDecodedVerifiableCredential,
4
+ JwtDecodedVerifiablePresentation,
5
+ W3CVerifiableCredential,
6
+ W3CVerifiablePresentation,
7
+ WrappedW3CVerifiableCredential,
8
+ WrappedW3CVerifiablePresentation,
9
+ } from './w3c-vc'
10
+
11
+ export type WrappedVerifiableCredential = WrappedW3CVerifiableCredential | WrappedSdJwtVerifiableCredential
12
+
13
+ export type WrappedVerifiablePresentation = WrappedW3CVerifiablePresentation | WrappedSdJwtVerifiablePresentation
14
+
15
+ export enum OriginalType {
16
+ // W3C
17
+ JSONLD = 'json-ld',
18
+ JWT_ENCODED = 'jwt-encoded',
19
+ JWT_DECODED = 'jwt-decoded',
20
+
21
+ // SD-JWT
22
+ SD_JWT_VC_ENCODED = 'sd-jwt-vc-encoded',
23
+ SD_JWT_VC_DECODED = 'sd-jwt-vc-decoded',
24
+ }
25
+
26
+ export type CredentialFormat =
27
+ // W3C
28
+ | 'jwt_vc'
29
+ | 'ldp_vc'
30
+ // SD-JWT
31
+ | 'vc+sd-jwt'
32
+ // Remaining
33
+ | 'jwt'
34
+ | 'ldp'
35
+ | string
36
+
37
+ export type PresentationFormat =
38
+ // W3C
39
+ | 'jwt_vp'
40
+ | 'ldp_vp'
41
+ // SD-JWT
42
+ | 'vc+sd-jwt'
43
+ // Remaining
44
+ | 'jwt'
45
+ | 'ldp'
46
+ | string
47
+
48
+ export type ClaimFormat = CredentialFormat | PresentationFormat
49
+
50
+ export type OriginalVerifiableCredential = W3CVerifiableCredential | JwtDecodedVerifiableCredential | SdJwtDecodedVerifiableCredential
51
+ export type OriginalVerifiablePresentation = W3CVerifiablePresentation | JwtDecodedVerifiablePresentation | SdJwtDecodedVerifiableCredential
52
+ export type Original = OriginalVerifiablePresentation | OriginalVerifiableCredential
53
+
54
+ export const enum DocumentFormat {
55
+ // W3C
56
+ JWT,
57
+ JSONLD,
58
+ // SD-JWT
59
+ SD_JWT_VC,
60
+ // Remaining
61
+ EIP712,
62
+ }