@kya-os/contracts 1.3.2 → 1.3.3

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 (82) hide show
  1. package/README.md +1 -1
  2. package/dist/agentshield-api/endpoints.d.ts +21 -0
  3. package/dist/agentshield-api/endpoints.js +20 -0
  4. package/dist/agentshield-api/index.d.ts +5 -0
  5. package/dist/agentshield-api/index.js +27 -0
  6. package/dist/agentshield-api/schemas.d.ts +9846 -0
  7. package/dist/agentshield-api/schemas.js +92 -0
  8. package/dist/agentshield-api/types.d.ts +92 -0
  9. package/dist/agentshield-api/types.js +12 -0
  10. package/dist/cli.d.ts +3 -6
  11. package/dist/cli.js +3 -10
  12. package/dist/config/base.d.ts +19 -0
  13. package/dist/config/base.js +2 -0
  14. package/dist/config/delegation.d.ts +46 -0
  15. package/dist/config/delegation.js +2 -0
  16. package/dist/config/identity.d.ts +22 -0
  17. package/dist/config/identity.js +2 -0
  18. package/dist/config/index.d.ts +17 -0
  19. package/dist/config/index.js +2 -0
  20. package/dist/config/proofing.d.ts +26 -0
  21. package/dist/config/proofing.js +2 -0
  22. package/dist/config/tool-protection.d.ts +36 -0
  23. package/dist/config/tool-protection.js +2 -0
  24. package/dist/delegation/constraints.d.ts +0 -266
  25. package/dist/delegation/constraints.js +3 -110
  26. package/dist/delegation/index.d.ts +0 -6
  27. package/dist/delegation/index.js +0 -6
  28. package/dist/delegation/schemas.d.ts +174 -514
  29. package/dist/delegation/schemas.js +3 -247
  30. package/dist/did/index.d.ts +0 -6
  31. package/dist/did/index.js +0 -6
  32. package/dist/did/resolve-contract.d.ts +0 -167
  33. package/dist/did/resolve-contract.js +0 -20
  34. package/dist/did/schemas.d.ts +0 -80
  35. package/dist/did/schemas.js +4 -97
  36. package/dist/did/types.d.ts +0 -126
  37. package/dist/did/types.js +0 -34
  38. package/dist/env/constants.d.ts +0 -45
  39. package/dist/env/constants.js +0 -45
  40. package/dist/env/index.d.ts +0 -4
  41. package/dist/env/index.js +0 -4
  42. package/dist/handshake.d.ts +0 -21
  43. package/dist/handshake.js +3 -11
  44. package/dist/index.d.ts +0 -15
  45. package/dist/index.js +0 -25
  46. package/dist/proof/index.d.ts +0 -7
  47. package/dist/proof/index.js +0 -7
  48. package/dist/proof/proof-record.d.ts +62 -172
  49. package/dist/proof/proof-record.js +0 -74
  50. package/dist/proof/signing-spec.d.ts +12 -86
  51. package/dist/proof/signing-spec.js +0 -71
  52. package/dist/proof.d.ts +16 -38
  53. package/dist/proof.js +3 -26
  54. package/dist/registry.d.ts +10 -27
  55. package/dist/registry.js +9 -30
  56. package/dist/runtime/errors.d.ts +0 -169
  57. package/dist/runtime/errors.js +0 -69
  58. package/dist/runtime/headers.d.ts +0 -50
  59. package/dist/runtime/headers.js +0 -30
  60. package/dist/runtime/index.d.ts +0 -4
  61. package/dist/runtime/index.js +0 -4
  62. package/dist/test.d.ts +0 -37
  63. package/dist/test.js +0 -37
  64. package/dist/tlkrc/index.d.ts +0 -4
  65. package/dist/tlkrc/index.js +0 -4
  66. package/dist/tlkrc/rotation.d.ts +12 -90
  67. package/dist/tlkrc/rotation.js +0 -72
  68. package/dist/tool-protection/index.d.ts +129 -0
  69. package/dist/tool-protection/index.js +80 -0
  70. package/dist/utils/validation.d.ts +0 -17
  71. package/dist/utils/validation.js +0 -14
  72. package/dist/vc/index.d.ts +0 -6
  73. package/dist/vc/index.js +0 -6
  74. package/dist/vc/schemas.d.ts +0 -596
  75. package/dist/vc/schemas.js +2 -111
  76. package/dist/vc/statuslist.d.ts +0 -202
  77. package/dist/vc/statuslist.js +1 -73
  78. package/dist/verifier.d.ts +9 -13
  79. package/dist/verifier.js +0 -8
  80. package/dist/well-known/index.d.ts +248 -0
  81. package/dist/well-known/index.js +104 -0
  82. package/package.json +27 -5
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Verifiable Credentials (W3C 1.1) Schemas
4
- *
5
- * Zod schemas and TypeScript types for W3C Verifiable Credentials Data Model 1.1.
6
- * These schemas provide runtime validation and can emit JSON Schemas for interoperability.
7
- *
8
- * Related Spec: MCP-I §3, W3C VC Data Model 1.1
9
- * Python Reference: Credential-Documentation.md, Credential-Service.md
10
- */
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
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;
13
4
  exports.validateVerifiableCredential = validateVerifiableCredential;
