@kya-os/contracts 1.3.3 → 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.
Files changed (82) 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/cli.d.ts +0 -375
  12. package/dist/cli.js +0 -109
  13. package/dist/config/base.d.ts +0 -19
  14. package/dist/config/base.js +0 -2
  15. package/dist/config/delegation.d.ts +0 -46
  16. package/dist/config/delegation.js +0 -2
  17. package/dist/config/identity.d.ts +0 -22
  18. package/dist/config/identity.js +0 -2
  19. package/dist/config/index.d.ts +0 -17
  20. package/dist/config/index.js +0 -2
  21. package/dist/config/proofing.d.ts +0 -26
  22. package/dist/config/proofing.js +0 -2
  23. package/dist/config/tool-protection.d.ts +0 -36
  24. package/dist/config/tool-protection.js +0 -2
  25. package/dist/delegation/constraints.d.ts +0 -726
  26. package/dist/delegation/constraints.js +0 -103
  27. package/dist/delegation/index.d.ts +0 -2
  28. package/dist/delegation/index.js +0 -18
  29. package/dist/delegation/schemas.d.ts +0 -8042
  30. package/dist/delegation/schemas.js +0 -232
  31. package/dist/did/index.d.ts +0 -3
  32. package/dist/did/index.js +0 -19
  33. package/dist/did/resolve-contract.d.ts +0 -53
  34. package/dist/did/resolve-contract.js +0 -12
  35. package/dist/did/schemas.d.ts +0 -33
  36. package/dist/did/schemas.js +0 -80
  37. package/dist/did/types.d.ts +0 -38
  38. package/dist/did/types.js +0 -37
  39. package/dist/env/constants.d.ts +0 -13
  40. package/dist/env/constants.js +0 -15
  41. package/dist/env/index.d.ts +0 -1
  42. package/dist/env/index.js +0 -17
  43. package/dist/handshake.d.ts +0 -138
  44. package/dist/handshake.js +0 -50
  45. package/dist/index.d.ts +0 -11
  46. package/dist/index.js +0 -28
  47. package/dist/proof/index.d.ts +0 -2
  48. package/dist/proof/index.js +0 -18
  49. package/dist/proof/proof-record.d.ts +0 -728
  50. package/dist/proof/proof-record.js +0 -60
  51. package/dist/proof/signing-spec.d.ts +0 -73
  52. package/dist/proof/signing-spec.js +0 -52
  53. package/dist/proof.d.ts +0 -378
  54. package/dist/proof.js +0 -59
  55. package/dist/registry.d.ts +0 -326
  56. package/dist/registry.js +0 -98
  57. package/dist/runtime/errors.d.ts +0 -179
  58. package/dist/runtime/errors.js +0 -51
  59. package/dist/runtime/headers.d.ts +0 -34
  60. package/dist/runtime/headers.js +0 -52
  61. package/dist/runtime/index.d.ts +0 -2
  62. package/dist/runtime/index.js +0 -18
  63. package/dist/test.d.ts +0 -215
  64. package/dist/test.js +0 -83
  65. package/dist/tlkrc/index.d.ts +0 -1
  66. package/dist/tlkrc/index.js +0 -17
  67. package/dist/tlkrc/rotation.d.ts +0 -168
  68. package/dist/tlkrc/rotation.js +0 -55
  69. package/dist/tool-protection/index.d.ts +0 -129
  70. package/dist/tool-protection/index.js +0 -80
  71. package/dist/utils/validation.d.ts +0 -14
  72. package/dist/utils/validation.js +0 -56
  73. package/dist/vc/index.d.ts +0 -2
  74. package/dist/vc/index.js +0 -18
  75. package/dist/vc/schemas.d.ts +0 -1888
  76. package/dist/vc/schemas.js +0 -116
  77. package/dist/vc/statuslist.d.ts +0 -292
  78. package/dist/vc/statuslist.js +0 -61
  79. package/dist/verifier.d.ts +0 -202
  80. package/dist/verifier.js +0 -76
  81. package/dist/well-known/index.d.ts +0 -248
  82. 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';
