@kya-os/contracts 1.3.2 → 1.3.4
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/package.json +28 -5
- package/README.md +0 -130
- package/dist/cli.d.ts +0 -378
- package/dist/cli.js +0 -116
- package/dist/delegation/constraints.d.ts +0 -992
- package/dist/delegation/constraints.js +0 -210
- package/dist/delegation/index.d.ts +0 -8
- package/dist/delegation/index.js +0 -24
- package/dist/delegation/schemas.d.ts +0 -8382
- package/dist/delegation/schemas.js +0 -476
- package/dist/did/index.d.ts +0 -9
- package/dist/did/index.js +0 -25
- package/dist/did/resolve-contract.d.ts +0 -220
- package/dist/did/resolve-contract.js +0 -32
- package/dist/did/schemas.d.ts +0 -113
- package/dist/did/schemas.js +0 -173
- package/dist/did/types.d.ts +0 -164
- package/dist/did/types.js +0 -71
- package/dist/env/constants.d.ts +0 -58
- package/dist/env/constants.js +0 -60
- package/dist/env/index.d.ts +0 -5
- package/dist/env/index.js +0 -21
- package/dist/handshake.d.ts +0 -159
- package/dist/handshake.js +0 -58
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -53
- package/dist/proof/index.d.ts +0 -9
- package/dist/proof/index.js +0 -25
- package/dist/proof/proof-record.d.ts +0 -838
- package/dist/proof/proof-record.js +0 -134
- package/dist/proof/signing-spec.d.ts +0 -147
- package/dist/proof/signing-spec.js +0 -123
- package/dist/proof.d.ts +0 -400
- package/dist/proof.js +0 -82
- package/dist/registry.d.ts +0 -343
- package/dist/registry.js +0 -119
- package/dist/runtime/errors.d.ts +0 -348
- package/dist/runtime/errors.js +0 -120
- package/dist/runtime/headers.d.ts +0 -84
- package/dist/runtime/headers.js +0 -82
- package/dist/runtime/index.d.ts +0 -6
- package/dist/runtime/index.js +0 -22
- package/dist/test.d.ts +0 -252
- package/dist/test.js +0 -120
- package/dist/tlkrc/index.d.ts +0 -5
- package/dist/tlkrc/index.js +0 -21
- package/dist/tlkrc/rotation.d.ts +0 -246
- package/dist/tlkrc/rotation.js +0 -127
- package/dist/utils/validation.d.ts +0 -31
- package/dist/utils/validation.js +0 -70
- package/dist/vc/index.d.ts +0 -8
- package/dist/vc/index.js +0 -24
- package/dist/vc/schemas.d.ts +0 -2484
- package/dist/vc/schemas.js +0 -225
- package/dist/vc/statuslist.d.ts +0 -494
- package/dist/vc/statuslist.js +0 -133
- package/dist/verifier.d.ts +0 -206
- package/dist/verifier.js +0 -84
package/dist/vc/statuslist.d.ts
DELETED
|
@@ -1,494 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StatusList2021 Types and Schemas
|
|
3
|
-
*
|
|
4
|
-
* Implementation of the W3C StatusList2021 specification for credential status.
|
|
5
|
-
* Provides types for status list credentials and helpers for bitstring operations.
|
|
6
|
-
*
|
|
7
|
-
* Related Spec: W3C StatusList2021
|
|
8
|
-
* Python Reference: Credential-Documentation.md (StatusList2021 section)
|
|
9
|
-
*/
|
|
10
|
-
import { z } from 'zod';
|
|
11
|
-
/**
|
|
12
|
-
* Status Purpose
|
|
13
|
-
*
|
|
14
|
-
* Indicates the purpose of the status list
|
|
15
|
-
*/
|
|
16
|
-
export type StatusPurpose = 'revocation' | 'suspension';
|
|
17
|
-
/**
|
|
18
|
-
* Status List Credential Subject Schema
|
|
19
|
-
*
|
|
20
|
-
* The credential subject of a StatusList2021Credential
|
|
21
|
-
*/
|
|
22
|
-
export declare const StatusList2021CredentialSubjectSchema: z.ZodObject<{
|
|
23
|
-
/** Optional identifier for the status list */
|
|
24
|
-
id: z.ZodOptional<z.ZodString>;
|
|
25
|
-
/** Type MUST be StatusList2021 */
|
|
26
|
-
type: z.ZodLiteral<"StatusList2021">;
|
|
27
|
-
/** Purpose of the status list */
|
|
28
|
-
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
29
|
-
/**
|
|
30
|
-
* Encoded bitstring
|
|
31
|
-
*
|
|
32
|
-
* Base64url-encoded and GZIP-compressed bitstring.
|
|
33
|
-
* Each bit represents the status of a credential:
|
|
34
|
-
* - 0: Not revoked/suspended
|
|
35
|
-
* - 1: Revoked/suspended
|
|
36
|
-
*/
|
|
37
|
-
encodedList: z.ZodString;
|
|
38
|
-
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
type: "StatusList2021";
|
|
40
|
-
statusPurpose: "revocation" | "suspension";
|
|
41
|
-
encodedList: string;
|
|
42
|
-
id?: string | undefined;
|
|
43
|
-
}, {
|
|
44
|
-
type: "StatusList2021";
|
|
45
|
-
statusPurpose: "revocation" | "suspension";
|
|
46
|
-
encodedList: string;
|
|
47
|
-
id?: string | undefined;
|
|
48
|
-
}>;
|
|
49
|
-
/**
|
|
50
|
-
* StatusList2021 Credential Schema
|
|
51
|
-
*
|
|
52
|
-
* A credential that contains a status list for checking revocation/suspension
|
|
53
|
-
* of other credentials.
|
|
54
|
-
*/
|
|
55
|
-
export declare const StatusList2021CredentialSchema: z.ZodObject<{
|
|
56
|
-
/** JSON-LD context */
|
|
57
|
-
'@context': z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
58
|
-
/** Unique identifier for the status list credential */
|
|
59
|
-
id: z.ZodString;
|
|
60
|
-
/** Type MUST include VerifiableCredential and StatusList2021Credential */
|
|
61
|
-
type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
|
|
62
|
-
/** Issuer of the status list credential */
|
|
63
|
-
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
64
|
-
id: z.ZodString;
|
|
65
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
66
|
-
id: z.ZodString;
|
|
67
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
68
|
-
id: z.ZodString;
|
|
69
|
-
}, z.ZodTypeAny, "passthrough">>]>;
|
|
70
|
-
/** Issuance date in ISO 8601 format */
|
|
71
|
-
issuanceDate: z.ZodString;
|
|
72
|
-
/** The status list credential subject */
|
|
73
|
-
credentialSubject: z.ZodObject<{
|
|
74
|
-
/** Optional identifier for the status list */
|
|
75
|
-
id: z.ZodOptional<z.ZodString>;
|
|
76
|
-
/** Type MUST be StatusList2021 */
|
|
77
|
-
type: z.ZodLiteral<"StatusList2021">;
|
|
78
|
-
/** Purpose of the status list */
|
|
79
|
-
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
80
|
-
/**
|
|
81
|
-
* Encoded bitstring
|
|
82
|
-
*
|
|
83
|
-
* Base64url-encoded and GZIP-compressed bitstring.
|
|
84
|
-
* Each bit represents the status of a credential:
|
|
85
|
-
* - 0: Not revoked/suspended
|
|
86
|
-
* - 1: Revoked/suspended
|
|
87
|
-
*/
|
|
88
|
-
encodedList: z.ZodString;
|
|
89
|
-
}, "strip", z.ZodTypeAny, {
|
|
90
|
-
type: "StatusList2021";
|
|
91
|
-
statusPurpose: "revocation" | "suspension";
|
|
92
|
-
encodedList: string;
|
|
93
|
-
id?: string | undefined;
|
|
94
|
-
}, {
|
|
95
|
-
type: "StatusList2021";
|
|
96
|
-
statusPurpose: "revocation" | "suspension";
|
|
97
|
-
encodedList: string;
|
|
98
|
-
id?: string | undefined;
|
|
99
|
-
}>;
|
|
100
|
-
/** Cryptographic proof (optional) */
|
|
101
|
-
proof: z.ZodOptional<z.ZodObject<{
|
|
102
|
-
type: z.ZodString;
|
|
103
|
-
created: z.ZodOptional<z.ZodString>;
|
|
104
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
105
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
106
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
107
|
-
type: z.ZodString;
|
|
108
|
-
created: z.ZodOptional<z.ZodString>;
|
|
109
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
110
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
111
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
112
|
-
type: z.ZodString;
|
|
113
|
-
created: z.ZodOptional<z.ZodString>;
|
|
114
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
115
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
116
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
117
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
118
|
-
/** JSON-LD context */
|
|
119
|
-
'@context': z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
120
|
-
/** Unique identifier for the status list credential */
|
|
121
|
-
id: z.ZodString;
|
|
122
|
-
/** Type MUST include VerifiableCredential and StatusList2021Credential */
|
|
123
|
-
type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
|
|
124
|
-
/** Issuer of the status list credential */
|
|
125
|
-
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
126
|
-
id: z.ZodString;
|
|
127
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
128
|
-
id: z.ZodString;
|
|
129
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
130
|
-
id: z.ZodString;
|
|
131
|
-
}, z.ZodTypeAny, "passthrough">>]>;
|
|
132
|
-
/** Issuance date in ISO 8601 format */
|
|
133
|
-
issuanceDate: z.ZodString;
|
|
134
|
-
/** The status list credential subject */
|
|
135
|
-
credentialSubject: z.ZodObject<{
|
|
136
|
-
/** Optional identifier for the status list */
|
|
137
|
-
id: z.ZodOptional<z.ZodString>;
|
|
138
|
-
/** Type MUST be StatusList2021 */
|
|
139
|
-
type: z.ZodLiteral<"StatusList2021">;
|
|
140
|
-
/** Purpose of the status list */
|
|
141
|
-
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
142
|
-
/**
|
|
143
|
-
* Encoded bitstring
|
|
144
|
-
*
|
|
145
|
-
* Base64url-encoded and GZIP-compressed bitstring.
|
|
146
|
-
* Each bit represents the status of a credential:
|
|
147
|
-
* - 0: Not revoked/suspended
|
|
148
|
-
* - 1: Revoked/suspended
|
|
149
|
-
*/
|
|
150
|
-
encodedList: z.ZodString;
|
|
151
|
-
}, "strip", z.ZodTypeAny, {
|
|
152
|
-
type: "StatusList2021";
|
|
153
|
-
statusPurpose: "revocation" | "suspension";
|
|
154
|
-
encodedList: string;
|
|
155
|
-
id?: string | undefined;
|
|
156
|
-
}, {
|
|
157
|
-
type: "StatusList2021";
|
|
158
|
-
statusPurpose: "revocation" | "suspension";
|
|
159
|
-
encodedList: string;
|
|
160
|
-
id?: string | undefined;
|
|
161
|
-
}>;
|
|
162
|
-
/** Cryptographic proof (optional) */
|
|
163
|
-
proof: z.ZodOptional<z.ZodObject<{
|
|
164
|
-
type: z.ZodString;
|
|
165
|
-
created: z.ZodOptional<z.ZodString>;
|
|
166
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
167
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
168
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
169
|
-
type: z.ZodString;
|
|
170
|
-
created: z.ZodOptional<z.ZodString>;
|
|
171
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
172
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
173
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
174
|
-
type: z.ZodString;
|
|
175
|
-
created: z.ZodOptional<z.ZodString>;
|
|
176
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
177
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
178
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
179
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
180
|
-
/** JSON-LD context */
|
|
181
|
-
'@context': z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
182
|
-
/** Unique identifier for the status list credential */
|
|
183
|
-
id: z.ZodString;
|
|
184
|
-
/** Type MUST include VerifiableCredential and StatusList2021Credential */
|
|
185
|
-
type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
|
|
186
|
-
/** Issuer of the status list credential */
|
|
187
|
-
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
188
|
-
id: z.ZodString;
|
|
189
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
190
|
-
id: z.ZodString;
|
|
191
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
192
|
-
id: z.ZodString;
|
|
193
|
-
}, z.ZodTypeAny, "passthrough">>]>;
|
|
194
|
-
/** Issuance date in ISO 8601 format */
|
|
195
|
-
issuanceDate: z.ZodString;
|
|
196
|
-
/** The status list credential subject */
|
|
197
|
-
credentialSubject: z.ZodObject<{
|
|
198
|
-
/** Optional identifier for the status list */
|
|
199
|
-
id: z.ZodOptional<z.ZodString>;
|
|
200
|
-
/** Type MUST be StatusList2021 */
|
|
201
|
-
type: z.ZodLiteral<"StatusList2021">;
|
|
202
|
-
/** Purpose of the status list */
|
|
203
|
-
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
204
|
-
/**
|
|
205
|
-
* Encoded bitstring
|
|
206
|
-
*
|
|
207
|
-
* Base64url-encoded and GZIP-compressed bitstring.
|
|
208
|
-
* Each bit represents the status of a credential:
|
|
209
|
-
* - 0: Not revoked/suspended
|
|
210
|
-
* - 1: Revoked/suspended
|
|
211
|
-
*/
|
|
212
|
-
encodedList: z.ZodString;
|
|
213
|
-
}, "strip", z.ZodTypeAny, {
|
|
214
|
-
type: "StatusList2021";
|
|
215
|
-
statusPurpose: "revocation" | "suspension";
|
|
216
|
-
encodedList: string;
|
|
217
|
-
id?: string | undefined;
|
|
218
|
-
}, {
|
|
219
|
-
type: "StatusList2021";
|
|
220
|
-
statusPurpose: "revocation" | "suspension";
|
|
221
|
-
encodedList: string;
|
|
222
|
-
id?: string | undefined;
|
|
223
|
-
}>;
|
|
224
|
-
/** Cryptographic proof (optional) */
|
|
225
|
-
proof: z.ZodOptional<z.ZodObject<{
|
|
226
|
-
type: z.ZodString;
|
|
227
|
-
created: z.ZodOptional<z.ZodString>;
|
|
228
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
229
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
230
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
231
|
-
type: z.ZodString;
|
|
232
|
-
created: z.ZodOptional<z.ZodString>;
|
|
233
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
234
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
235
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
236
|
-
type: z.ZodString;
|
|
237
|
-
created: z.ZodOptional<z.ZodString>;
|
|
238
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
239
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
240
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
241
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
242
|
-
/**
|
|
243
|
-
* Type exports
|
|
244
|
-
*/
|
|
245
|
-
export type StatusList2021CredentialSubject = z.infer<typeof StatusList2021CredentialSubjectSchema>;
|
|
246
|
-
export type StatusList2021Credential = z.infer<typeof StatusList2021CredentialSchema>;
|
|
247
|
-
/**
|
|
248
|
-
* StatusList2021 Credential Type (traditional TypeScript interface)
|
|
249
|
-
*
|
|
250
|
-
* For use when not using Zod validation
|
|
251
|
-
*/
|
|
252
|
-
export interface StatusList2021CredentialInterface {
|
|
253
|
-
'@context': (string | Record<string, any>)[];
|
|
254
|
-
id: string;
|
|
255
|
-
type: ['VerifiableCredential', 'StatusList2021Credential'];
|
|
256
|
-
issuer: string | {
|
|
257
|
-
id: string;
|
|
258
|
-
};
|
|
259
|
-
issuanceDate: string;
|
|
260
|
-
credentialSubject: {
|
|
261
|
-
id?: string;
|
|
262
|
-
type: 'StatusList2021';
|
|
263
|
-
statusPurpose: 'revocation' | 'suspension';
|
|
264
|
-
encodedList: string;
|
|
265
|
-
};
|
|
266
|
-
proof?: Record<string, any>;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Validation Helpers
|
|
270
|
-
*/
|
|
271
|
-
/**
|
|
272
|
-
* Validate a StatusList2021 credential
|
|
273
|
-
*
|
|
274
|
-
* @param credential - The credential to validate
|
|
275
|
-
* @returns Validation result with parsed credential or errors
|
|
276
|
-
*/
|
|
277
|
-
export declare function validateStatusList2021Credential(credential: unknown): z.SafeParseReturnType<z.objectInputType<{
|
|
278
|
-
/** JSON-LD context */
|
|
279
|
-
'@context': z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
280
|
-
/** Unique identifier for the status list credential */
|
|
281
|
-
id: z.ZodString;
|
|
282
|
-
/** Type MUST include VerifiableCredential and StatusList2021Credential */
|
|
283
|
-
type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
|
|
284
|
-
/** Issuer of the status list credential */
|
|
285
|
-
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
286
|
-
id: z.ZodString;
|
|
287
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
288
|
-
id: z.ZodString;
|
|
289
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
290
|
-
id: z.ZodString;
|
|
291
|
-
}, z.ZodTypeAny, "passthrough">>]>;
|
|
292
|
-
/** Issuance date in ISO 8601 format */
|
|
293
|
-
issuanceDate: z.ZodString;
|
|
294
|
-
/** The status list credential subject */
|
|
295
|
-
credentialSubject: z.ZodObject<{
|
|
296
|
-
/** Optional identifier for the status list */
|
|
297
|
-
id: z.ZodOptional<z.ZodString>;
|
|
298
|
-
/** Type MUST be StatusList2021 */
|
|
299
|
-
type: z.ZodLiteral<"StatusList2021">;
|
|
300
|
-
/** Purpose of the status list */
|
|
301
|
-
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
302
|
-
/**
|
|
303
|
-
* Encoded bitstring
|
|
304
|
-
*
|
|
305
|
-
* Base64url-encoded and GZIP-compressed bitstring.
|
|
306
|
-
* Each bit represents the status of a credential:
|
|
307
|
-
* - 0: Not revoked/suspended
|
|
308
|
-
* - 1: Revoked/suspended
|
|
309
|
-
*/
|
|
310
|
-
encodedList: z.ZodString;
|
|
311
|
-
}, "strip", z.ZodTypeAny, {
|
|
312
|
-
type: "StatusList2021";
|
|
313
|
-
statusPurpose: "revocation" | "suspension";
|
|
314
|
-
encodedList: string;
|
|
315
|
-
id?: string | undefined;
|
|
316
|
-
}, {
|
|
317
|
-
type: "StatusList2021";
|
|
318
|
-
statusPurpose: "revocation" | "suspension";
|
|
319
|
-
encodedList: string;
|
|
320
|
-
id?: string | undefined;
|
|
321
|
-
}>;
|
|
322
|
-
/** Cryptographic proof (optional) */
|
|
323
|
-
proof: z.ZodOptional<z.ZodObject<{
|
|
324
|
-
type: z.ZodString;
|
|
325
|
-
created: z.ZodOptional<z.ZodString>;
|
|
326
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
327
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
328
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
329
|
-
type: z.ZodString;
|
|
330
|
-
created: z.ZodOptional<z.ZodString>;
|
|
331
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
332
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
333
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
334
|
-
type: z.ZodString;
|
|
335
|
-
created: z.ZodOptional<z.ZodString>;
|
|
336
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
337
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
338
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
339
|
-
}, z.ZodTypeAny, "passthrough">, z.objectOutputType<{
|
|
340
|
-
/** JSON-LD context */
|
|
341
|
-
'@context': z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
342
|
-
/** Unique identifier for the status list credential */
|
|
343
|
-
id: z.ZodString;
|
|
344
|
-
/** Type MUST include VerifiableCredential and StatusList2021Credential */
|
|
345
|
-
type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
|
|
346
|
-
/** Issuer of the status list credential */
|
|
347
|
-
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
348
|
-
id: z.ZodString;
|
|
349
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
350
|
-
id: z.ZodString;
|
|
351
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
352
|
-
id: z.ZodString;
|
|
353
|
-
}, z.ZodTypeAny, "passthrough">>]>;
|
|
354
|
-
/** Issuance date in ISO 8601 format */
|
|
355
|
-
issuanceDate: z.ZodString;
|
|
356
|
-
/** The status list credential subject */
|
|
357
|
-
credentialSubject: z.ZodObject<{
|
|
358
|
-
/** Optional identifier for the status list */
|
|
359
|
-
id: z.ZodOptional<z.ZodString>;
|
|
360
|
-
/** Type MUST be StatusList2021 */
|
|
361
|
-
type: z.ZodLiteral<"StatusList2021">;
|
|
362
|
-
/** Purpose of the status list */
|
|
363
|
-
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
364
|
-
/**
|
|
365
|
-
* Encoded bitstring
|
|
366
|
-
*
|
|
367
|
-
* Base64url-encoded and GZIP-compressed bitstring.
|
|
368
|
-
* Each bit represents the status of a credential:
|
|
369
|
-
* - 0: Not revoked/suspended
|
|
370
|
-
* - 1: Revoked/suspended
|
|
371
|
-
*/
|
|
372
|
-
encodedList: z.ZodString;
|
|
373
|
-
}, "strip", z.ZodTypeAny, {
|
|
374
|
-
type: "StatusList2021";
|
|
375
|
-
statusPurpose: "revocation" | "suspension";
|
|
376
|
-
encodedList: string;
|
|
377
|
-
id?: string | undefined;
|
|
378
|
-
}, {
|
|
379
|
-
type: "StatusList2021";
|
|
380
|
-
statusPurpose: "revocation" | "suspension";
|
|
381
|
-
encodedList: string;
|
|
382
|
-
id?: string | undefined;
|
|
383
|
-
}>;
|
|
384
|
-
/** Cryptographic proof (optional) */
|
|
385
|
-
proof: z.ZodOptional<z.ZodObject<{
|
|
386
|
-
type: z.ZodString;
|
|
387
|
-
created: z.ZodOptional<z.ZodString>;
|
|
388
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
389
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
390
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
391
|
-
type: z.ZodString;
|
|
392
|
-
created: z.ZodOptional<z.ZodString>;
|
|
393
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
394
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
395
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
396
|
-
type: z.ZodString;
|
|
397
|
-
created: z.ZodOptional<z.ZodString>;
|
|
398
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
399
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
400
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
401
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
402
|
-
/**
|
|
403
|
-
* Helper Types for Bitstring Operations
|
|
404
|
-
*
|
|
405
|
-
* These types define the interface for bitstring encode/decode operations.
|
|
406
|
-
* Actual implementation would be in a separate utility module.
|
|
407
|
-
*/
|
|
408
|
-
/**
|
|
409
|
-
* Bitstring encoding options
|
|
410
|
-
*/
|
|
411
|
-
export interface BitStringEncodeOptions {
|
|
412
|
-
/** Total size of the bitstring (number of bits) */
|
|
413
|
-
size: number;
|
|
414
|
-
/** Positions to set to 1 (revoked/suspended) */
|
|
415
|
-
setBits?: number[];
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Bitstring decoding result
|
|
419
|
-
*/
|
|
420
|
-
export interface BitStringDecodeResult {
|
|
421
|
-
/** Total size of the bitstring */
|
|
422
|
-
size: number;
|
|
423
|
-
/** Positions that are set to 1 */
|
|
424
|
-
setBits: number[];
|
|
425
|
-
/** Check if a specific index is set */
|
|
426
|
-
isSet: (index: number) => boolean;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Cache entry for StatusList2021 credentials
|
|
430
|
-
*
|
|
431
|
-
* Used for efficient caching of status list credentials with ETag support
|
|
432
|
-
*/
|
|
433
|
-
export interface StatusListCacheEntry {
|
|
434
|
-
/** The cached status list credential */
|
|
435
|
-
credential: StatusList2021Credential;
|
|
436
|
-
/** ETag from the HTTP response (if applicable) */
|
|
437
|
-
etag?: string;
|
|
438
|
-
/** Timestamp when cached (milliseconds since epoch) */
|
|
439
|
-
cachedAt: number;
|
|
440
|
-
/** TTL in seconds */
|
|
441
|
-
ttlSec: number;
|
|
442
|
-
/** Expires at timestamp (milliseconds since epoch) */
|
|
443
|
-
expiresAt: number;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Status checking result
|
|
447
|
-
*/
|
|
448
|
-
export interface StatusCheckResult {
|
|
449
|
-
/** Whether the credential is valid (not revoked/suspended) */
|
|
450
|
-
valid: boolean;
|
|
451
|
-
/** The status (active, revoked, suspended) */
|
|
452
|
-
status: 'active' | 'revoked' | 'suspended';
|
|
453
|
-
/** Optional reason for status */
|
|
454
|
-
reason?: string;
|
|
455
|
-
/** Timestamp when checked */
|
|
456
|
-
checkedAt: number;
|
|
457
|
-
/** Whether result came from cache */
|
|
458
|
-
fromCache?: boolean;
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Helper to create a minimal status list credential structure
|
|
462
|
-
*
|
|
463
|
-
* This is a type-safe helper, actual credential creation requires
|
|
464
|
-
* proper signing and encoding implementation.
|
|
465
|
-
*
|
|
466
|
-
* @param config - Configuration for the status list credential
|
|
467
|
-
* @returns Partial credential structure (needs proof to be complete)
|
|
468
|
-
*/
|
|
469
|
-
export declare function createStatusListCredentialStructure(config: {
|
|
470
|
-
id: string;
|
|
471
|
-
issuer: string | {
|
|
472
|
-
id: string;
|
|
473
|
-
};
|
|
474
|
-
statusPurpose: StatusPurpose;
|
|
475
|
-
encodedList: string;
|
|
476
|
-
}): Omit<StatusList2021Credential, 'proof'>;
|
|
477
|
-
/**
|
|
478
|
-
* Constants
|
|
479
|
-
*/
|
|
480
|
-
/**
|
|
481
|
-
* Default cache TTL for status list credentials (in seconds)
|
|
482
|
-
* As per spec recommendation
|
|
483
|
-
*/
|
|
484
|
-
export declare const DEFAULT_STATUSLIST_CACHE_TTL_SEC = 60;
|
|
485
|
-
/**
|
|
486
|
-
* Maximum reasonable bitstring size
|
|
487
|
-
* Used for validation to prevent memory exhaustion
|
|
488
|
-
*/
|
|
489
|
-
export declare const MAX_STATUSLIST_SIZE = 1000000;
|
|
490
|
-
/**
|
|
491
|
-
* StatusList2021 context URL
|
|
492
|
-
*/
|
|
493
|
-
export declare const STATUSLIST_2021_CONTEXT = "https://w3id.org/vc/status-list/2021/v1";
|
|
494
|
-
//# sourceMappingURL=statuslist.d.ts.map
|
package/dist/vc/statuslist.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* StatusList2021 Types and Schemas
|
|
4
|
-
*
|
|
5
|
-
* Implementation of the W3C StatusList2021 specification for credential status.
|
|
6
|
-
* Provides types for status list credentials and helpers for bitstring operations.
|
|
7
|
-
*
|
|
8
|
-
* Related Spec: W3C StatusList2021
|
|
9
|
-
* Python Reference: Credential-Documentation.md (StatusList2021 section)
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.STATUSLIST_2021_CONTEXT = exports.MAX_STATUSLIST_SIZE = exports.DEFAULT_STATUSLIST_CACHE_TTL_SEC = exports.StatusList2021CredentialSchema = exports.StatusList2021CredentialSubjectSchema = void 0;
|
|
13
|
-
exports.validateStatusList2021Credential = validateStatusList2021Credential;
|
|
14
|
-
exports.createStatusListCredentialStructure = createStatusListCredentialStructure;
|
|
15
|
-
const zod_1 = require("zod");
|
|
16
|
-
const schemas_js_1 = require("./schemas.js");
|
|
17
|
-
/**
|
|
18
|
-
* Status List Credential Subject Schema
|
|
19
|
-
*
|
|
20
|
-
* The credential subject of a StatusList2021Credential
|
|
21
|
-
*/
|
|
22
|
-
exports.StatusList2021CredentialSubjectSchema = zod_1.z.object({
|
|
23
|
-
/** Optional identifier for the status list */
|
|
24
|
-
id: zod_1.z.string().optional(),
|
|
25
|
-
/** Type MUST be StatusList2021 */
|
|
26
|
-
type: zod_1.z.literal('StatusList2021'),
|
|
27
|
-
/** Purpose of the status list */
|
|
28
|
-
statusPurpose: zod_1.z.enum(['revocation', 'suspension']),
|
|
29
|
-
/**
|
|
30
|
-
* Encoded bitstring
|
|
31
|
-
*
|
|
32
|
-
* Base64url-encoded and GZIP-compressed bitstring.
|
|
33
|
-
* Each bit represents the status of a credential:
|
|
34
|
-
* - 0: Not revoked/suspended
|
|
35
|
-
* - 1: Revoked/suspended
|
|
36
|
-
*/
|
|
37
|
-
encodedList: zod_1.z.string().regex(/^[A-Za-z0-9_-]+$/, {
|
|
38
|
-
message: 'encodedList must be base64url encoded',
|
|
39
|
-
}),
|
|
40
|
-
});
|
|
41
|
-
/**
|
|
42
|
-
* StatusList2021 Credential Schema
|
|
43
|
-
*
|
|
44
|
-
* A credential that contains a status list for checking revocation/suspension
|
|
45
|
-
* of other credentials.
|
|
46
|
-
*/
|
|
47
|
-
exports.StatusList2021CredentialSchema = zod_1.z.object({
|
|
48
|
-
/** JSON-LD context */
|
|
49
|
-
'@context': schemas_js_1.ContextSchema.refine((contexts) => {
|
|
50
|
-
// Must include both base VC context and StatusList context
|
|
51
|
-
return (contexts.length >= 2 &&
|
|
52
|
-
typeof contexts[0] === 'string' &&
|
|
53
|
-
contexts[0] === 'https://www.w3.org/2018/credentials/v1' &&
|
|
54
|
-
(contexts.includes('https://w3id.org/vc/status-list/2021/v1') ||
|
|
55
|
-
contexts.some((ctx) => typeof ctx === 'object' &&
|
|
56
|
-
ctx['StatusList2021Credential'] !== undefined)));
|
|
57
|
-
}, {
|
|
58
|
-
message: '@context must include VC context and StatusList2021 context',
|
|
59
|
-
}),
|
|
60
|
-
/** Unique identifier for the status list credential */
|
|
61
|
-
id: zod_1.z.string().url(),
|
|
62
|
-
/** Type MUST include VerifiableCredential and StatusList2021Credential */
|
|
63
|
-
type: zod_1.z
|
|
64
|
-
.tuple([zod_1.z.literal('VerifiableCredential'), zod_1.z.literal('StatusList2021Credential')])
|
|
65
|
-
.or(zod_1.z.array(zod_1.z.string()).refine((types) => types.includes('VerifiableCredential') &&
|
|
66
|
-
types.includes('StatusList2021Credential'), {
|
|
67
|
-
message: 'type must include "VerifiableCredential" and "StatusList2021Credential"',
|
|
68
|
-
})),
|
|
69
|
-
/** Issuer of the status list credential */
|
|
70
|
-
issuer: schemas_js_1.IssuerSchema,
|
|
71
|
-
/** Issuance date in ISO 8601 format */
|
|
72
|
-
issuanceDate: zod_1.z.string().datetime(),
|
|
73
|
-
/** The status list credential subject */
|
|
74
|
-
credentialSubject: exports.StatusList2021CredentialSubjectSchema,
|
|
75
|
-
/** Cryptographic proof (optional) */
|
|
76
|
-
proof: schemas_js_1.ProofSchema.optional(),
|
|
77
|
-
}).passthrough();
|
|
78
|
-
/**
|
|
79
|
-
* Validation Helpers
|
|
80
|
-
*/
|
|
81
|
-
/**
|
|
82
|
-
* Validate a StatusList2021 credential
|
|
83
|
-
*
|
|
84
|
-
* @param credential - The credential to validate
|
|
85
|
-
* @returns Validation result with parsed credential or errors
|
|
86
|
-
*/
|
|
87
|
-
function validateStatusList2021Credential(credential) {
|
|
88
|
-
return exports.StatusList2021CredentialSchema.safeParse(credential);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Helper to create a minimal status list credential structure
|
|
92
|
-
*
|
|
93
|
-
* This is a type-safe helper, actual credential creation requires
|
|
94
|
-
* proper signing and encoding implementation.
|
|
95
|
-
*
|
|
96
|
-
* @param config - Configuration for the status list credential
|
|
97
|
-
* @returns Partial credential structure (needs proof to be complete)
|
|
98
|
-
*/
|
|
99
|
-
function createStatusListCredentialStructure(config) {
|
|
100
|
-
return {
|
|
101
|
-
'@context': [
|
|
102
|
-
'https://www.w3.org/2018/credentials/v1',
|
|
103
|
-
'https://w3id.org/vc/status-list/2021/v1',
|
|
104
|
-
],
|
|
105
|
-
id: config.id,
|
|
106
|
-
type: ['VerifiableCredential', 'StatusList2021Credential'],
|
|
107
|
-
issuer: config.issuer,
|
|
108
|
-
issuanceDate: new Date().toISOString(),
|
|
109
|
-
credentialSubject: {
|
|
110
|
-
type: 'StatusList2021',
|
|
111
|
-
statusPurpose: config.statusPurpose,
|
|
112
|
-
encodedList: config.encodedList,
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Constants
|
|
118
|
-
*/
|
|
119
|
-
/**
|
|
120
|
-
* Default cache TTL for status list credentials (in seconds)
|
|
121
|
-
* As per spec recommendation
|
|
122
|
-
*/
|
|
123
|
-
exports.DEFAULT_STATUSLIST_CACHE_TTL_SEC = 60;
|
|
124
|
-
/**
|
|
125
|
-
* Maximum reasonable bitstring size
|
|
126
|
-
* Used for validation to prevent memory exhaustion
|
|
127
|
-
*/
|
|
128
|
-
exports.MAX_STATUSLIST_SIZE = 1000000; // 1 million entries
|
|
129
|
-
/**
|
|
130
|
-
* StatusList2021 context URL
|
|
131
|
-
*/
|
|
132
|
-
exports.STATUSLIST_2021_CONTEXT = 'https://w3id.org/vc/status-list/2021/v1';
|
|
133
|
-
//# sourceMappingURL=statuslist.js.map
|