@@ -16,84 +7,39 @@ exports.isCredentialExpired = isCredentialExpired;
16
7
  exports.getIssuerDid = getIssuerDid;
17
8
  exports.getSubjectDid = getSubjectDid;
18
9
  const zod_1 = require("zod");
19
- /**
20
- * Standard W3C Verifiable Credentials context
21
- */
22
10
  exports.VC_CONTEXT = ['https://www.w3.org/2018/credentials/v1'];
23
- /**
24
- * Additional context for StatusList2021
25
- */
26
11
  exports.STATUS_LIST_CONTEXT = 'https://w3id.org/vc/status-list/2021/v1';
27
- /**
28
- * Context Entry Schema
29
- *
30
- * Supports both string URLs and context objects
31
- */
32
12
  exports.ContextEntrySchema = zod_1.z.union([
33
13
  zod_1.z.string().url(),
34
14
  zod_1.z.record(zod_1.z.any()),
35
15
  ]);
36
- /**
37
- * @context Schema
38
- *
39
- * The @context property establishes the semantic context of the credential.
40
- * MUST include the base VC context and MAY include additional contexts.
41
- */
42
16
  exports.ContextSchema = zod_1.z
43
17
  .array(exports.ContextEntrySchema)
44
18
  .nonempty()
45
19
  .refine((contexts) => {
46
- // First context must be the base VC context
47
20
  const firstContext = contexts[0];
48
21
  return (typeof firstContext === 'string' &&
49
22
  firstContext === exports.VC_CONTEXT[0]);
50
23
  }, {
51
24
  message: 'First @context must be "https://www.w3.org/2018/credentials/v1"',
52
25
  });
53
- /**
54
- * Issuer Schema
55
- *
56
- * The issuer can be a DID string or an object with an id field
57
- */
58
26
  exports.IssuerSchema = zod_1.z.union([
59
27
  zod_1.z.string().min(1),
60
28
  zod_1.z.object({
61
29
  id: zod_1.z.string().min(1),
62
- }).passthrough(), // Allow additional properties
30
+ }).passthrough(),
63
31
  ]);
64
- /**
65
- * Credential Subject Schema
66
- *
67
- * The subject of the credential. Can be a single object or array of objects.
68
- * MUST have an id property that is a DID or URI.
69
- */
70
32
  exports.CredentialSubjectSchema = zod_1.z.union([
71
33
  zod_1.z.record(zod_1.z.any()),
72
34
  zod_1.z.array(zod_1.z.record(zod_1.z.any())),
73
35
  ]);
74
- /**
75
- * Credential Status Schema (StatusList2021Entry)
76
- *
77
- * References a position in a StatusList2021 credential for revocation/suspension checking.
78
- */
79
36
  exports.CredentialStatusSchema = zod_1.z.object({
80
- /** URI of this status entry */
81
37
  id: zod_1.z.string().url(),
82
- /** Type MUST be StatusList2021Entry */
83
38
  type: zod_1.z.literal('StatusList2021Entry'),
84
- /** Purpose of the status list (revocation or suspension) */
85
39
  statusPurpose: zod_1.z.enum(['revocation', 'suspension']),
86
- /** Index of this credential in the status list (as string per spec) */
87
40
  statusListIndex: zod_1.z.string().regex(/^\d+$/, 'Must be a numeric string'),
88
- /** URL of the StatusList2021Credential */
89
41
  statusListCredential: zod_1.z.string().url(),
90
42
  });
91
- /**
92
- * Proof Schema
93
- *
94
- * Cryptographic proof for the credential.
95
- * This is a flexible schema as proof formats vary.
96
- */
97
43
  exports.ProofSchema = zod_1.z
