@kya-os/contracts 1.3.4 → 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.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,375 @@
1
+ import { z } from "zod";
2
+ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
3
+ version: z.ZodLiteral<"1.0">;
4
+ did: z.ZodString;
5
+ kid: z.ZodOptional<z.ZodString>;
6
+ keyId: z.ZodOptional<z.ZodString>;
7
+ privateKey: z.ZodString;
8
+ publicKey: z.ZodString;
9
+ createdAt: z.ZodString;
10
+ lastRotated: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ version: "1.0";
13
+ did: string;
14
+ privateKey: string;
15
+ publicKey: string;
16
+ createdAt: string;
17
+ kid?: string | undefined;
18
+ keyId?: string | undefined;
19
+ lastRotated?: string | undefined;
20
+ }, {
21
+ version: "1.0";
22
+ did: string;
23
+ privateKey: string;
24
+ publicKey: string;
25
+ createdAt: string;
26
+ kid?: string | undefined;
27
+ keyId?: string | undefined;
28
+ lastRotated?: string | undefined;
29
+ }>, {
30
+ version: "1.0";
31
+ did: string;
32
+ privateKey: string;
33
+ publicKey: string;
34
+ createdAt: string;
35
+ kid?: string | undefined;
36
+ keyId?: string | undefined;
37
+ lastRotated?: string | undefined;
38
+ }, {
39
+ version: "1.0";
40
+ did: string;
41
+ privateKey: string;
42
+ publicKey: string;
43
+ createdAt: string;
44
+ kid?: string | undefined;
45
+ keyId?: string | undefined;
46
+ lastRotated?: string | undefined;
47
+ }>, {
48
+ version: "1.0";
49
+ did: string;
50
+ kid: string;
51
+ privateKey: string;
52
+ publicKey: string;
53
+ createdAt: string;
54
+ lastRotated: string | undefined;
55
+ }, {
56
+ version: "1.0";
57
+ did: string;
58
+ privateKey: string;
59
+ publicKey: string;
60
+ createdAt: string;
61
+ kid?: string | undefined;
62
+ keyId?: string | undefined;
63
+ lastRotated?: string | undefined;
64
+ }>;
65
+ export declare const KeyRotationResultSchema: z.ZodObject<{
66
+ success: z.ZodBoolean;
67
+ oldKeyId: z.ZodString;
68
+ newKeyId: z.ZodString;
69
+ did: z.ZodString;
70
+ mode: z.ZodEnum<["dev", "prod"]>;
71
+ delegated: z.ZodBoolean;
72
+ forced: z.ZodBoolean;
73
+ auditLine: z.ZodString;
74
+ }, "strip", z.ZodTypeAny, {
75
+ did: string;
76
+ success: boolean;
77
+ oldKeyId: string;
78
+ newKeyId: string;
79
+ mode: "dev" | "prod";
80
+ delegated: boolean;
81
+ forced: boolean;
82
+ auditLine: string;
83
+ }, {
84
+ did: string;
85
+ success: boolean;
86
+ oldKeyId: string;
87
+ newKeyId: string;
88
+ mode: "dev" | "prod";
89
+ delegated: boolean;
90
+ forced: boolean;
91
+ auditLine: string;
92
+ }>;
93
+ export declare const StatusReportSchema: z.ZodObject<{
94
+ did: z.ZodString;
95
+ kid: z.ZodString;
96
+ ktaURL: z.ZodString;
97
+ mirrorStatus: z.ZodEnum<["pending", "success", "error"]>;
98
+ lastHandshake: z.ZodOptional<z.ZodNumber>;
99
+ environment: z.ZodEnum<["dev", "prod"]>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ did: string;
102
+ kid: string;
103
+ ktaURL: string;
104
+ mirrorStatus: "success" | "pending" | "error";
105
+ environment: "dev" | "prod";
106
+ lastHandshake?: number | undefined;
107
+ }, {
108
+ did: string;
109
+ kid: string;
110
+ ktaURL: string;
111
+ mirrorStatus: "success" | "pending" | "error";
112
+ environment: "dev" | "prod";
113
+ lastHandshake?: number | undefined;
114
+ }>;
115
+ export declare const PackageInfoSchema: z.ZodObject<{
116
+ name: z.ZodString;
117
+ version: z.ZodString;
118
+ compatible: z.ZodBoolean;
119
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ version: string;
122
+ name: string;
123
+ compatible: boolean;
124
+ issues?: string[] | undefined;
125
+ }, {
126
+ version: string;
127
+ name: string;
128
+ compatible: boolean;
129
+ issues?: string[] | undefined;
130
+ }>;
131
+ export declare const XMCPUpstreamInfoSchema: z.ZodObject<{
132
+ version: z.ZodString;
133
+ compatible: z.ZodBoolean;
134
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ version: string;
137
+ compatible: boolean;
138
+ issues?: string[] | undefined;
139
+ }, {
140
+ version: string;
141
+ compatible: boolean;
142
+ issues?: string[] | undefined;
143
+ }>;
144
+ export declare const EnvironmentInfoSchema: z.ZodObject<{
145
+ valid: z.ZodBoolean;
146
+ missing: z.ZodArray<z.ZodString, "many">;
147
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ valid: boolean;
150
+ missing: string[];
151
+ issues?: string[] | undefined;
152
+ }, {
153
+ valid: boolean;
154
+ missing: string[];
155
+ issues?: string[] | undefined;
156
+ }>;
157
+ export declare const KTAInfoSchema: z.ZodObject<{
158
+ reachable: z.ZodBoolean;
159
+ authenticated: z.ZodBoolean;
160
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ reachable: boolean;
163
+ authenticated: boolean;
164
+ issues?: string[] | undefined;
165
+ }, {
166
+ reachable: boolean;
167
+ authenticated: boolean;
168
+ issues?: string[] | undefined;
169
+ }>;
170
+ export declare const CacheInfoSchema: z.ZodObject<{
171
+ type: z.ZodString;
172
+ functional: z.ZodBoolean;
173
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
174
+ }, "strip", z.ZodTypeAny, {
175
+ type: string;
176
+ functional: boolean;
177
+ issues?: string[] | undefined;
178
+ }, {
179
+ type: string;
180
+ functional: boolean;
181
+ issues?: string[] | undefined;
182
+ }>;
183
+ export declare const DoctorResultSchema: z.ZodObject<{
184
+ packages: z.ZodArray<z.ZodObject<{
185
+ name: z.ZodString;
186
+ version: z.ZodString;
187
+ compatible: z.ZodBoolean;
188
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ version: string;
191
+ name: string;
192
+ compatible: boolean;
193
+ issues?: string[] | undefined;
194
+ }, {
195
+ version: string;
196
+ name: string;
197
+ compatible: boolean;
198
+ issues?: string[] | undefined;
199
+ }>, "many">;
200
+ xmcpUpstream: z.ZodObject<{
201
+ version: z.ZodString;
202
+ compatible: z.ZodBoolean;
203
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
204
+ }, "strip", z.ZodTypeAny, {
205
+ version: string;
206
+ compatible: boolean;
207
+ issues?: string[] | undefined;
208
+ }, {
209
+ version: string;
210
+ compatible: boolean;
211
+ issues?: string[] | undefined;
212
+ }>;
213
+ environment: z.ZodObject<{
214
+ valid: z.ZodBoolean;
215
+ missing: z.ZodArray<z.ZodString, "many">;
216
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ valid: boolean;
219
+ missing: string[];
220
+ issues?: string[] | undefined;
221
+ }, {
222
+ valid: boolean;
223
+ missing: string[];
224
+ issues?: string[] | undefined;
225
+ }>;
226
+ kta: z.ZodObject<{
227
+ reachable: z.ZodBoolean;
228
+ authenticated: z.ZodBoolean;
229
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ reachable: boolean;
232
+ authenticated: boolean;
233
+ issues?: string[] | undefined;
234
+ }, {
235
+ reachable: boolean;
236
+ authenticated: boolean;
237
+ issues?: string[] | undefined;
238
+ }>;
239
+ cache: z.ZodObject<{
240
+ type: z.ZodString;
241
+ functional: z.ZodBoolean;
242
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
243
+ }, "strip", z.ZodTypeAny, {
244
+ type: string;
245
+ functional: boolean;
246
+ issues?: string[] | undefined;
247
+ }, {
248
+ type: string;
249
+ functional: boolean;
250
+ issues?: string[] | undefined;
251
+ }>;
252
+ }, "strip", z.ZodTypeAny, {
253
+ environment: {
254
+ valid: boolean;
255
+ missing: string[];
256
+ issues?: string[] | undefined;
257
+ };
258
+ packages: {
259
+ version: string;
260
+ name: string;
261
+ compatible: boolean;
262
+ issues?: string[] | undefined;
263
+ }[];
264
+ xmcpUpstream: {
265
+ version: string;
266
+ compatible: boolean;
267
+ issues?: string[] | undefined;
268
+ };
269
+ kta: {
270
+ reachable: boolean;
271
+ authenticated: boolean;
272
+ issues?: string[] | undefined;
273
+ };
274
+ cache: {
275
+ type: string;
276
+ functional: boolean;
277
+ issues?: string[] | undefined;
278
+ };
279
+ }, {
280
+ environment: {
281
+ valid: boolean;
282
+ missing: string[];
283
+ issues?: string[] | undefined;
284
+ };
285
+ packages: {
286
+ version: string;
287
+ name: string;
288
+ compatible: boolean;
289
+ issues?: string[] | undefined;
290
+ }[];
291
+ xmcpUpstream: {
292
+ version: string;
293
+ compatible: boolean;
294
+ issues?: string[] | undefined;
295
+ };
296
+ kta: {
297
+ reachable: boolean;
298
+ authenticated: boolean;
299
+ issues?: string[] | undefined;
300
+ };
301
+ cache: {
302
+ type: string;
303
+ functional: boolean;
304
+ issues?: string[] | undefined;
305
+ };
306
+ }>;
307
+ export declare const ScaffolderOptionsSchema: z.ZodObject<{
308
+ projectName: z.ZodString;
309
+ xmcpVersion: z.ZodOptional<z.ZodString>;
310
+ xmcpChannel: z.ZodOptional<z.ZodEnum<["latest", "next"]>>;
311
+ noIdentity: z.ZodDefault<z.ZodBoolean>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ projectName: string;
314
+ noIdentity: boolean;
315
+ xmcpVersion?: string | undefined;
316
+ xmcpChannel?: "latest" | "next" | undefined;
317
+ }, {
318
+ projectName: string;
319
+ xmcpVersion?: string | undefined;
320
+ xmcpChannel?: "latest" | "next" | undefined;
321
+ noIdentity?: boolean | undefined;
322
+ }>;
323
+ export declare const ScaffolderResultSchema: z.ZodObject<{
324
+ success: z.ZodBoolean;
325
+ projectPath: z.ZodString;
326
+ xmcpVersion: z.ZodString;
327
+ identityEnabled: z.ZodBoolean;
328
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
329
+ }, "strip", z.ZodTypeAny, {
330
+ success: boolean;
331
+ xmcpVersion: string;
332
+ projectPath: string;
333
+ identityEnabled: boolean;
334
+ warnings?: string[] | undefined;
335
+ }, {
336
+ success: boolean;
337
+ xmcpVersion: string;
338
+ projectPath: string;
339
+ identityEnabled: boolean;
340
+ warnings?: string[] | undefined;
341
+ }>;
342
+ export type CLIIdentityFile = z.infer<typeof CLIIdentityFileSchema>;
343
+ export type KeyRotationResult = z.infer<typeof KeyRotationResultSchema>;
344
+ export type StatusReport = z.infer<typeof StatusReportSchema>;
345
+ export type PackageInfo = z.infer<typeof PackageInfoSchema>;
346
+ export type XMCPUpstreamInfo = z.infer<typeof XMCPUpstreamInfoSchema>;
347
+ export type EnvironmentInfo = z.infer<typeof EnvironmentInfoSchema>;
348
+ export type KTAInfo = z.infer<typeof KTAInfoSchema>;
349
+ export type CacheInfo = z.infer<typeof CacheInfoSchema>;
350
+ export type DoctorResult = z.infer<typeof DoctorResultSchema>;
351
+ export type ScaffolderOptions = z.infer<typeof ScaffolderOptionsSchema>;
352
+ export type ScaffolderResult = z.infer<typeof ScaffolderResultSchema>;
353
+ export type IdentityConfig = CLIIdentityFile;
354
+ export declare const ERROR_CODES: {
355
+ readonly XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF";
356
+ readonly XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY";
357
+ readonly XMCP_I_EMIRRORPENDING: "XMCP_I_EMIRRORPENDING";
358
+ readonly XMCP_I_EHANDSHAKE: "XMCP_I_EHANDSHAKE";
359
+ readonly XMCP_I_ESESSION: "XMCP_I_ESESSION";
360
+ readonly XMCP_I_ECLAIM: "XMCP_I_ECLAIM";
361
+ readonly XMCP_I_ECONFIG: "XMCP_I_ECONFIG";
362
+ readonly XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME";
363
+ };
364
+ export type ErrorCode = keyof typeof ERROR_CODES;
365
+ export declare const CLI_EXIT_CODES: {
366
+ readonly SUCCESS: 0;
367
+ readonly GENERAL_ERROR: 1;
368
+ readonly BADPROOF: 20;
369
+ readonly NOIDENTITY: 21;
370
+ readonly HANDSHAKE: 22;
371
+ readonly SESSION: 23;
372
+ readonly CLAIM: 24;
373
+ readonly CONFIG: 25;
374
+ readonly RUNTIME: 26;
375
+ };
package/dist/cli.js ADDED
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.CLIIdentityFileSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.CLIIdentityFileSchema = zod_1.z.object({
6
+ version: zod_1.z.literal("1.0"),
7
+ did: zod_1.z.string().min(1),
8
+ kid: zod_1.z.string().min(1).optional(),
9
+ keyId: zod_1.z.string().min(1).optional(),
10
+ privateKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 private key (44 characters)"),
11
+ publicKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 public key (44 characters)"),
12
+ createdAt: zod_1.z.string().datetime(),
13
+ lastRotated: zod_1.z.string().datetime().optional(),
14
+ }).refine((data) => data.kid || data.keyId, {
15
+ message: "Either kid or keyId must be provided",
16
+ }).transform((data) => ({
17
+ version: data.version,
18
+ did: data.did,
19
+ kid: data.kid || data.keyId,
20
+ privateKey: data.privateKey,
21
+ publicKey: data.publicKey,
22
+ createdAt: data.createdAt,
23
+ lastRotated: data.lastRotated,
24
+ }));
25
+ exports.KeyRotationResultSchema = zod_1.z.object({
26
+ success: zod_1.z.boolean(),
27
+ oldKeyId: zod_1.z.string().min(1),
28
+ newKeyId: zod_1.z.string().min(1),
29
+ did: zod_1.z.string().min(1),
30
+ mode: zod_1.z.enum(["dev", "prod"]),
31
+ delegated: zod_1.z.boolean(),
32
+ forced: zod_1.z.boolean(),
33
+ auditLine: zod_1.z.string().min(1),
34
+ });
35
+ exports.StatusReportSchema = zod_1.z.object({
36
+ did: zod_1.z.string().min(1),
37
+ kid: zod_1.z.string().min(1),
38
+ ktaURL: zod_1.z.string().url(),
39
+ mirrorStatus: zod_1.z.enum(["pending", "success", "error"]),
40
+ lastHandshake: zod_1.z.number().int().positive().optional(),
41
+ environment: zod_1.z.enum(["dev", "prod"]),
42
+ });
43
+ exports.PackageInfoSchema = zod_1.z.object({
44
+ name: zod_1.z.string(),
45
+ version: zod_1.z.string(),
46
+ compatible: zod_1.z.boolean(),
47
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
48
+ });
49
+ exports.XMCPUpstreamInfoSchema = zod_1.z.object({
50
+ version: zod_1.z.string(),
51
+ compatible: zod_1.z.boolean(),
52
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
53
+ });
54
+ exports.EnvironmentInfoSchema = zod_1.z.object({
55
+ valid: zod_1.z.boolean(),
56
+ missing: zod_1.z.array(zod_1.z.string()),
57
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
58
+ });
59
+ exports.KTAInfoSchema = zod_1.z.object({
60
+ reachable: zod_1.z.boolean(),
61
+ authenticated: zod_1.z.boolean(),
62
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
63
+ });
64
+ exports.CacheInfoSchema = zod_1.z.object({
65
+ type: zod_1.z.string(),
66
+ functional: zod_1.z.boolean(),
67
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
68
+ });
69
+ exports.DoctorResultSchema = zod_1.z.object({
70
+ packages: zod_1.z.array(exports.PackageInfoSchema),
71
+ xmcpUpstream: exports.XMCPUpstreamInfoSchema,
72
+ environment: exports.EnvironmentInfoSchema,
73
+ kta: exports.KTAInfoSchema,
74
+ cache: exports.CacheInfoSchema,
75
+ });
76
+ exports.ScaffolderOptionsSchema = zod_1.z.object({
77
+ projectName: zod_1.z.string().min(1),
78
+ xmcpVersion: zod_1.z.string().optional(),
79
+ xmcpChannel: zod_1.z.enum(["latest", "next"]).optional(),
80
+ noIdentity: zod_1.z.boolean().default(false),
81
+ });
82
+ exports.ScaffolderResultSchema = zod_1.z.object({
83
+ success: zod_1.z.boolean(),
84
+ projectPath: zod_1.z.string().min(1),
85
+ xmcpVersion: zod_1.z.string().min(1),
86
+ identityEnabled: zod_1.z.boolean(),
87
+ warnings: zod_1.z.array(zod_1.z.string()).optional(),
88
+ });
89
+ exports.ERROR_CODES = {
90
+ XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF",
91
+ XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY",
92
+ XMCP_I_EMIRRORPENDING: "XMCP_I_EMIRRORPENDING",
93
+ XMCP_I_EHANDSHAKE: "XMCP_I_EHANDSHAKE",
94
+ XMCP_I_ESESSION: "XMCP_I_ESESSION",
95
+ XMCP_I_ECLAIM: "XMCP_I_ECLAIM",
96
+ XMCP_I_ECONFIG: "XMCP_I_ECONFIG",
97
+ XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME",
98
+ };
99
+ exports.CLI_EXIT_CODES = {
100
+ SUCCESS: 0,
101
+ GENERAL_ERROR: 1,
102
+ BADPROOF: 20,
103
+ NOIDENTITY: 21,
104
+ HANDSHAKE: 22,
105
+ SESSION: 23,
106
+ CLAIM: 24,
107
+ CONFIG: 25,
108
+ RUNTIME: 26,
109
+ };
@@ -0,0 +1,138 @@
1
+ import { z } from "zod";
2
+ export declare const HandshakeRequestSchema: z.ZodObject<{
3
+ nonce: z.ZodString;
4
+ audience: z.ZodString;
5
+ timestamp: z.ZodNumber;
6
+ agentDid: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ nonce: string;
9
+ audience: string;
10
+ timestamp: number;
11
+ agentDid?: string | undefined;
12
+ }, {
13
+ nonce: string;
14
+ audience: string;
15
+ timestamp: number;
16
+ agentDid?: string | undefined;
17
+ }>;
18
+ export declare const SessionContextSchema: z.ZodObject<{
19
+ sessionId: z.ZodString;
20
+ audience: z.ZodString;
21
+ nonce: z.ZodString;
22
+ timestamp: z.ZodNumber;
23
+ createdAt: z.ZodNumber;
24
+ lastActivity: z.ZodNumber;
25
+ ttlMinutes: z.ZodDefault<z.ZodNumber>;
26
+ agentDid: z.ZodOptional<z.ZodString>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ createdAt: number;
29
+ nonce: string;
30
+ audience: string;
31
+ timestamp: number;
32
+ sessionId: string;
33
+ lastActivity: number;
34
+ ttlMinutes: number;
35
+ agentDid?: string | undefined;
36
+ }, {
37
+ createdAt: number;
38
+ nonce: string;
39
+ audience: string;
40
+ timestamp: number;
41
+ sessionId: string;
42
+ lastActivity: number;
43
+ agentDid?: string | undefined;
44
+ ttlMinutes?: number | undefined;
45
+ }>;
46
+ export declare const NonceCacheEntrySchema: z.ZodObject<{
47
+ sessionId: z.ZodString;
48
+ expiresAt: z.ZodNumber;
49
+ }, "strip", z.ZodTypeAny, {
50
+ sessionId: string;
51
+ expiresAt: number;
52
+ }, {
53
+ sessionId: string;
54
+ expiresAt: number;
55
+ }>;
56
+ export type HandshakeRequest = z.infer<typeof HandshakeRequestSchema>;
57
+ export type SessionContext = z.infer<typeof SessionContextSchema>;
58
+ export type NonceCacheEntry = z.infer<typeof NonceCacheEntrySchema>;
59
+ export interface NonceCache {
60
+ has(nonce: string): Promise<boolean>;
61
+ add(nonce: string, ttl: number): Promise<void>;
62
+ cleanup(): Promise<void>;
63
+ }
64
+ export declare const NonceCacheConfigSchema: z.ZodObject<{
65
+ type: z.ZodOptional<z.ZodEnum<["memory", "redis", "dynamodb", "cloudflare-kv"]>>;
66
+ redis: z.ZodOptional<z.ZodObject<{
67
+ url: z.ZodString;
68
+ keyPrefix: z.ZodDefault<z.ZodString>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ url: string;
71
+ keyPrefix: string;
72
+ }, {
73
+ url: string;
74
+ keyPrefix?: string | undefined;
75
+ }>>;
76
+ dynamodb: z.ZodOptional<z.ZodObject<{
77
+ tableName: z.ZodString;
78
+ region: z.ZodOptional<z.ZodString>;
79
+ keyAttribute: z.ZodDefault<z.ZodString>;
80
+ ttlAttribute: z.ZodDefault<z.ZodString>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ tableName: string;
83
+ keyAttribute: string;
84
+ ttlAttribute: string;
85
+ region?: string | undefined;
86
+ }, {
87
+ tableName: string;
88
+ region?: string | undefined;
89
+ keyAttribute?: string | undefined;
90
+ ttlAttribute?: string | undefined;
91
+ }>>;
92
+ cloudflareKv: z.ZodOptional<z.ZodObject<{
93
+ namespace: z.ZodString;
94
+ keyPrefix: z.ZodDefault<z.ZodString>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ keyPrefix: string;
97
+ namespace: string;
98
+ }, {
99
+ namespace: string;
100
+ keyPrefix?: string | undefined;
101
+ }>>;
102
+ }, "strip", z.ZodTypeAny, {
103
+ type?: "memory" | "redis" | "dynamodb" | "cloudflare-kv" | undefined;
104
+ redis?: {
105
+ url: string;
106
+ keyPrefix: string;
107
+ } | undefined;
108
+ dynamodb?: {
109
+ tableName: string;
110
+ keyAttribute: string;
111
+ ttlAttribute: string;
112
+ region?: string | undefined;
113
+ } | undefined;
114
+ cloudflareKv?: {
115
+ keyPrefix: string;
116
+ namespace: string;
117
+ } | undefined;
118
+ }, {
119
+ type?: "memory" | "redis" | "dynamodb" | "cloudflare-kv" | undefined;
120
+ redis?: {
121
+ url: string;
122
+ keyPrefix?: string | undefined;
123
+ } | undefined;
124
+ dynamodb?: {
125
+ tableName: string;
126
+ region?: string | undefined;
127
+ keyAttribute?: string | undefined;
128
+ ttlAttribute?: string | undefined;
129
+ } | undefined;
130
+ cloudflareKv?: {
131
+ namespace: string;
132
+ keyPrefix?: string | undefined;
133
+ } | undefined;
134
+ }>;
135
+ export type NonceCacheConfig = z.infer<typeof NonceCacheConfigSchema>;
136
+ export declare const DEFAULT_SESSION_TTL_MINUTES = 30;
137
+ export declare const DEFAULT_TIMESTAMP_SKEW_SECONDS = 120;
138
+ export declare const NONCE_LENGTH_BYTES = 16;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NONCE_LENGTH_BYTES = exports.DEFAULT_TIMESTAMP_SKEW_SECONDS = exports.DEFAULT_SESSION_TTL_MINUTES = exports.NonceCacheConfigSchema = exports.NonceCacheEntrySchema = exports.SessionContextSchema = exports.HandshakeRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.HandshakeRequestSchema = zod_1.z.object({
6
+ nonce: zod_1.z.string().min(1),
7
+ audience: zod_1.z.string().min(1),
8
+ timestamp: zod_1.z.number().int().positive(),
9
+ agentDid: zod_1.z.string().startsWith("did:").optional(),
10
+ });
11
+ exports.SessionContextSchema = zod_1.z.object({
12
+ sessionId: zod_1.z.string().min(1),
13
+ audience: zod_1.z.string().min(1),
14
+ nonce: zod_1.z.string().min(1),
15
+ timestamp: zod_1.z.number().int().positive(),
16
+ createdAt: zod_1.z.number().int().positive(),
17
+ lastActivity: zod_1.z.number().int().positive(),
18
+ ttlMinutes: zod_1.z.number().int().positive().default(30),
19
+ agentDid: zod_1.z.string().optional(),
20
+ });
21
+ exports.NonceCacheEntrySchema = zod_1.z.object({
22
+ sessionId: zod_1.z.string().min(1),
23
+ expiresAt: zod_1.z.number().int().positive(),
24
+ });
25
+ exports.NonceCacheConfigSchema = zod_1.z.object({
26
+ type: zod_1.z.enum(["memory", "redis", "dynamodb", "cloudflare-kv"]).optional(),
27
+ redis: zod_1.z
28
+ .object({
29
+ url: zod_1.z.string().url(),
30
+ keyPrefix: zod_1.z.string().default("mcpi:nonce:"),
31
+ })
32
+ .optional(),
33
+ dynamodb: zod_1.z
34
+ .object({
35
+ tableName: zod_1.z.string(),
36
+ region: zod_1.z.string().optional(),
37
+ keyAttribute: zod_1.z.string().default("nonce"),
38
+ ttlAttribute: zod_1.z.string().default("expiresAt"),
39
+ })
40
+ .optional(),
41
+ cloudflareKv: zod_1.z
42
+ .object({
43
+ namespace: zod_1.z.string(),
44
+ keyPrefix: zod_1.z.string().default("nonce:"),
45
+ })
46
+ .optional(),
47
+ });
48
+ exports.DEFAULT_SESSION_TTL_MINUTES = 30;
49
+ exports.DEFAULT_TIMESTAMP_SKEW_SECONDS = 120;
50
+ exports.NONCE_LENGTH_BYTES = 16;
@@ -0,0 +1,11 @@
1
+ export * from "./handshake.js";
2
+ export * from "./proof.js";
3
+ export * from "./verifier.js";
4
+ export * from "./registry.js";
5
+ export * from "./cli.js";
6
+ export * from "./test.js";
7
+ export * from "./utils/validation.js";
8
+ export * from "./vc/index.js";
9
+ export * from "./delegation/index.js";
10
+ export declare const CONTRACTS_VERSION = "1.2.1";
11
+ export declare const SUPPORTED_XMCP_I_VERSION = "^1.0.0";