@kya-os/contracts 1.3.3 → 1.3.5

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.
Files changed (66) hide show
  1. package/package.json +3 -2
  2. package/README.md +0 -130
  3. package/dist/agentshield-api/endpoints.d.ts +0 -21
  4. package/dist/agentshield-api/endpoints.js +0 -20
  5. package/dist/agentshield-api/index.d.ts +0 -5
  6. package/dist/agentshield-api/index.js +0 -27
  7. package/dist/agentshield-api/schemas.d.ts +0 -9846
  8. package/dist/agentshield-api/schemas.js +0 -92
  9. package/dist/agentshield-api/types.d.ts +0 -92
  10. package/dist/agentshield-api/types.js +0 -12
  11. package/dist/config/base.d.ts +0 -19
  12. package/dist/config/base.js +0 -2
  13. package/dist/config/delegation.d.ts +0 -46
  14. package/dist/config/delegation.js +0 -2
  15. package/dist/config/identity.d.ts +0 -22
  16. package/dist/config/identity.js +0 -2
  17. package/dist/config/index.d.ts +0 -17
  18. package/dist/config/index.js +0 -2
  19. package/dist/config/proofing.d.ts +0 -26
  20. package/dist/config/proofing.js +0 -2
  21. package/dist/config/tool-protection.d.ts +0 -36
  22. package/dist/config/tool-protection.js +0 -2
  23. package/dist/delegation/constraints.d.ts +0 -726
  24. package/dist/delegation/constraints.js +0 -103
  25. package/dist/delegation/index.d.ts +0 -2
  26. package/dist/delegation/index.js +0 -18
  27. package/dist/delegation/schemas.d.ts +0 -8042
  28. package/dist/delegation/schemas.js +0 -232
  29. package/dist/did/index.d.ts +0 -3
  30. package/dist/did/index.js +0 -19
  31. package/dist/did/resolve-contract.d.ts +0 -53
  32. package/dist/did/resolve-contract.js +0 -12
  33. package/dist/did/schemas.d.ts +0 -33
  34. package/dist/did/schemas.js +0 -80
  35. package/dist/did/types.d.ts +0 -38
  36. package/dist/did/types.js +0 -37
  37. package/dist/env/constants.d.ts +0 -13
  38. package/dist/env/constants.js +0 -15
  39. package/dist/env/index.d.ts +0 -1
  40. package/dist/env/index.js +0 -17
  41. package/dist/proof/index.d.ts +0 -2
  42. package/dist/proof/index.js +0 -18
  43. package/dist/proof/proof-record.d.ts +0 -728
  44. package/dist/proof/proof-record.js +0 -60
  45. package/dist/proof/signing-spec.d.ts +0 -73
  46. package/dist/proof/signing-spec.js +0 -52
  47. package/dist/runtime/errors.d.ts +0 -179
  48. package/dist/runtime/errors.js +0 -51
  49. package/dist/runtime/headers.d.ts +0 -34
  50. package/dist/runtime/headers.js +0 -52
  51. package/dist/runtime/index.d.ts +0 -2
  52. package/dist/runtime/index.js +0 -18
  53. package/dist/tlkrc/index.d.ts +0 -1
  54. package/dist/tlkrc/index.js +0 -17
  55. package/dist/tlkrc/rotation.d.ts +0 -168
  56. package/dist/tlkrc/rotation.js +0 -55
  57. package/dist/tool-protection/index.d.ts +0 -129
  58. package/dist/tool-protection/index.js +0 -80
  59. package/dist/vc/index.d.ts +0 -2
  60. package/dist/vc/index.js +0 -18
  61. package/dist/vc/schemas.d.ts +0 -1888
  62. package/dist/vc/schemas.js +0 -116
  63. package/dist/vc/statuslist.d.ts +0 -292
  64. package/dist/vc/statuslist.js +0 -61
  65. package/dist/well-known/index.d.ts +0 -248
  66. package/dist/well-known/index.js +0 -104