98
44
  .object({
99
45
  type: zod_1.z.string().min(1),
@@ -101,44 +47,23 @@ exports.ProofSchema = zod_1.z
101
47
  verificationMethod: zod_1.z.string().optional(),
102
48
  proofPurpose: zod_1.z.string().optional(),
103
49
  })
104
- .passthrough(); // Allow additional proof-specific fields
105
- /**
106
- * Verifiable Credential Schema (W3C 1.1)
107
- *
108
- * Core schema for W3C Verifiable Credentials.
109
- * Supports all required and common optional fields.
110
- */
50
+ .passthrough();
111
51
  exports.VerifiableCredentialSchema = zod_1.z.object({
112
- /** JSON-LD context */
113
52
  '@context': exports.ContextSchema,
114
- /** Unique identifier for the credential (optional per spec) */
115
53
  id: zod_1.z.string().url().optional(),
116
- /** Type of the credential, MUST include "VerifiableCredential" */
117
54
  type: zod_1.z
118
55
  .array(zod_1.z.string())
119
56
  .min(1)
120
57
  .refine((types) => types.includes('VerifiableCredential'), {
121
58
  message: 'type must include "VerifiableCredential"',
122
59
  }),
123
- /** Issuer of the credential (DID or issuer object) */
124
60
  issuer: exports.IssuerSchema,
125
- /** Issuance date in ISO 8601 format */
126
61
  issuanceDate: zod_1.z.string().datetime(),
127
- /** Expiration date in ISO 8601 format (optional) */
128
62
  expirationDate: zod_1.z.string().datetime().optional(),
129
- /** The subject(s) of the credential */
130
63
  credentialSubject: exports.CredentialSubjectSchema,
131
- /** Status information for revocation/suspension (optional) */
132
64
  credentialStatus: exports.CredentialStatusSchema.optional(),
133
- /** Cryptographic proof (optional, may be added as external proof) */
134
65
  proof: exports.ProofSchema.optional(),
135
- /** Allow additional properties for extensibility */
136
66
  }).passthrough();