@@ -1,202 +0,0 @@
1
- import { z } from "zod";
2
- export declare const AgentContextSchema: z.ZodObject<{
3
- did: z.ZodString;
4
- kid: z.ZodString;
5
- subject: z.ZodOptional<z.ZodString>;
6
- scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
7
- session: z.ZodString;
8
- confidence: z.ZodLiteral<"verified">;
9
- delegationRef: z.ZodOptional<z.ZodString>;
10
- registry: z.ZodString;
11
- verifiedAt: z.ZodNumber;
12
- }, "strip", z.ZodTypeAny, {
13
- did: string;
14
- kid: string;
15
- session: string;
16
- scopes: string[];
17
- confidence: "verified";
18
- registry: string;
19
- verifiedAt: number;
20
- delegationRef?: string | undefined;
21
- subject?: string | undefined;
22
- }, {
23
- did: string;
24
- kid: string;
25
- session: string;
26
- confidence: "verified";
27
- registry: string;
28
- verifiedAt: number;
29
- delegationRef?: string | undefined;
30
- subject?: string | undefined;
31
- scopes?: string[] | undefined;
32
- }>;
33
- export declare const VerifierResultSchema: z.ZodObject<{
34
- success: z.ZodBoolean;
35
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
36
- agentContext: z.ZodOptional<z.ZodObject<{
37
- did: z.ZodString;
38
- kid: z.ZodString;
39
- subject: z.ZodOptional<z.ZodString>;
40
- scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
41
- session: z.ZodString;
42
- confidence: z.ZodLiteral<"verified">;
43
- delegationRef: z.ZodOptional<z.ZodString>;
44
- registry: z.ZodString;
45
- verifiedAt: z.ZodNumber;
46
- }, "strip", z.ZodTypeAny, {
47
- did: string;
48
- kid: string;
49
- session: string;
50
- scopes: string[];
51
- confidence: "verified";
52
- registry: string;
53
- verifiedAt: number;
54
- delegationRef?: string | undefined;
55
- subject?: string | undefined;
56
- }, {
57
- did: string;
58
- kid: string;
59
- session: string;
60
- confidence: "verified";
61
- registry: string;
62
- verifiedAt: number;
63
- delegationRef?: string | undefined;
64
- subject?: string | undefined;
65
- scopes?: string[] | undefined;
66
- }>>;
67
- error: z.ZodOptional<z.ZodObject<{
68
- code: z.ZodString;
69
- message: z.ZodString;
70
- details: z.ZodOptional<z.ZodAny>;
71
- httpStatus: z.ZodNumber;
72
- }, "strip", z.ZodTypeAny, {
73
- code: string;
74
- message: string;
75
- httpStatus: number;
76
- details?: any;
77
- }, {
78
- code: string;
79
- message: string;
80
- httpStatus: number;
81
- details?: any;
82
- }>>;
83
- }, "strip", z.ZodTypeAny, {
84
- success: boolean;
85
- error?: {
86
- code: string;
87
- message: string;
88
- httpStatus: number;
89
- details?: any;
90
- } | undefined;
91
- headers?: Record<string, string> | undefined;
92
- agentContext?: {
93
- did: string;
94
- kid: string;
95
- session: string;
96
- scopes: string[];
97
- confidence: "verified";
98
- registry: string;
99
- verifiedAt: number;
100
- delegationRef?: string | undefined;
101
- subject?: string | undefined;
102
- } | undefined;
103
- }, {
104
- success: boolean;
105
- error?: {
106
- code: string;
107
- message: string;
108
- httpStatus: number;
109
- details?: any;
110
- } | undefined;
111
- headers?: Record<string, string> | undefined;
112
- agentContext?: {
113
- did: string;
114
- kid: string;
115
- session: string;
116
- confidence: "verified";
117
- registry: string;
118
- verifiedAt: number;
119
- delegationRef?: string | undefined;
120
- subject?: string | undefined;
121
- scopes?: string[] | undefined;
122
- } | undefined;
123
- }>;
124
- export declare const StructuredErrorSchema: z.ZodObject<{
125
- code: z.ZodString;
126
- message: z.ZodString;
127
- httpStatus: z.ZodNumber;
128
- details: z.ZodOptional<z.ZodObject<{
129
- reason: z.ZodOptional<z.ZodString>;
130
- expected: z.ZodOptional<z.ZodAny>;
131
- received: z.ZodOptional<z.ZodAny>;
132
- remediation: z.ZodOptional<z.ZodString>;
133
- }, "strip", z.ZodTypeAny, {
134
- expected?: any;
135
- received?: any;
136
- reason?: string | undefined;
137
- remediation?: string | undefined;
138
- }, {
139
- expected?: any;
140
- received?: any;
141
- reason?: string | undefined;
142
- remediation?: string | undefined;
143
- }>>;
144
- }, "strip", z.ZodTypeAny, {
145
- code: string;
146
- message: string;
147
- httpStatus: number;
148
- details?: {
149
- expected?: any;
150
- received?: any;
151
- reason?: string | undefined;
152
- remediation?: string | undefined;
153
- } | undefined;
154
- }, {
155
- code: string;
156
- message: string;
157
- httpStatus: number;
158
- details?: {
159
- expected?: any;
160
- received?: any;
161
- reason?: string | undefined;
162
- remediation?: string | undefined;
163
- } | undefined;
164
- }>;
165
- export type AgentContext = z.infer<typeof AgentContextSchema>;
166
- export type VerifierResult = z.infer<typeof VerifierResultSchema>;
167
- export type StructuredError = z.infer<typeof StructuredErrorSchema>;
168
- export declare const AGENT_HEADERS: {
169
- readonly DID: "X-Agent-DID";
170
- readonly KEY_ID: "X-Agent-KeyId";
171
- readonly SUBJECT: "X-Agent-Subject";
172
- readonly SCOPES: "X-Agent-Scopes";
173
- readonly SESSION: "X-Agent-Session";
174
- readonly CONFIDENCE: "X-Agent-Confidence";
175
- readonly DELEGATION_REF: "X-Agent-Delegation-Ref";
176
- readonly REGISTRY: "X-Agent-Registry";
177
- readonly VERIFIED_AT: "X-Agent-Verified-At";
178
- };
179
- export declare const VERIFIER_ERROR_CODES: {
180
- readonly PROOF_INVALID_TS: "XMCP_I_PROOF_INVALID_TS";
181
- readonly PROOF_FUTURE_TS: "XMCP_I_PROOF_FUTURE_TS";
182
- readonly PROOF_TOO_OLD: "XMCP_I_PROOF_TOO_OLD";
183
- readonly PROOF_SKEW_EXCEEDED: "XMCP_I_PROOF_SKEW_EXCEEDED";
184
- readonly SESSION_IDLE_EXPIRED: "XMCP_I_SESSION_IDLE_EXPIRED";
185
- readonly SERVER_TIME_INVALID: "XMCP_I_SERVER_TIME_INVALID";
186
- };
187
- export declare const ERROR_HTTP_STATUS: {
188
- readonly XMCP_I_EBADPROOF: 403;
189
- readonly XMCP_I_ENOIDENTITY: 500;
190
- readonly XMCP_I_EMIRRORPENDING: 200;
191
- readonly XMCP_I_EHANDSHAKE: 401;
192
- readonly XMCP_I_ESESSION: 401;
193
- readonly XMCP_I_ECLAIM: 400;
194
- readonly XMCP_I_ECONFIG: 500;
195
- readonly XMCP_I_ERUNTIME: 500;
196
- readonly XMCP_I_PROOF_INVALID_TS: 403;
197
- readonly XMCP_I_PROOF_FUTURE_TS: 403;
198
- readonly XMCP_I_PROOF_TOO_OLD: 403;
199
- readonly XMCP_I_PROOF_SKEW_EXCEEDED: 401;
200
- readonly XMCP_I_SESSION_IDLE_EXPIRED: 401;
201
- readonly XMCP_I_SERVER_TIME_INVALID: 500;
202
- };