@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/index.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SUPPORTED_XMCP_I_VERSION = exports.CONTRACTS_VERSION = void 0;
18
+ __exportStar(require("./handshake.js"), exports);
19
+ __exportStar(require("./proof.js"), exports);
20
+ __exportStar(require("./verifier.js"), exports);
21
+ __exportStar(require("./registry.js"), exports);
22
+ __exportStar(require("./cli.js"), exports);
23
+ __exportStar(require("./test.js"), exports);
24
+ __exportStar(require("./utils/validation.js"), exports);
25
+ __exportStar(require("./vc/index.js"), exports);
26
+ __exportStar(require("./delegation/index.js"), exports);
27
+ exports.CONTRACTS_VERSION = "1.2.1";
28
+ exports.SUPPORTED_XMCP_I_VERSION = "^1.0.0";
@@ -0,0 +1,378 @@
1
+ import { z } from "zod";
2
+ export declare const ProofMetaSchema: z.ZodObject<{
3
+ did: z.ZodString;
4
+ kid: z.ZodString;
5
+ ts: z.ZodNumber;
6
+ nonce: z.ZodString;
7
+ audience: z.ZodString;
8
+ sessionId: z.ZodString;
9
+ requestHash: z.ZodString;
10
+ responseHash: z.ZodString;
11
+ scopeId: z.ZodOptional<z.ZodString>;
12
+ delegationRef: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ did: string;
15
+ kid: string;
16
+ nonce: string;
17
+ audience: string;
18
+ sessionId: string;
19
+ ts: number;
20
+ requestHash: string;
21
+ responseHash: string;
22
+ scopeId?: string | undefined;
23
+ delegationRef?: string | undefined;
24
+ }, {
25
+ did: string;
26
+ kid: string;
27
+ nonce: string;
28
+ audience: string;
29
+ sessionId: string;
30
+ ts: number;
31
+ requestHash: string;
32
+ responseHash: string;
33
+ scopeId?: string | undefined;
34
+ delegationRef?: string | undefined;
35
+ }>;
36
+ export declare const DetachedProofSchema: z.ZodObject<{
37
+ jws: z.ZodString;
38
+ meta: z.ZodObject<{
39
+ did: z.ZodString;
40
+ kid: z.ZodString;
41
+ ts: z.ZodNumber;
42
+ nonce: z.ZodString;
43
+ audience: z.ZodString;
44
+ sessionId: z.ZodString;
45
+ requestHash: z.ZodString;
46
+ responseHash: z.ZodString;
47
+ scopeId: z.ZodOptional<z.ZodString>;
48
+ delegationRef: z.ZodOptional<z.ZodString>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ did: string;
51
+ kid: string;
52
+ nonce: string;
53
+ audience: string;
54
+ sessionId: string;
55
+ ts: number;
56
+ requestHash: string;
57
+ responseHash: string;
58
+ scopeId?: string | undefined;
59
+ delegationRef?: string | undefined;
60
+ }, {
61
+ did: string;
62
+ kid: string;
63
+ nonce: string;
64
+ audience: string;
65
+ sessionId: string;
66
+ ts: number;
67
+ requestHash: string;
68
+ responseHash: string;
69
+ scopeId?: string | undefined;
70
+ delegationRef?: string | undefined;
71
+ }>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ jws: string;
74
+ meta: {
75
+ did: string;
76
+ kid: string;
77
+ nonce: string;
78
+ audience: string;
79
+ sessionId: string;
80
+ ts: number;
81
+ requestHash: string;
82
+ responseHash: string;
83
+ scopeId?: string | undefined;
84
+ delegationRef?: string | undefined;
85
+ };
86
+ }, {
87
+ jws: string;
88
+ meta: {
89
+ did: string;
90
+ kid: string;
91
+ nonce: string;
92
+ audience: string;
93
+ sessionId: string;
94
+ ts: number;
95
+ requestHash: string;
96
+ responseHash: string;
97
+ scopeId?: string | undefined;
98
+ delegationRef?: string | undefined;
99
+ };
100
+ }>;
101
+ export declare const CanonicalHashesSchema: z.ZodObject<{
102
+ requestHash: z.ZodString;
103
+ responseHash: z.ZodString;
104
+ }, "strip", z.ZodTypeAny, {
105
+ requestHash: string;
106
+ responseHash: string;
107
+ }, {
108
+ requestHash: string;
109
+ responseHash: string;
110
+ }>;
111
+ export declare const AuditRecordSchema: z.ZodObject<{
112
+ version: z.ZodLiteral<"audit.v1">;
113
+ ts: z.ZodNumber;
114
+ session: z.ZodString;
115
+ audience: z.ZodString;
116
+ did: z.ZodString;
117
+ kid: z.ZodString;
118
+ reqHash: z.ZodString;
119
+ resHash: z.ZodString;
120
+ verified: z.ZodEnum<["yes", "no"]>;
121
+ scope: z.ZodString;
122
+ }, "strip", z.ZodTypeAny, {
123
+ version: "audit.v1";
124
+ did: string;
125
+ kid: string;
126
+ audience: string;
127
+ ts: number;
128
+ session: string;
129
+ reqHash: string;
130
+ resHash: string;
131
+ verified: "yes" | "no";
132
+ scope: string;
133
+ }, {
134
+ version: "audit.v1";
135
+ did: string;
136
+ kid: string;
137
+ audience: string;
138
+ ts: number;
139
+ session: string;
140
+ reqHash: string;
141
+ resHash: string;
142
+ verified: "yes" | "no";
143
+ scope: string;
144
+ }>;
145
+ export type ProofMeta = z.infer<typeof ProofMetaSchema>;
146
+ export type DetachedProof = z.infer<typeof DetachedProofSchema>;
147
+ export type CanonicalHashes = z.infer<typeof CanonicalHashesSchema>;
148
+ export type AuditRecord = z.infer<typeof AuditRecordSchema>;
149
+ export declare const JWS_ALGORITHM = "EdDSA";
150
+ export declare const HASH_ALGORITHM = "sha256";
151
+ export declare const AUDIT_VERSION = "audit.v1";
152
+ export declare const ToolCallContextSchema: z.ZodObject<{
153
+ tool: z.ZodString;
154
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
155
+ result: z.ZodOptional<z.ZodUnknown>;
156
+ scopeId: z.ZodString;
157
+ userId: z.ZodOptional<z.ZodString>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ scopeId: string;
160
+ tool: string;
161
+ args: Record<string, unknown>;
162
+ result?: unknown;
163
+ userId?: string | undefined;
164
+ }, {
165
+ scopeId: string;
166
+ tool: string;
167
+ args: Record<string, unknown>;
168
+ result?: unknown;
169
+ userId?: string | undefined;
170
+ }>;
171
+ export declare const ProofSubmissionContextSchema: z.ZodObject<{
172
+ toolCalls: z.ZodArray<z.ZodObject<{
173
+ tool: z.ZodString;
174
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
175
+ result: z.ZodOptional<z.ZodUnknown>;
176
+ scopeId: z.ZodString;
177
+ userId: z.ZodOptional<z.ZodString>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ scopeId: string;
180
+ tool: string;
181
+ args: Record<string, unknown>;
182
+ result?: unknown;
183
+ userId?: string | undefined;
184
+ }, {
185
+ scopeId: string;
186
+ tool: string;
187
+ args: Record<string, unknown>;
188
+ result?: unknown;
189
+ userId?: string | undefined;
190
+ }>, "many">;
191
+ mcpServerUrl: z.ZodOptional<z.ZodString>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ toolCalls: {
194
+ scopeId: string;
195
+ tool: string;
196
+ args: Record<string, unknown>;
197
+ result?: unknown;
198
+ userId?: string | undefined;
199
+ }[];
200
+ mcpServerUrl?: string | undefined;
201
+ }, {
202
+ toolCalls: {
203
+ scopeId: string;
204
+ tool: string;
205
+ args: Record<string, unknown>;
206
+ result?: unknown;
207
+ userId?: string | undefined;
208
+ }[];
209
+ mcpServerUrl?: string | undefined;
210
+ }>;
211
+ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
212
+ session_id: z.ZodString;
213
+ delegation_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ proofs: z.ZodArray<z.ZodObject<{
215
+ jws: z.ZodString;
216
+ meta: z.ZodObject<{
217
+ did: z.ZodString;
218
+ kid: z.ZodString;
219
+ ts: z.ZodNumber;
220
+ nonce: z.ZodString;
221
+ audience: z.ZodString;
222
+ sessionId: z.ZodString;
223
+ requestHash: z.ZodString;
224
+ responseHash: z.ZodString;
225
+ scopeId: z.ZodOptional<z.ZodString>;
226
+ delegationRef: z.ZodOptional<z.ZodString>;
227
+ }, "strip", z.ZodTypeAny, {
228
+ did: string;
229
+ kid: string;
230
+ nonce: string;
231
+ audience: string;
232
+ sessionId: string;
233
+ ts: number;
234
+ requestHash: string;
235
+ responseHash: string;
236
+ scopeId?: string | undefined;
237
+ delegationRef?: string | undefined;
238
+ }, {
239
+ did: string;
240
+ kid: string;
241
+ nonce: string;
242
+ audience: string;
243
+ sessionId: string;
244
+ ts: number;
245
+ requestHash: string;
246
+ responseHash: string;
247
+ scopeId?: string | undefined;
248
+ delegationRef?: string | undefined;
249
+ }>;
250
+ }, "strip", z.ZodTypeAny, {
251
+ jws: string;
252
+ meta: {
253
+ did: string;
254
+ kid: string;
255
+ nonce: string;
256
+ audience: string;
257
+ sessionId: string;
258
+ ts: number;
259
+ requestHash: string;
260
+ responseHash: string;
261
+ scopeId?: string | undefined;
262
+ delegationRef?: string | undefined;
263
+ };
264
+ }, {
265
+ jws: string;
266
+ meta: {
267
+ did: string;
268
+ kid: string;
269
+ nonce: string;
270
+ audience: string;
271
+ sessionId: string;
272
+ ts: number;
273
+ requestHash: string;
274
+ responseHash: string;
275
+ scopeId?: string | undefined;
276
+ delegationRef?: string | undefined;
277
+ };
278
+ }>, "many">;
279
+ context: z.ZodOptional<z.ZodObject<{
280
+ toolCalls: z.ZodArray<z.ZodObject<{
281
+ tool: z.ZodString;
282
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
283
+ result: z.ZodOptional<z.ZodUnknown>;
284
+ scopeId: z.ZodString;
285
+ userId: z.ZodOptional<z.ZodString>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ scopeId: string;
288
+ tool: string;
289
+ args: Record<string, unknown>;
290
+ result?: unknown;
291
+ userId?: string | undefined;
292
+ }, {
293
+ scopeId: string;
294
+ tool: string;
295
+ args: Record<string, unknown>;
296
+ result?: unknown;
297
+ userId?: string | undefined;
298
+ }>, "many">;
299
+ mcpServerUrl: z.ZodOptional<z.ZodString>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ toolCalls: {
302
+ scopeId: string;
303
+ tool: string;
304
+ args: Record<string, unknown>;
305
+ result?: unknown;
306
+ userId?: string | undefined;
307
+ }[];
308
+ mcpServerUrl?: string | undefined;
309
+ }, {
310
+ toolCalls: {
311
+ scopeId: string;
312
+ tool: string;
313
+ args: Record<string, unknown>;
314
+ result?: unknown;
315
+ userId?: string | undefined;
316
+ }[];
317
+ mcpServerUrl?: string | undefined;
318
+ }>>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ session_id: string;
321
+ proofs: {
322
+ jws: string;
323
+ meta: {
324
+ did: string;
325
+ kid: string;
326
+ nonce: string;
327
+ audience: string;
328
+ sessionId: string;
329
+ ts: number;
330
+ requestHash: string;
331
+ responseHash: string;
332
+ scopeId?: string | undefined;
333
+ delegationRef?: string | undefined;
334
+ };
335
+ }[];
336
+ delegation_id?: string | null | undefined;
337
+ context?: {
338
+ toolCalls: {
339
+ scopeId: string;
340
+ tool: string;
341
+ args: Record<string, unknown>;
342
+ result?: unknown;
343
+ userId?: string | undefined;
344
+ }[];
345
+ mcpServerUrl?: string | undefined;
346
+ } | undefined;
347
+ }, {
348
+ session_id: string;
349
+ proofs: {
350
+ jws: string;
351
+ meta: {
352
+ did: string;
353
+ kid: string;
354
+ nonce: string;
355
+ audience: string;
356
+ sessionId: string;
357
+ ts: number;
358
+ requestHash: string;
359
+ responseHash: string;
360
+ scopeId?: string | undefined;
361
+ delegationRef?: string | undefined;
362
+ };
363
+ }[];
364
+ delegation_id?: string | null | undefined;
365
+ context?: {
366
+ toolCalls: {
367
+ scopeId: string;
368
+ tool: string;
369
+ args: Record<string, unknown>;
370
+ result?: unknown;
371
+ userId?: string | undefined;
372
+ }[];
373
+ mcpServerUrl?: string | undefined;
374
+ } | undefined;
375
+ }>;
376
+ export type ToolCallContext = z.infer<typeof ToolCallContextSchema>;
377
+ export type ProofSubmissionContext = z.infer<typeof ProofSubmissionContextSchema>;
378
+ export type ProofSubmissionRequest = z.infer<typeof ProofSubmissionRequestSchema>;
package/dist/proof.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProofSubmissionRequestSchema = exports.ProofSubmissionContextSchema = exports.ToolCallContextSchema = exports.AUDIT_VERSION = exports.HASH_ALGORITHM = exports.JWS_ALGORITHM = exports.AuditRecordSchema = exports.CanonicalHashesSchema = exports.DetachedProofSchema = exports.ProofMetaSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ProofMetaSchema = zod_1.z.object({
6
+ did: zod_1.z.string().min(1),
7
+ kid: zod_1.z.string().min(1),
8
+ ts: zod_1.z.number().int().positive(),
9
+ nonce: zod_1.z.string().min(1),
10
+ audience: zod_1.z.string().min(1),
11
+ sessionId: zod_1.z.string().min(1),
12
+ requestHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
13
+ responseHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
14
+ scopeId: zod_1.z.string().optional(),
15
+ delegationRef: zod_1.z.string().optional(),
16
+ });
17
+ exports.DetachedProofSchema = zod_1.z.object({
18
+ jws: zod_1.z.string().min(1),
19
+ meta: exports.ProofMetaSchema,
20
+ });
21
+ exports.CanonicalHashesSchema = zod_1.z.object({
22
+ requestHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
23
+ responseHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
24
+ });
25
+ exports.AuditRecordSchema = zod_1.z.object({
26
+ version: zod_1.z.literal("audit.v1"),
27
+ ts: zod_1.z.number().int().positive(),
28
+ session: zod_1.z.string().min(1),
29
+ audience: zod_1.z.string().min(1),
30
+ did: zod_1.z.string().min(1),
31
+ kid: zod_1.z.string().min(1),
32
+ reqHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
33
+ resHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
34
+ verified: zod_1.z.enum(["yes", "no"]),
35
+ scope: zod_1.z.string().min(1),
36
+ });
37
+ exports.JWS_ALGORITHM = "EdDSA";
38
+ exports.HASH_ALGORITHM = "sha256";
39
+ exports.AUDIT_VERSION = "audit.v1";
40
+ exports.ToolCallContextSchema = zod_1.z.object({
41
+ tool: zod_1.z.string().min(1),
42
+ args: zod_1.z.record(zod_1.z.unknown()),
43
+ result: zod_1.z.unknown().optional(),
44
+ scopeId: zod_1.z.string(),
45
+ userId: zod_1.z.string().optional(),
46
+ });
47
+ exports.ProofSubmissionContextSchema = zod_1.z.object({
48
+ toolCalls: zod_1.z.array(exports.ToolCallContextSchema),
49
+ mcpServerUrl: zod_1.z.string().url().optional(),
50
+ });
51
+ exports.ProofSubmissionRequestSchema = zod_1.z.object({
52
+ session_id: zod_1.z.string().min(1),
53
+ delegation_id: zod_1.z.string().nullable().optional(),
54
+ proofs: zod_1.z.array(zod_1.z.object({
55
+ jws: zod_1.z.string().min(1),
56
+ meta: exports.ProofMetaSchema,
57
+ })),
58
+ context: exports.ProofSubmissionContextSchema.optional(),
59
+ });