137
- /**
138
- * Verifiable Presentation Schema
139
- *
140
- * Schema for presenting one or more credentials.
141
- */
142
67
  exports.VerifiablePresentationSchema = zod_1.z.object({
143
68
  '@context': exports.ContextSchema,
144
69
  id: zod_1.z.string().url().optional(),
@@ -157,33 +82,12 @@ exports.VerifiablePresentationSchema = zod_1.z.object({
157
82
  .optional(),
158
83
  proof: exports.ProofSchema.optional(),
159
84
  }).passthrough();
160
- /**
161
- * Validation Helpers
162
- */
163
- /**
164
- * Validate a verifiable credential
165
- *
166
- * @param credential - The credential to validate
167
- * @returns Validation result with parsed credential or errors
168
- */
169
85
  function validateVerifiableCredential(credential) {
170
86
  return exports.VerifiableCredentialSchema.safeParse(credential);
171
87
  }
172
- /**
173
- * Validate a verifiable presentation
174
- *
175
- * @param presentation - The presentation to validate
176
- * @returns Validation result with parsed presentation or errors
177
- */
178
88
  function validateVerifiablePresentation(presentation) {
179
89
  return exports.VerifiablePresentationSchema.safeParse(presentation);
180
90
  }
181
- /**
182
- * Check if a credential is expired
183
- *
184
- * @param credential - The credential to check
185
- * @returns true if expired, false otherwise
186
- */
187
91
  function isCredentialExpired(credential) {
188
92
  if (!credential.expirationDate) {
189
93
  return false;
@@ -197,12 +101,6 @@ function isCredentialExpired(credential) {
197
101
  return false;
198
102
  }
199
103
  }
200
- /**
201
- * Extract issuer DID from credential
202
- *
203
- * @param credential - The credential
204
- * @returns The issuer DID string
205
- */
206
104
  function getIssuerDid(credential) {
207
105
  const issuer = credential.issuer;
208
106
  if (typeof issuer === 'string') {
@@ -210,16 +108,9 @@ function getIssuerDid(credential) {
210
108
  }
211
109
  return issuer.id;
212
110
  }
213
- /**
214
- * Extract credential subject DID (if present)
215
- *
216
- * @param credential - The credential
217
- * @returns The subject DID or null if not present
218
- */
219
111
  function getSubjectDid(credential) {
220
112
  const subject = Array.isArray(credential.credentialSubject)
221
113
  ? credential.credentialSubject[0]
222
114
  : credential.credentialSubject;
223
115
  return subject?.id || null;
224
116
  }
225
- //# sourceMappingURL=schemas.js.map
@@ -1,39 +1,9 @@
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
1
  import { z } from 'zod';
11
- /**
12
- * Status Purpose
13
- *
14
- * Indicates the purpose of the status list
15
- */
16
2
  export type StatusPurpose = 'revocation' | 'suspension';
17
- /**
18
- * Status List Credential Subject Schema
19
- *
20
- * The credential subject of a StatusList2021Credential
21
- */
22
3
  export declare const StatusList2021CredentialSubjectSchema: z.ZodObject<{
23
- /** Optional identifier for the status list */
24
4
  id: z.ZodOptional<z.ZodString>;
25
- /** Type MUST be StatusList2021 */
26
5
  type: z.ZodLiteral<"StatusList2021">;
27
- /** Purpose of the status list */
28
6
  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
7
  encodedList: z.ZodString;
38
8
  }, "strip", z.ZodTypeAny, {
39
9
  type: "StatusList2021";
@@ -46,20 +16,10 @@ export declare const StatusList2021CredentialSubjectSchema: z.ZodObject<{
46
16
  encodedList: string;
47
17
  id?: string | undefined;
48
18
  }>;
49
- /**
50
- * StatusList2021 Credential Schema
51
- *
52
- * A credential that contains a status list for checking revocation/suspension
53
- * of other credentials.
54
- */
55
19
  export declare const StatusList2021CredentialSchema: z.ZodObject<{
56
- /** JSON-LD context */
57
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>)[]]>;
58
- /** Unique identifier for the status list credential */
59
21
  id: z.ZodString;
60
- /** Type MUST include VerifiableCredential and StatusList2021Credential */
61
22
  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
23
  issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
64
24
  id: z.ZodString;
65
25
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -67,24 +27,11 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
67
27
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
68
28
  id: z.ZodString;
69
29
  }, z.ZodTypeAny, "passthrough">>]>;
70
- /** Issuance date in ISO 8601 format */
71
30
  issuanceDate: z.ZodString;
72
- /** The status list credential subject */
73
31
  credentialSubject: z.ZodObject<{
74
- /** Optional identifier for the status list */
75
32
  id: z.ZodOptional<z.ZodString>;
76
- /** Type MUST be StatusList2021 */
77
33
  type: z.ZodLiteral<"StatusList2021">;
78
- /** Purpose of the status list */
79
34
  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
35
  encodedList: z.ZodString;
89
36
  }, "strip", z.ZodTypeAny, {
90
37
  type: "StatusList2021";
@@ -97,7 +44,6 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
97
44
  encodedList: string;
98
45
  id?: string | undefined;
99
46
  }>;
100
- /** Cryptographic proof (optional) */
101
47
  proof: z.ZodOptional<z.ZodObject<{
102
48
  type: z.ZodString;
103
49
  created: z.ZodOptional<z.ZodString>;
@@ -115,13 +61,9 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
115
61
  proofPurpose: z.ZodOptional<z.ZodString>;
116
62
  }, z.ZodTypeAny, "passthrough">>>;
117
63
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
118
- /** JSON-LD context */
119
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>)[]]>;
120
- /** Unique identifier for the status list credential */
121
65
  id: z.ZodString;
122
- /** Type MUST include VerifiableCredential and StatusList2021Credential */
123
66
  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
67
  issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
126
68
  id: z.ZodString;
127
69
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -129,24 +71,11 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
129
71
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
130
72
  id: z.ZodString;
131
73
  }, z.ZodTypeAny, "passthrough">>]>;
132
- /** Issuance date in ISO 8601 format */
133
74
  issuanceDate: z.ZodString;
134
- /** The status list credential subject */
135
75
  credentialSubject: z.ZodObject<{
136
- /** Optional identifier for the status list */
137
76
  id: z.ZodOptional<z.ZodString>;
138
- /** Type MUST be StatusList2021 */
139
77
  type: z.ZodLiteral<"StatusList2021">;
140
- /** Purpose of the status list */
141
78
  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
79
  encodedList: z.ZodString;
151
80
  }, "strip", z.ZodTypeAny, {
152
81
  type: "StatusList2021";
@@ -159,7 +88,6 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
159
88
  encodedList: string;
160
89
  id?: string | undefined;
161
90
  }>;