@@ -1,116 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VerifiablePresentationSchema = exports.VerifiableCredentialSchema = exports.ProofSchema = exports.CredentialStatusSchema = exports.CredentialSubjectSchema = exports.IssuerSchema = exports.ContextSchema = exports.ContextEntrySchema = exports.STATUS_LIST_CONTEXT = exports.VC_CONTEXT = void 0;
4
- exports.validateVerifiableCredential = validateVerifiableCredential;
5
- exports.validateVerifiablePresentation = validateVerifiablePresentation;
6
- exports.isCredentialExpired = isCredentialExpired;
7
- exports.getIssuerDid = getIssuerDid;
8
- exports.getSubjectDid = getSubjectDid;
9
- const zod_1 = require("zod");
10
- exports.VC_CONTEXT = ['https://www.w3.org/2018/credentials/v1'];
11
- exports.STATUS_LIST_CONTEXT = 'https://w3id.org/vc/status-list/2021/v1';
12
- exports.ContextEntrySchema = zod_1.z.union([
13
- zod_1.z.string().url(),
14
- zod_1.z.record(zod_1.z.any()),
15
- ]);
16
- exports.ContextSchema = zod_1.z
17
- .array(exports.ContextEntrySchema)
18
- .nonempty()
19
- .refine((contexts) => {
20
- const firstContext = contexts[0];
21
- return (typeof firstContext === 'string' &&
22
- firstContext === exports.VC_CONTEXT[0]);
23
- }, {
24
- message: 'First @context must be "https://www.w3.org/2018/credentials/v1"',
25
- });
26
- exports.IssuerSchema = zod_1.z.union([
27
- zod_1.z.string().min(1),
28
- zod_1.z.object({
29
- id: zod_1.z.string().min(1),
30
- }).passthrough(),
31
- ]);
32
- exports.CredentialSubjectSchema = zod_1.z.union([
33
- zod_1.z.record(zod_1.z.any()),
34
- zod_1.z.array(zod_1.z.record(zod_1.z.any())),
35
- ]);
36
- exports.CredentialStatusSchema = zod_1.z.object({
37
- id: zod_1.z.string().url(),
38
- type: zod_1.z.literal('StatusList2021Entry'),
39
- statusPurpose: zod_1.z.enum(['revocation', 'suspension']),
40
- statusListIndex: zod_1.z.string().regex(/^\d+$/, 'Must be a numeric string'),
41
- statusListCredential: zod_1.z.string().url(),
42
- });
43
- exports.ProofSchema = zod_1.z
44
- .object({
45
- type: zod_1.z.string().min(1),
46
- created: zod_1.z.string().optional(),
47
- verificationMethod: zod_1.z.string().optional(),
48
- proofPurpose: zod_1.z.string().optional(),
49
- })
50
- .passthrough();
51
- exports.VerifiableCredentialSchema = zod_1.z.object({
52
- '@context': exports.ContextSchema,
53
- id: zod_1.z.string().url().optional(),
54
- type: zod_1.z
55
- .array(zod_1.z.string())
56
- .min(1)
57
- .refine((types) => types.includes('VerifiableCredential'), {
58
- message: 'type must include "VerifiableCredential"',
59
- }),
60
- issuer: exports.IssuerSchema,
61
- issuanceDate: zod_1.z.string().datetime(),
62
- expirationDate: zod_1.z.string().datetime().optional(),
63
- credentialSubject: exports.CredentialSubjectSchema,
64
- credentialStatus: exports.CredentialStatusSchema.optional(),
65
- proof: exports.ProofSchema.optional(),
66
- }).passthrough();
67
- exports.VerifiablePresentationSchema = zod_1.z.object({
68
- '@context': exports.ContextSchema,
69
- id: zod_1.z.string().url().optional(),
70
- type: zod_1.z
71
- .array(zod_1.z.string())
72
- .min(1)
73
- .refine((types) => types.includes('VerifiablePresentation'), {
74
- message: 'type must include "VerifiablePresentation"',
75
- }),
76
- holder: zod_1.z.string().min(1).optional(),
77
- verifiableCredential: zod_1.z
78
- .union([
79
- exports.VerifiableCredentialSchema,
80
- zod_1.z.array(exports.VerifiableCredentialSchema),
81
- ])
82
- .optional(),
83
- proof: exports.ProofSchema.optional(),
84
- }).passthrough();
85
- function validateVerifiableCredential(credential) {
86
- return exports.VerifiableCredentialSchema.safeParse(credential);
87
- }
88
- function validateVerifiablePresentation(presentation) {
89
- return exports.VerifiablePresentationSchema.safeParse(presentation);
90
- }
91
- function isCredentialExpired(credential) {
92
- if (!credential.expirationDate) {
93
- return false;
94
- }
95
- try {
96
- const expirationDate = new Date(credential.expirationDate);
97
- const now = new Date();
98
- return expirationDate < now;
99
- }
100
- catch {
101
- return false;
102
- }
103
- }
104
- function getIssuerDid(credential) {
105
- const issuer = credential.issuer;
106
- if (typeof issuer === 'string') {
107
- return issuer;
108
- }
109
- return issuer.id;
110
- }
111
- function getSubjectDid(credential) {
112
- const subject = Array.isArray(credential.credentialSubject)
113
- ? credential.credentialSubject[0]
114
- : credential.credentialSubject;
115
- return subject?.id || null;
116
- }
@@ -1,292 +0,0 @@
1
- import { z } from 'zod';
2
- export type StatusPurpose = 'revocation' | 'suspension';
3
- export declare const StatusList2021CredentialSubjectSchema: z.ZodObject<{
4
- id: z.ZodOptional<z.ZodString>;
5
- type: z.ZodLiteral<"StatusList2021">;
6
- statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
7
- encodedList: z.ZodString;
8
- }, "strip", z.ZodTypeAny, {
9
- type: "StatusList2021";
10
- statusPurpose: "revocation" | "suspension";
11
- encodedList: string;
12
- id?: string | undefined;
13
- }, {
14
- type: "StatusList2021";
15
- statusPurpose: "revocation" | "suspension";
16
- encodedList: string;
17
- id?: string | undefined;
18
- }>;
19
- export declare const StatusList2021CredentialSchema: z.ZodObject<{
20
- '@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>)[]]>;
21
- id: z.ZodString;
22
- type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
23
- issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
24
- id: z.ZodString;
25
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
26
- id: z.ZodString;
27
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
28
- id: z.ZodString;
29
- }, z.ZodTypeAny, "passthrough">>]>;
30
- issuanceDate: z.ZodString;
31
- credentialSubject: z.ZodObject<{
32
- id: z.ZodOptional<z.ZodString>;
33
- type: z.ZodLiteral<"StatusList2021">;
34
- statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
35
- encodedList: z.ZodString;
36
- }, "strip", z.ZodTypeAny, {
37
- type: "StatusList2021";
38
- statusPurpose: "revocation" | "suspension";
39
- encodedList: string;
40
- id?: string | undefined;
41
- }, {
42
- type: "StatusList2021";
43
- statusPurpose: "revocation" | "suspension";
44
- encodedList: string;
45
- id?: string | undefined;
46
- }>;
47
- proof: z.ZodOptional<z.ZodObject<{
48
- type: z.ZodString;
49
- created: z.ZodOptional<z.ZodString>;
50
- verificationMethod: z.ZodOptional<z.ZodString>;
51
- proofPurpose: z.ZodOptional<z.ZodString>;
52
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
53
- type: z.ZodString;
54
- created: z.ZodOptional<z.ZodString>;
55
- verificationMethod: z.ZodOptional<z.ZodString>;
56
- proofPurpose: z.ZodOptional<z.ZodString>;
57
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
58
- type: z.ZodString;
59
- created: z.ZodOptional<z.ZodString>;
60
- verificationMethod: z.ZodOptional<z.ZodString>;
61
- proofPurpose: z.ZodOptional<z.ZodString>;
62
- }, z.ZodTypeAny, "passthrough">>>;
63
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
64
- '@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>)[]]>;
65
- id: z.ZodString;
66
- type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
67
- issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
68
- id: z.ZodString;
69
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
70
- id: z.ZodString;
71
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
72
- id: z.ZodString;
73
- }, z.ZodTypeAny, "passthrough">>]>;
74
- issuanceDate: z.ZodString;
75
- credentialSubject: z.ZodObject<{
76
- id: z.ZodOptional<z.ZodString>;
77
- type: z.ZodLiteral<"StatusList2021">;
78
- statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
79
- encodedList: z.ZodString;
80
- }, "strip", z.ZodTypeAny, {
81
- type: "StatusList2021";
82
- statusPurpose: "revocation" | "suspension";
83
- encodedList: string;
84
- id?: string | undefined;
85
- }, {
86
- type: "StatusList2021";
87
- statusPurpose: "revocation" | "suspension";
88
- encodedList: string;
89
- id?: string | undefined;
90
- }>;
91
- proof: z.ZodOptional<z.ZodObject<{
92
- type: z.ZodString;
93
- created: z.ZodOptional<z.ZodString>;
94
- verificationMethod: z.ZodOptional<z.ZodString>;
95
- proofPurpose: z.ZodOptional<z.ZodString>;
96
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
97
- type: z.ZodString;
98
- created: z.ZodOptional<z.ZodString>;
99
- verificationMethod: z.ZodOptional<z.ZodString>;
100
- proofPurpose: z.ZodOptional<z.ZodString>;
101
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
102
- type: z.ZodString;
103
- created: z.ZodOptional<z.ZodString>;
104
- verificationMethod: z.ZodOptional<z.ZodString>;
105
- proofPurpose: z.ZodOptional<z.ZodString>;
106
- }, z.ZodTypeAny, "passthrough">>>;
107
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
108
- '@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>)[]]>;
109
- id: z.ZodString;
110
- type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
111
- issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
112
- id: z.ZodString;
113
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
114
- id: z.ZodString;
115
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
116
- id: z.ZodString;
117
- }, z.ZodTypeAny, "passthrough">>]>;
118
- issuanceDate: z.ZodString;
119
- credentialSubject: z.ZodObject<{
120
- id: z.ZodOptional<z.ZodString>;
121
- type: z.ZodLiteral<"StatusList2021">;
122
- statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
123
- encodedList: z.ZodString;
124
- }, "strip", z.ZodTypeAny, {
125
- type: "StatusList2021";
126
- statusPurpose: "revocation" | "suspension";
127
- encodedList: string;
128
- id?: string | undefined;
129
- }, {
130
- type: "StatusList2021";
131
- statusPurpose: "revocation" | "suspension";
132
- encodedList: string;
133
- id?: string | undefined;
134
- }>;
135
- proof: z.ZodOptional<z.ZodObject<{
136
- type: z.ZodString;
137
- created: z.ZodOptional<z.ZodString>;
138
- verificationMethod: z.ZodOptional<z.ZodString>;
139
- proofPurpose: z.ZodOptional<z.ZodString>;
140
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
141
- type: z.ZodString;
142
- created: z.ZodOptional<z.ZodString>;
143
- verificationMethod: z.ZodOptional<z.ZodString>;
144
- proofPurpose: z.ZodOptional<z.ZodString>;
145
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
146
- type: z.ZodString;
147
- created: z.ZodOptional<z.ZodString>;
148
- verificationMethod: z.ZodOptional<z.ZodString>;
149
- proofPurpose: z.ZodOptional<z.ZodString>;
150
- }, z.ZodTypeAny, "passthrough">>>;
151
- }, z.ZodTypeAny, "passthrough">>;
152
- export type StatusList2021CredentialSubject = z.infer<typeof StatusList2021CredentialSubjectSchema>;
153
- export type StatusList2021Credential = z.infer<typeof StatusList2021CredentialSchema>;
154
- export interface StatusList2021CredentialInterface {
155
- '@context': (string | Record<string, any>)[];
156
- id: string;
157
- type: ['VerifiableCredential', 'StatusList2021Credential'];
158
- issuer: string | {
159
- id: string;
160
- };
161
- issuanceDate: string;
162
- credentialSubject: {
163
- id?: string;
164
- type: 'StatusList2021';
165
- statusPurpose: 'revocation' | 'suspension';
166
- encodedList: string;
167
- };
168
- proof?: Record<string, any>;
169
- }
170
- export declare function validateStatusList2021Credential(credential: unknown): z.SafeParseReturnType<z.objectInputType<{
171
- '@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>)[]]>;
172
- id: z.ZodString;
173
- type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
174
- issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
175
- id: z.ZodString;
176
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
177
- id: z.ZodString;
178
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
179
- id: z.ZodString;
180
- }, z.ZodTypeAny, "passthrough">>]>;
181
- issuanceDate: z.ZodString;
182
- credentialSubject: z.ZodObject<{
183
- id: z.ZodOptional<z.ZodString>;
184
- type: z.ZodLiteral<"StatusList2021">;
185
- statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
186
- encodedList: z.ZodString;
187
- }, "strip", z.ZodTypeAny, {
188
- type: "StatusList2021";
189
- statusPurpose: "revocation" | "suspension";
190
- encodedList: string;
191
- id?: string | undefined;
192
- }, {
193
- type: "StatusList2021";
194
- statusPurpose: "revocation" | "suspension";
195
- encodedList: string;
196
- id?: string | undefined;
197
- }>;
198
- proof: z.ZodOptional<z.ZodObject<{
199
- type: z.ZodString;
200
- created: z.ZodOptional<z.ZodString>;
201
- verificationMethod: z.ZodOptional<z.ZodString>;
202
- proofPurpose: z.ZodOptional<z.ZodString>;
203
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
204
- type: z.ZodString;
205
- created: z.ZodOptional<z.ZodString>;
206
- verificationMethod: z.ZodOptional<z.ZodString>;
207
- proofPurpose: z.ZodOptional<z.ZodString>;
208
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
209
- type: z.ZodString;
210
- created: z.ZodOptional<z.ZodString>;
211
- verificationMethod: z.ZodOptional<z.ZodString>;
212
- proofPurpose: z.ZodOptional<z.ZodString>;
213
- }, z.ZodTypeAny, "passthrough">>>;
214
- }, z.ZodTypeAny, "passthrough">, z.objectOutputType<{
215
- '@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>)[]]>;
216
- id: z.ZodString;
217
- type: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"VerifiableCredential">, z.ZodLiteral<"StatusList2021Credential">], null>, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>;
218
- issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
219
- id: z.ZodString;
220
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
221
- id: z.ZodString;
222
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
223
- id: z.ZodString;
224
- }, z.ZodTypeAny, "passthrough">>]>;
225
- issuanceDate: z.ZodString;
226
- credentialSubject: z.ZodObject<{
227
- id: z.ZodOptional<z.ZodString>;
228
- type: z.ZodLiteral<"StatusList2021">;
229
- statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
230
- encodedList: z.ZodString;
231
- }, "strip", z.ZodTypeAny, {
232
- type: "StatusList2021";
233
- statusPurpose: "revocation" | "suspension";
234
- encodedList: string;
235
- id?: string | undefined;
236
- }, {
237
- type: "StatusList2021";
238
- statusPurpose: "revocation" | "suspension";
239
- encodedList: string;
240
- id?: string | undefined;
241
- }>;
242
- proof: z.ZodOptional<z.ZodObject<{
243
- type: z.ZodString;
244
- created: z.ZodOptional<z.ZodString>;
245
- verificationMethod: z.ZodOptional<z.ZodString>;
246
- proofPurpose: z.ZodOptional<z.ZodString>;
247
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
248
- type: z.ZodString;
249
- created: z.ZodOptional<z.ZodString>;
250
- verificationMethod: z.ZodOptional<z.ZodString>;
251
- proofPurpose: z.ZodOptional<z.ZodString>;
252
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
253
- type: z.ZodString;
254
- created: z.ZodOptional<z.ZodString>;
255
- verificationMethod: z.ZodOptional<z.ZodString>;
256
- proofPurpose: z.ZodOptional<z.ZodString>;
257
- }, z.ZodTypeAny, "passthrough">>>;
258
- }, z.ZodTypeAny, "passthrough">>;
259
- export interface BitStringEncodeOptions {
260
- size: number;
261
- setBits?: number[];
262
- }
263
- export interface BitStringDecodeResult {
264
- size: number;
265
- setBits: number[];
266
- isSet: (index: number) => boolean;
267
- }
268
- export interface StatusListCacheEntry {
269
- credential: StatusList2021Credential;
270
- etag?: string;
271
- cachedAt: number;
272
- ttlSec: number;
273
- expiresAt: number;
274
- }
275
- export interface StatusCheckResult {
276
- valid: boolean;
277
- status: 'active' | 'revoked' | 'suspended';
278
- reason?: string;
279
- checkedAt: number;
280
- fromCache?: boolean;
281
- }
282
- export declare function createStatusListCredentialStructure(config: {
283
- id: string;
284
- issuer: string | {
285
- id: string;
286
- };
287
- statusPurpose: StatusPurpose;
288
- encodedList: string;
289
- }): Omit<StatusList2021Credential, 'proof'>;
290
- export declare const DEFAULT_STATUSLIST_CACHE_TTL_SEC = 60;
291
- export declare const MAX_STATUSLIST_SIZE = 1000000;
292
- export declare const STATUSLIST_2021_CONTEXT = "https://w3id.org/vc/status-list/2021/v1";
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STATUSLIST_2021_CONTEXT = exports.MAX_STATUSLIST_SIZE = exports.DEFAULT_STATUSLIST_CACHE_TTL_SEC = exports.StatusList2021CredentialSchema = exports.StatusList2021CredentialSubjectSchema = void 0;
4
- exports.validateStatusList2021Credential = validateStatusList2021Credential;
5
- exports.createStatusListCredentialStructure = createStatusListCredentialStructure;
6
- const zod_1 = require("zod");
7
- const schemas_js_1 = require("./schemas.js");
8
- exports.StatusList2021CredentialSubjectSchema = zod_1.z.object({
9
- id: zod_1.z.string().optional(),
10
- type: zod_1.z.literal('StatusList2021'),
11
- statusPurpose: zod_1.z.enum(['revocation', 'suspension']),
12
- encodedList: zod_1.z.string().regex(/^[A-Za-z0-9_-]+$/, {
13
- message: 'encodedList must be base64url encoded',
14
- }),
15
- });
16
- exports.StatusList2021CredentialSchema = zod_1.z.object({
17
- '@context': schemas_js_1.ContextSchema.refine((contexts) => {
18
- return (contexts.length >= 2 &&
19
- typeof contexts[0] === 'string' &&
20
- contexts[0] === 'https://www.w3.org/2018/credentials/v1' &&
21
- (contexts.includes('https://w3id.org/vc/status-list/2021/v1') ||
22
- contexts.some((ctx) => typeof ctx === 'object' &&
23
- ctx['StatusList2021Credential'] !== undefined)));
24
- }, {
25
- message: '@context must include VC context and StatusList2021 context',
26
- }),
27
- id: zod_1.z.string().url(),
28
- type: zod_1.z
29
- .tuple([zod_1.z.literal('VerifiableCredential'), zod_1.z.literal('StatusList2021Credential')])
30
- .or(zod_1.z.array(zod_1.z.string()).refine((types) => types.includes('VerifiableCredential') &&
31
- types.includes('StatusList2021Credential'), {
32
- message: 'type must include "VerifiableCredential" and "StatusList2021Credential"',
33
- })),
34
- issuer: schemas_js_1.IssuerSchema,
35
- issuanceDate: zod_1.z.string().datetime(),
36
- credentialSubject: exports.StatusList2021CredentialSubjectSchema,
37
- proof: schemas_js_1.ProofSchema.optional(),
38
- }).passthrough();
39
- function validateStatusList2021Credential(credential) {
40
- return exports.StatusList2021CredentialSchema.safeParse(credential);
41
- }
42
- function createStatusListCredentialStructure(config) {
43
- return {
44
- '@context': [
45
- 'https://www.w3.org/2018/credentials/v1',
46
- 'https://w3id.org/vc/status-list/2021/v1',
47
- ],
48
- id: config.id,
49
- type: ['VerifiableCredential', 'StatusList2021Credential'],
50
- issuer: config.issuer,
51
- issuanceDate: new Date().toISOString(),
52
- credentialSubject: {
53
- type: 'StatusList2021',
54
- statusPurpose: config.statusPurpose,
55
- encodedList: config.encodedList,
56
- },
57
- };
58
- }
59
- exports.DEFAULT_STATUSLIST_CACHE_TTL_SEC = 60;
60
- exports.MAX_STATUSLIST_SIZE = 1000000;
61
- exports.STATUSLIST_2021_CONTEXT = 'https://w3id.org/vc/status-list/2021/v1';