@kya-os/contracts 1.5.2-canary.4 → 1.5.2-canary.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/agentshield-api/endpoints.d.ts +50 -0
- package/dist/agentshield-api/endpoints.js +46 -0
- package/dist/agentshield-api/index.d.ts +13 -0
- package/dist/agentshield-api/index.js +37 -0
- package/dist/agentshield-api/schemas.d.ts +6032 -0
- package/dist/agentshield-api/schemas.js +240 -0
- package/dist/agentshield-api/types.d.ts +231 -0
- package/dist/agentshield-api/types.js +26 -0
- package/dist/cli.d.ts +388 -0
- package/dist/cli.js +121 -0
- package/dist/config/base.d.ts +96 -0
- package/dist/config/base.js +11 -0
- package/dist/config/builder.d.ts +33 -0
- package/dist/config/builder.js +74 -0
- package/dist/config/delegation.d.ts +194 -0
- package/dist/config/delegation.js +10 -0
- package/dist/config/identity.d.ts +116 -0
- package/dist/config/identity.js +10 -0
- package/dist/config/index.d.ts +34 -0
- package/dist/config/index.js +14 -0
- package/dist/config/proofing.d.ts +120 -0
- package/dist/config/proofing.js +10 -0
- package/dist/config/tool-protection.d.ts +139 -0
- package/dist/config/tool-protection.js +10 -0
- package/dist/consent/index.d.ts +6 -0
- package/dist/consent/index.js +22 -0
- package/dist/consent/schemas.d.ts +738 -0
- package/dist/consent/schemas.js +186 -0
- package/dist/consent/types.d.ts +155 -0
- package/dist/consent/types.js +10 -0
- package/dist/dashboard-config/default-config.d.ts +49 -0
- package/dist/dashboard-config/default-config.js +240 -0
- package/dist/dashboard-config/index.d.ts +10 -0
- package/dist/dashboard-config/index.js +35 -0
- package/dist/dashboard-config/schemas.d.ts +5904 -0
- package/dist/dashboard-config/schemas.js +254 -0
- package/dist/dashboard-config/types.d.ts +337 -0
- package/dist/dashboard-config/types.js +10 -0
- package/dist/delegation/constraints.d.ts +1021 -0
- package/dist/delegation/constraints.js +218 -0
- package/dist/delegation/index.d.ts +7 -0
- package/dist/delegation/index.js +23 -0
- package/dist/delegation/schemas.d.ts +8457 -0
- package/dist/delegation/schemas.js +475 -0
- package/dist/did/index.d.ts +8 -0
- package/dist/did/index.js +24 -0
- package/dist/did/resolve-contract.d.ts +219 -0
- package/dist/did/resolve-contract.js +31 -0
- package/dist/did/schemas.d.ts +112 -0
- package/dist/did/schemas.js +172 -0
- package/dist/did/types.d.ts +163 -0
- package/dist/did/types.js +70 -0
- package/dist/env/constants.d.ts +57 -0
- package/dist/env/constants.js +59 -0
- package/dist/env/index.d.ts +4 -0
- package/dist/env/index.js +20 -0
- package/dist/handshake.d.ts +172 -0
- package/dist/handshake.js +60 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +55 -0
- package/dist/proof/index.d.ts +9 -0
- package/dist/proof/index.js +38 -0
- package/dist/proof/proof-record.d.ts +837 -0
- package/dist/proof/proof-record.js +133 -0
- package/dist/proof/signing-spec.d.ts +146 -0
- package/dist/proof/signing-spec.js +122 -0
- package/dist/proof.d.ts +414 -0
- package/dist/proof.js +82 -0
- package/dist/registry.d.ts +342 -0
- package/dist/registry.js +118 -0
- package/dist/runtime/errors.d.ts +347 -0
- package/dist/runtime/errors.js +119 -0
- package/dist/runtime/headers.d.ts +83 -0
- package/dist/runtime/headers.js +81 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.js +21 -0
- package/dist/test.d.ts +251 -0
- package/dist/test.js +119 -0
- package/dist/tlkrc/index.d.ts +4 -0
- package/dist/tlkrc/index.js +20 -0
- package/dist/tlkrc/rotation.d.ts +245 -0
- package/dist/tlkrc/rotation.js +126 -0
- package/dist/tool-protection/index.d.ts +227 -0
- package/dist/tool-protection/index.js +113 -0
- package/dist/utils/validation.d.ts +30 -0
- package/dist/utils/validation.js +69 -0
- package/dist/vc/index.d.ts +7 -0
- package/dist/vc/index.js +23 -0
- package/dist/vc/schemas.d.ts +2483 -0
- package/dist/vc/schemas.js +224 -0
- package/dist/vc/statuslist.d.ts +493 -0
- package/dist/vc/statuslist.js +132 -0
- package/dist/verifier.d.ts +205 -0
- package/dist/verifier.js +83 -0
- package/dist/well-known/index.d.ts +308 -0
- package/dist/well-known/index.js +134 -0
- package/package.json +1 -1
package/dist/proof.d.ts
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Proof and signature schemas for MCP-I
|
|
4
|
+
*
|
|
5
|
+
* Note: The type name "DetachedProof" is maintained for backward compatibility,
|
|
6
|
+
* but the JWS format is actually FULL compact JWS (header.payload.signature),
|
|
7
|
+
* not detached format (header..signature).
|
|
8
|
+
*
|
|
9
|
+
* The JWS payload contains JWT standard claims (aud, sub, iss) plus custom
|
|
10
|
+
* proof claims (requestHash, responseHash, nonce, etc.).
|
|
11
|
+
*/
|
|
12
|
+
export declare const ProofMetaSchema: z.ZodObject<{
|
|
13
|
+
did: z.ZodString;
|
|
14
|
+
kid: z.ZodString;
|
|
15
|
+
ts: z.ZodNumber;
|
|
16
|
+
nonce: z.ZodString;
|
|
17
|
+
audience: z.ZodString;
|
|
18
|
+
sessionId: z.ZodString;
|
|
19
|
+
requestHash: z.ZodString;
|
|
20
|
+
responseHash: z.ZodString;
|
|
21
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
delegationRef: z.ZodOptional<z.ZodString>;
|
|
23
|
+
clientDid: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
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
|
+
clientDid?: string | undefined;
|
|
34
|
+
scopeId?: string | undefined;
|
|
35
|
+
delegationRef?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
did: string;
|
|
38
|
+
kid: string;
|
|
39
|
+
nonce: string;
|
|
40
|
+
audience: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
ts: number;
|
|
43
|
+
requestHash: string;
|
|
44
|
+
responseHash: string;
|
|
45
|
+
clientDid?: string | undefined;
|
|
46
|
+
scopeId?: string | undefined;
|
|
47
|
+
delegationRef?: string | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const DetachedProofSchema: z.ZodObject<{
|
|
50
|
+
jws: z.ZodString;
|
|
51
|
+
meta: z.ZodObject<{
|
|
52
|
+
did: z.ZodString;
|
|
53
|
+
kid: z.ZodString;
|
|
54
|
+
ts: z.ZodNumber;
|
|
55
|
+
nonce: z.ZodString;
|
|
56
|
+
audience: z.ZodString;
|
|
57
|
+
sessionId: z.ZodString;
|
|
58
|
+
requestHash: z.ZodString;
|
|
59
|
+
responseHash: z.ZodString;
|
|
60
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
61
|
+
delegationRef: z.ZodOptional<z.ZodString>;
|
|
62
|
+
clientDid: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
did: string;
|
|
65
|
+
kid: string;
|
|
66
|
+
nonce: string;
|
|
67
|
+
audience: string;
|
|
68
|
+
sessionId: string;
|
|
69
|
+
ts: number;
|
|
70
|
+
requestHash: string;
|
|
71
|
+
responseHash: string;
|
|
72
|
+
clientDid?: string | undefined;
|
|
73
|
+
scopeId?: string | undefined;
|
|
74
|
+
delegationRef?: string | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
did: string;
|
|
77
|
+
kid: string;
|
|
78
|
+
nonce: string;
|
|
79
|
+
audience: string;
|
|
80
|
+
sessionId: string;
|
|
81
|
+
ts: number;
|
|
82
|
+
requestHash: string;
|
|
83
|
+
responseHash: string;
|
|
84
|
+
clientDid?: string | undefined;
|
|
85
|
+
scopeId?: string | undefined;
|
|
86
|
+
delegationRef?: string | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
jws: string;
|
|
90
|
+
meta: {
|
|
91
|
+
did: string;
|
|
92
|
+
kid: string;
|
|
93
|
+
nonce: string;
|
|
94
|
+
audience: string;
|
|
95
|
+
sessionId: string;
|
|
96
|
+
ts: number;
|
|
97
|
+
requestHash: string;
|
|
98
|
+
responseHash: string;
|
|
99
|
+
clientDid?: string | undefined;
|
|
100
|
+
scopeId?: string | undefined;
|
|
101
|
+
delegationRef?: string | undefined;
|
|
102
|
+
};
|
|
103
|
+
}, {
|
|
104
|
+
jws: string;
|
|
105
|
+
meta: {
|
|
106
|
+
did: string;
|
|
107
|
+
kid: string;
|
|
108
|
+
nonce: string;
|
|
109
|
+
audience: string;
|
|
110
|
+
sessionId: string;
|
|
111
|
+
ts: number;
|
|
112
|
+
requestHash: string;
|
|
113
|
+
responseHash: string;
|
|
114
|
+
clientDid?: string | undefined;
|
|
115
|
+
scopeId?: string | undefined;
|
|
116
|
+
delegationRef?: string | undefined;
|
|
117
|
+
};
|
|
118
|
+
}>;
|
|
119
|
+
export declare const CanonicalHashesSchema: z.ZodObject<{
|
|
120
|
+
requestHash: z.ZodString;
|
|
121
|
+
responseHash: z.ZodString;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
requestHash: string;
|
|
124
|
+
responseHash: string;
|
|
125
|
+
}, {
|
|
126
|
+
requestHash: string;
|
|
127
|
+
responseHash: string;
|
|
128
|
+
}>;
|
|
129
|
+
export declare const AuditRecordSchema: z.ZodObject<{
|
|
130
|
+
version: z.ZodLiteral<"audit.v1">;
|
|
131
|
+
ts: z.ZodNumber;
|
|
132
|
+
session: z.ZodString;
|
|
133
|
+
audience: z.ZodString;
|
|
134
|
+
did: z.ZodString;
|
|
135
|
+
kid: z.ZodString;
|
|
136
|
+
reqHash: z.ZodString;
|
|
137
|
+
resHash: z.ZodString;
|
|
138
|
+
verified: z.ZodEnum<["yes", "no"]>;
|
|
139
|
+
scope: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
version: "audit.v1";
|
|
142
|
+
did: string;
|
|
143
|
+
kid: string;
|
|
144
|
+
audience: string;
|
|
145
|
+
ts: number;
|
|
146
|
+
session: string;
|
|
147
|
+
reqHash: string;
|
|
148
|
+
resHash: string;
|
|
149
|
+
verified: "yes" | "no";
|
|
150
|
+
scope: string;
|
|
151
|
+
}, {
|
|
152
|
+
version: "audit.v1";
|
|
153
|
+
did: string;
|
|
154
|
+
kid: string;
|
|
155
|
+
audience: string;
|
|
156
|
+
ts: number;
|
|
157
|
+
session: string;
|
|
158
|
+
reqHash: string;
|
|
159
|
+
resHash: string;
|
|
160
|
+
verified: "yes" | "no";
|
|
161
|
+
scope: string;
|
|
162
|
+
}>;
|
|
163
|
+
export type ProofMeta = z.infer<typeof ProofMetaSchema>;
|
|
164
|
+
export type DetachedProof = z.infer<typeof DetachedProofSchema>;
|
|
165
|
+
export type CanonicalHashes = z.infer<typeof CanonicalHashesSchema>;
|
|
166
|
+
export type AuditRecord = z.infer<typeof AuditRecordSchema>;
|
|
167
|
+
export declare const JWS_ALGORITHM = "EdDSA";
|
|
168
|
+
export declare const HASH_ALGORITHM = "sha256";
|
|
169
|
+
export declare const AUDIT_VERSION = "audit.v1";
|
|
170
|
+
/**
|
|
171
|
+
* Tool call context for AgentShield dashboard integration
|
|
172
|
+
* Provides plaintext tool execution data alongside cryptographic proofs
|
|
173
|
+
*/
|
|
174
|
+
export declare const ToolCallContextSchema: z.ZodObject<{
|
|
175
|
+
tool: z.ZodString;
|
|
176
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
177
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
178
|
+
scopeId: z.ZodString;
|
|
179
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
scopeId: string;
|
|
182
|
+
tool: string;
|
|
183
|
+
args: Record<string, unknown>;
|
|
184
|
+
result?: unknown;
|
|
185
|
+
userId?: string | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
scopeId: string;
|
|
188
|
+
tool: string;
|
|
189
|
+
args: Record<string, unknown>;
|
|
190
|
+
result?: unknown;
|
|
191
|
+
userId?: string | undefined;
|
|
192
|
+
}>;
|
|
193
|
+
/**
|
|
194
|
+
* Proof submission context for AgentShield API
|
|
195
|
+
* Includes tool calls and optional MCP server URL for tool discovery
|
|
196
|
+
*/
|
|
197
|
+
export declare const ProofSubmissionContextSchema: z.ZodObject<{
|
|
198
|
+
toolCalls: z.ZodArray<z.ZodObject<{
|
|
199
|
+
tool: z.ZodString;
|
|
200
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
201
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
202
|
+
scopeId: z.ZodString;
|
|
203
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
scopeId: string;
|
|
206
|
+
tool: string;
|
|
207
|
+
args: Record<string, unknown>;
|
|
208
|
+
result?: unknown;
|
|
209
|
+
userId?: string | undefined;
|
|
210
|
+
}, {
|
|
211
|
+
scopeId: string;
|
|
212
|
+
tool: string;
|
|
213
|
+
args: Record<string, unknown>;
|
|
214
|
+
result?: unknown;
|
|
215
|
+
userId?: string | undefined;
|
|
216
|
+
}>, "many">;
|
|
217
|
+
mcpServerUrl: z.ZodOptional<z.ZodString>;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
toolCalls: {
|
|
220
|
+
scopeId: string;
|
|
221
|
+
tool: string;
|
|
222
|
+
args: Record<string, unknown>;
|
|
223
|
+
result?: unknown;
|
|
224
|
+
userId?: string | undefined;
|
|
225
|
+
}[];
|
|
226
|
+
mcpServerUrl?: string | undefined;
|
|
227
|
+
}, {
|
|
228
|
+
toolCalls: {
|
|
229
|
+
scopeId: string;
|
|
230
|
+
tool: string;
|
|
231
|
+
args: Record<string, unknown>;
|
|
232
|
+
result?: unknown;
|
|
233
|
+
userId?: string | undefined;
|
|
234
|
+
}[];
|
|
235
|
+
mcpServerUrl?: string | undefined;
|
|
236
|
+
}>;
|
|
237
|
+
/**
|
|
238
|
+
* Complete proof submission request to AgentShield
|
|
239
|
+
*/
|
|
240
|
+
export declare const ProofSubmissionRequestSchema: z.ZodObject<{
|
|
241
|
+
session_id: z.ZodString;
|
|
242
|
+
delegation_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
243
|
+
proofs: z.ZodArray<z.ZodObject<{
|
|
244
|
+
jws: z.ZodString;
|
|
245
|
+
meta: z.ZodObject<{
|
|
246
|
+
did: z.ZodString;
|
|
247
|
+
kid: z.ZodString;
|
|
248
|
+
ts: z.ZodNumber;
|
|
249
|
+
nonce: z.ZodString;
|
|
250
|
+
audience: z.ZodString;
|
|
251
|
+
sessionId: z.ZodString;
|
|
252
|
+
requestHash: z.ZodString;
|
|
253
|
+
responseHash: z.ZodString;
|
|
254
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
255
|
+
delegationRef: z.ZodOptional<z.ZodString>;
|
|
256
|
+
clientDid: z.ZodOptional<z.ZodString>;
|
|
257
|
+
}, "strip", z.ZodTypeAny, {
|
|
258
|
+
did: string;
|
|
259
|
+
kid: string;
|
|
260
|
+
nonce: string;
|
|
261
|
+
audience: string;
|
|
262
|
+
sessionId: string;
|
|
263
|
+
ts: number;
|
|
264
|
+
requestHash: string;
|
|
265
|
+
responseHash: string;
|
|
266
|
+
clientDid?: string | undefined;
|
|
267
|
+
scopeId?: string | undefined;
|
|
268
|
+
delegationRef?: string | undefined;
|
|
269
|
+
}, {
|
|
270
|
+
did: string;
|
|
271
|
+
kid: string;
|
|
272
|
+
nonce: string;
|
|
273
|
+
audience: string;
|
|
274
|
+
sessionId: string;
|
|
275
|
+
ts: number;
|
|
276
|
+
requestHash: string;
|
|
277
|
+
responseHash: string;
|
|
278
|
+
clientDid?: string | undefined;
|
|
279
|
+
scopeId?: string | undefined;
|
|
280
|
+
delegationRef?: string | undefined;
|
|
281
|
+
}>;
|
|
282
|
+
}, "strip", z.ZodTypeAny, {
|
|
283
|
+
jws: string;
|
|
284
|
+
meta: {
|
|
285
|
+
did: string;
|
|
286
|
+
kid: string;
|
|
287
|
+
nonce: string;
|
|
288
|
+
audience: string;
|
|
289
|
+
sessionId: string;
|
|
290
|
+
ts: number;
|
|
291
|
+
requestHash: string;
|
|
292
|
+
responseHash: string;
|
|
293
|
+
clientDid?: string | undefined;
|
|
294
|
+
scopeId?: string | undefined;
|
|
295
|
+
delegationRef?: string | undefined;
|
|
296
|
+
};
|
|
297
|
+
}, {
|
|
298
|
+
jws: string;
|
|
299
|
+
meta: {
|
|
300
|
+
did: string;
|
|
301
|
+
kid: string;
|
|
302
|
+
nonce: string;
|
|
303
|
+
audience: string;
|
|
304
|
+
sessionId: string;
|
|
305
|
+
ts: number;
|
|
306
|
+
requestHash: string;
|
|
307
|
+
responseHash: string;
|
|
308
|
+
clientDid?: string | undefined;
|
|
309
|
+
scopeId?: string | undefined;
|
|
310
|
+
delegationRef?: string | undefined;
|
|
311
|
+
};
|
|
312
|
+
}>, "many">;
|
|
313
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
314
|
+
toolCalls: z.ZodArray<z.ZodObject<{
|
|
315
|
+
tool: z.ZodString;
|
|
316
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
317
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
318
|
+
scopeId: z.ZodString;
|
|
319
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
320
|
+
}, "strip", z.ZodTypeAny, {
|
|
321
|
+
scopeId: string;
|
|
322
|
+
tool: string;
|
|
323
|
+
args: Record<string, unknown>;
|
|
324
|
+
result?: unknown;
|
|
325
|
+
userId?: string | undefined;
|
|
326
|
+
}, {
|
|
327
|
+
scopeId: string;
|
|
328
|
+
tool: string;
|
|
329
|
+
args: Record<string, unknown>;
|
|
330
|
+
result?: unknown;
|
|
331
|
+
userId?: string | undefined;
|
|
332
|
+
}>, "many">;
|
|
333
|
+
mcpServerUrl: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
toolCalls: {
|
|
336
|
+
scopeId: string;
|
|
337
|
+
tool: string;
|
|
338
|
+
args: Record<string, unknown>;
|
|
339
|
+
result?: unknown;
|
|
340
|
+
userId?: string | undefined;
|
|
341
|
+
}[];
|
|
342
|
+
mcpServerUrl?: string | undefined;
|
|
343
|
+
}, {
|
|
344
|
+
toolCalls: {
|
|
345
|
+
scopeId: string;
|
|
346
|
+
tool: string;
|
|
347
|
+
args: Record<string, unknown>;
|
|
348
|
+
result?: unknown;
|
|
349
|
+
userId?: string | undefined;
|
|
350
|
+
}[];
|
|
351
|
+
mcpServerUrl?: string | undefined;
|
|
352
|
+
}>>;
|
|
353
|
+
}, "strip", z.ZodTypeAny, {
|
|
354
|
+
session_id: string;
|
|
355
|
+
proofs: {
|
|
356
|
+
jws: string;
|
|
357
|
+
meta: {
|
|
358
|
+
did: string;
|
|
359
|
+
kid: string;
|
|
360
|
+
nonce: string;
|
|
361
|
+
audience: string;
|
|
362
|
+
sessionId: string;
|
|
363
|
+
ts: number;
|
|
364
|
+
requestHash: string;
|
|
365
|
+
responseHash: string;
|
|
366
|
+
clientDid?: string | undefined;
|
|
367
|
+
scopeId?: string | undefined;
|
|
368
|
+
delegationRef?: string | undefined;
|
|
369
|
+
};
|
|
370
|
+
}[];
|
|
371
|
+
delegation_id?: string | null | undefined;
|
|
372
|
+
context?: {
|
|
373
|
+
toolCalls: {
|
|
374
|
+
scopeId: string;
|
|
375
|
+
tool: string;
|
|
376
|
+
args: Record<string, unknown>;
|
|
377
|
+
result?: unknown;
|
|
378
|
+
userId?: string | undefined;
|
|
379
|
+
}[];
|
|
380
|
+
mcpServerUrl?: string | undefined;
|
|
381
|
+
} | undefined;
|
|
382
|
+
}, {
|
|
383
|
+
session_id: string;
|
|
384
|
+
proofs: {
|
|
385
|
+
jws: string;
|
|
386
|
+
meta: {
|
|
387
|
+
did: string;
|
|
388
|
+
kid: string;
|
|
389
|
+
nonce: string;
|
|
390
|
+
audience: string;
|
|
391
|
+
sessionId: string;
|
|
392
|
+
ts: number;
|
|
393
|
+
requestHash: string;
|
|
394
|
+
responseHash: string;
|
|
395
|
+
clientDid?: string | undefined;
|
|
396
|
+
scopeId?: string | undefined;
|
|
397
|
+
delegationRef?: string | undefined;
|
|
398
|
+
};
|
|
399
|
+
}[];
|
|
400
|
+
delegation_id?: string | null | undefined;
|
|
401
|
+
context?: {
|
|
402
|
+
toolCalls: {
|
|
403
|
+
scopeId: string;
|
|
404
|
+
tool: string;
|
|
405
|
+
args: Record<string, unknown>;
|
|
406
|
+
result?: unknown;
|
|
407
|
+
userId?: string | undefined;
|
|
408
|
+
}[];
|
|
409
|
+
mcpServerUrl?: string | undefined;
|
|
410
|
+
} | undefined;
|
|
411
|
+
}>;
|
|
412
|
+
export type ToolCallContext = z.infer<typeof ToolCallContextSchema>;
|
|
413
|
+
export type ProofSubmissionContext = z.infer<typeof ProofSubmissionContextSchema>;
|
|
414
|
+
export type ProofSubmissionRequest = z.infer<typeof ProofSubmissionRequestSchema>;
|
package/dist/proof.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Proof and signature schemas for MCP-I
|
|
7
|
+
*
|
|
8
|
+
* Note: The type name "DetachedProof" is maintained for backward compatibility,
|
|
9
|
+
* but the JWS format is actually FULL compact JWS (header.payload.signature),
|
|
10
|
+
* not detached format (header..signature).
|
|
11
|
+
*
|
|
12
|
+
* The JWS payload contains JWT standard claims (aud, sub, iss) plus custom
|
|
13
|
+
* proof claims (requestHash, responseHash, nonce, etc.).
|
|
14
|
+
*/
|
|
15
|
+
exports.ProofMetaSchema = zod_1.z.object({
|
|
16
|
+
did: zod_1.z.string().min(1),
|
|
17
|
+
kid: zod_1.z.string().min(1),
|
|
18
|
+
ts: zod_1.z.number().int().positive(),
|
|
19
|
+
nonce: zod_1.z.string().min(1),
|
|
20
|
+
audience: zod_1.z.string().min(1),
|
|
21
|
+
sessionId: zod_1.z.string().min(1),
|
|
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
|
+
scopeId: zod_1.z.string().optional(),
|
|
25
|
+
delegationRef: zod_1.z.string().optional(),
|
|
26
|
+
clientDid: zod_1.z.string().optional(), // Optional for backward compatibility
|
|
27
|
+
});
|
|
28
|
+
exports.DetachedProofSchema = zod_1.z.object({
|
|
29
|
+
jws: zod_1.z.string().min(1), // Full compact JWS format (header.payload.signature)
|
|
30
|
+
meta: exports.ProofMetaSchema, // Convenience metadata (duplicates signed payload data)
|
|
31
|
+
});
|
|
32
|
+
exports.CanonicalHashesSchema = zod_1.z.object({
|
|
33
|
+
requestHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
34
|
+
responseHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
35
|
+
});
|
|
36
|
+
exports.AuditRecordSchema = zod_1.z.object({
|
|
37
|
+
version: zod_1.z.literal("audit.v1"),
|
|
38
|
+
ts: zod_1.z.number().int().positive(),
|
|
39
|
+
session: zod_1.z.string().min(1),
|
|
40
|
+
audience: zod_1.z.string().min(1),
|
|
41
|
+
did: zod_1.z.string().min(1),
|
|
42
|
+
kid: zod_1.z.string().min(1),
|
|
43
|
+
reqHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
44
|
+
resHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
45
|
+
verified: zod_1.z.enum(["yes", "no"]),
|
|
46
|
+
scope: zod_1.z.string().min(1), // "-" for no scope
|
|
47
|
+
});
|
|
48
|
+
// Constants
|
|
49
|
+
exports.JWS_ALGORITHM = "EdDSA";
|
|
50
|
+
exports.HASH_ALGORITHM = "sha256";
|
|
51
|
+
exports.AUDIT_VERSION = "audit.v1";
|
|
52
|
+
/**
|
|
53
|
+
* Tool call context for AgentShield dashboard integration
|
|
54
|
+
* Provides plaintext tool execution data alongside cryptographic proofs
|
|
55
|
+
*/
|
|
56
|
+
exports.ToolCallContextSchema = zod_1.z.object({
|
|
57
|
+
tool: zod_1.z.string().min(1),
|
|
58
|
+
args: zod_1.z.record(zod_1.z.unknown()),
|
|
59
|
+
result: zod_1.z.unknown().optional(),
|
|
60
|
+
scopeId: zod_1.z.string(),
|
|
61
|
+
userId: zod_1.z.string().optional(),
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Proof submission context for AgentShield API
|
|
65
|
+
* Includes tool calls and optional MCP server URL for tool discovery
|
|
66
|
+
*/
|
|
67
|
+
exports.ProofSubmissionContextSchema = zod_1.z.object({
|
|
68
|
+
toolCalls: zod_1.z.array(exports.ToolCallContextSchema),
|
|
69
|
+
mcpServerUrl: zod_1.z.string().url().optional(),
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Complete proof submission request to AgentShield
|
|
73
|
+
*/
|
|
74
|
+
exports.ProofSubmissionRequestSchema = zod_1.z.object({
|
|
75
|
+
session_id: zod_1.z.string().min(1),
|
|
76
|
+
delegation_id: zod_1.z.string().nullable().optional(),
|
|
77
|
+
proofs: zod_1.z.array(zod_1.z.object({
|
|
78
|
+
jws: zod_1.z.string().min(1),
|
|
79
|
+
meta: exports.ProofMetaSchema,
|
|
80
|
+
})),
|
|
81
|
+
context: exports.ProofSubmissionContextSchema.optional(),
|
|
82
|
+
});
|