162
- /** Cryptographic proof (optional) */
163
91
  proof: z.ZodOptional<z.ZodObject<{
164
92
  type: z.ZodString;
165
93
  created: z.ZodOptional<z.ZodString>;
@@ -177,13 +105,9 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
177
105
  proofPurpose: z.ZodOptional<z.ZodString>;
178
106
  }, z.ZodTypeAny, "passthrough">>>;
179
107
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
180
- /** JSON-LD context */
181
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>)[]]>;
182
- /** Unique identifier for the status list credential */
183
109
  id: z.ZodString;
184
- /** Type MUST include VerifiableCredential and StatusList2021Credential */
185
110
  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
111
  issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
188
112
  id: z.ZodString;
189
113
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -191,24 +115,11 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
191
115
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
192
116
  id: z.ZodString;
193
117
  }, z.ZodTypeAny, "passthrough">>]>;
194
- /** Issuance date in ISO 8601 format */
195
118
  issuanceDate: z.ZodString;
196
- /** The status list credential subject */
197
119
  credentialSubject: z.ZodObject<{
198
- /** Optional identifier for the status list */
199
120
  id: z.ZodOptional<z.ZodString>;
200
- /** Type MUST be StatusList2021 */
201
121
  type: z.ZodLiteral<"StatusList2021">;
202
- /** Purpose of the status list */
203
122
  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
123
  encodedList: z.ZodString;
213
124
  }, "strip", z.ZodTypeAny, {
214
125
  type: "StatusList2021";
@@ -221,7 +132,6 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
221
132
  encodedList: string;
222
133
  id?: string | undefined;
223
134
  }>;
224
- /** Cryptographic proof (optional) */
225
135
  proof: z.ZodOptional<z.ZodObject<{
226
136
  type: z.ZodString;
227
137
  created: z.ZodOptional<z.ZodString>;
@@ -239,16 +149,8 @@ export declare const StatusList2021CredentialSchema: z.ZodObject<{
239
149
  proofPurpose: z.ZodOptional<z.ZodString>;
240
150
  }, z.ZodTypeAny, "passthrough">>>;
241
151
  }, z.ZodTypeAny, "passthrough">>;
242
- /**
243
- * Type exports
244
- */
245
152
  export type StatusList2021CredentialSubject = z.infer<typeof StatusList2021CredentialSubjectSchema>;
246
153
  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
154
  export interface StatusList2021CredentialInterface {
253
155
  '@context': (string | Record<string, any>)[];
254
156
  id: string;
@@ -265,23 +167,10 @@ export interface StatusList2021CredentialInterface {
265
167
  };
266
168
  proof?: Record<string, any>;
267
169
  }
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
170
  export declare function validateStatusList2021Credential(credential: unknown): z.SafeParseReturnType<z.objectInputType<{
278
- /** JSON-LD context */
279
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>)[]]>;
280
- /** Unique identifier for the status list credential */
281
172
  id: z.ZodString;
282
- /** Type MUST include VerifiableCredential and StatusList2021Credential */
283
173
  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
174
  issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
286
175
  id: z.ZodString;
287
176
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -289,24 +178,11 @@ export declare function validateStatusList2021Credential(credential: unknown): z
289
178
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
290
179
  id: z.ZodString;
291
180
  }, z.ZodTypeAny, "passthrough">>]>;
292
- /** Issuance date in ISO 8601 format */
293
181
  issuanceDate: z.ZodString;
294
- /** The status list credential subject */
295
182
  credentialSubject: z.ZodObject<{
296
- /** Optional identifier for the status list */
297
183
  id: z.ZodOptional<z.ZodString>;
298
- /** Type MUST be StatusList2021 */
299
184
  type: z.ZodLiteral<"StatusList2021">;
300
- /** Purpose of the status list */
301
185
  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
186
  encodedList: z.ZodString;
311
187
  }, "strip", z.ZodTypeAny, {
312
188
  type: "StatusList2021";
@@ -319,7 +195,6 @@ export declare function validateStatusList2021Credential(credential: unknown): z
319
195
  encodedList: string;
320
196
  id?: string | undefined;
321
197
  }>;
322
- /** Cryptographic proof (optional) */
323
198
  proof: z.ZodOptional<z.ZodObject<{
324
199
  type: z.ZodString;
325
200
  created: z.ZodOptional<z.ZodString>;
@@ -337,13 +212,9 @@ export declare function validateStatusList2021Credential(credential: unknown): z
337
212
  proofPurpose: z.ZodOptional<z.ZodString>;
338
213
  }, z.ZodTypeAny, "passthrough">>>;
339
214
  }, z.ZodTypeAny, "passthrough">, z.objectOutputType<{
340
- /** JSON-LD context */
341
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>)[]]>;
342
- /** Unique identifier for the status list credential */
343
216
  id: z.ZodString;
344
- /** Type MUST include VerifiableCredential and StatusList2021Credential */
345
217
  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
218
  issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
348
219
  id: z.ZodString;
349
220
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -351,24 +222,11 @@ export declare function validateStatusList2021Credential(credential: unknown): z
351
222
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
352
223
  id: z.ZodString;
353
224
  }, z.ZodTypeAny, "passthrough">>]>;
354
- /** Issuance date in ISO 8601 format */
355
225
  issuanceDate: z.ZodString;
356
- /** The status list credential subject */
357
226
  credentialSubject: z.ZodObject<{
358
- /** Optional identifier for the status list */
359
227
  id: z.ZodOptional<z.ZodString>;
360
- /** Type MUST be StatusList2021 */
361
228
  type: z.ZodLiteral<"StatusList2021">;
362
- /** Purpose of the status list */
363
229
  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
230
  encodedList: z.ZodString;
373
231
  }, "strip", z.ZodTypeAny, {
374
232
  type: "StatusList2021";
@@ -381,7 +239,6 @@ export declare function validateStatusList2021Credential(credential: unknown): z
381
239
  encodedList: string;
382
240
  id?: string | undefined;
383
241
  }>;
384
- /** Cryptographic proof (optional) */
385
242
  proof: z.ZodOptional<z.ZodObject<{
386
243
  type: z.ZodString;
387
244
  created: z.ZodOptional<z.ZodString>;
@@ -399,73 +256,29 @@ export declare function validateStatusList2021Credential(credential: unknown): z
399
256
  proofPurpose: z.ZodOptional<z.ZodString>;
400
257
  }, z.ZodTypeAny, "passthrough">>>;
401
258
  }, 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
259
  export interface BitStringEncodeOptions {
412
- /** Total size of the bitstring (number of bits) */
413
260
  size: number;
414
- /** Positions to set to 1 (revoked/suspended) */
415
261
  setBits?: number[];
416
262
  }
417
- /**
418
- * Bitstring decoding result
419
- */
420
263
  export interface BitStringDecodeResult {
421
- /** Total size of the bitstring */
422
264
  size: number;
423
- /** Positions that are set to 1 */
424
265
  setBits: number[];
425
- /** Check if a specific index is set */
426
266
  isSet: (index: number) => boolean;
427
267
  }
428
- /**
429
- * Cache entry for StatusList2021 credentials
430
- *
431
- * Used for efficient caching of status list credentials with ETag support
432
- */
433
268
  export interface StatusListCacheEntry {
434
- /** The cached status list credential */
435
269
  credential: StatusList2021Credential;
436
- /** ETag from the HTTP response (if applicable) */
437
270
  etag?: string;
438
- /** Timestamp when cached (milliseconds since epoch) */
439
271
  cachedAt: number;
440
- /** TTL in seconds */
441
272
  ttlSec: number;
442
- /** Expires at timestamp (milliseconds since epoch) */
443
273
  expiresAt: number;
444
274
  }
445
- /**
446
- * Status checking result
447
- */
448
275
  export interface StatusCheckResult {
449
- /** Whether the credential is valid (not revoked/suspended) */
450
276
  valid: boolean;
451
- /** The status (active, revoked, suspended) */
452
277
  status: 'active' | 'revoked' | 'suspended';
453
- /** Optional reason for status */
454
278
  reason?: string;
455
- /** Timestamp when checked */
456
279
  checkedAt: number;
457
- /** Whether result came from cache */
458
280
  fromCache?: boolean;
459
281
  }
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
282
  export declare function createStatusListCredentialStructure(config: {
470
283
  id: string;
471
284
  issuer: string | {
@@ -474,21 +287,6 @@ export declare function createStatusListCredentialStructure(config: {
474
287
  statusPurpose: StatusPurpose;
475
288
  encodedList: string;
476
289
  }): 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
290
  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
291
  export declare const MAX_STATUSLIST_SIZE = 1000000;
490
- /**
491
- * StatusList2021 context URL
492
- */
493
292
  export declare const STATUSLIST_2021_CONTEXT = "https://w3id.org/vc/status-list/2021/v1";
494
- //# sourceMappingURL=statuslist.d.ts.map