@kya-os/contracts 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +1 -1
  2. package/dist/agentshield-api/endpoints.d.ts +21 -0
  3. package/dist/agentshield-api/endpoints.js +20 -0
  4. package/dist/agentshield-api/index.d.ts +5 -0
  5. package/dist/agentshield-api/index.js +27 -0
  6. package/dist/agentshield-api/schemas.d.ts +9846 -0
  7. package/dist/agentshield-api/schemas.js +92 -0
  8. package/dist/agentshield-api/types.d.ts +92 -0
  9. package/dist/agentshield-api/types.js +12 -0
  10. package/dist/cli.d.ts +3 -6
  11. package/dist/cli.js +3 -10
  12. package/dist/config/base.d.ts +19 -0
  13. package/dist/config/base.js +2 -0
  14. package/dist/config/delegation.d.ts +46 -0
  15. package/dist/config/delegation.js +2 -0
  16. package/dist/config/identity.d.ts +22 -0
  17. package/dist/config/identity.js +2 -0
  18. package/dist/config/index.d.ts +17 -0
  19. package/dist/config/index.js +2 -0
  20. package/dist/config/proofing.d.ts +26 -0
  21. package/dist/config/proofing.js +2 -0
  22. package/dist/config/tool-protection.d.ts +36 -0
  23. package/dist/config/tool-protection.js +2 -0
  24. package/dist/delegation/constraints.d.ts +0 -266
  25. package/dist/delegation/constraints.js +3 -110
  26. package/dist/delegation/index.d.ts +0 -6
  27. package/dist/delegation/index.js +0 -6
  28. package/dist/delegation/schemas.d.ts +174 -514
  29. package/dist/delegation/schemas.js +3 -247
  30. package/dist/did/index.d.ts +0 -6
  31. package/dist/did/index.js +0 -6
  32. package/dist/did/resolve-contract.d.ts +0 -167
  33. package/dist/did/resolve-contract.js +0 -20
  34. package/dist/did/schemas.d.ts +0 -80
  35. package/dist/did/schemas.js +4 -97
  36. package/dist/did/types.d.ts +0 -126
  37. package/dist/did/types.js +0 -34
  38. package/dist/env/constants.d.ts +0 -45
  39. package/dist/env/constants.js +0 -45
  40. package/dist/env/index.d.ts +0 -4
  41. package/dist/env/index.js +0 -4
  42. package/dist/handshake.d.ts +0 -21
  43. package/dist/handshake.js +3 -11
  44. package/dist/index.d.ts +0 -15
  45. package/dist/index.js +0 -25
  46. package/dist/proof/index.d.ts +0 -7
  47. package/dist/proof/index.js +0 -7
  48. package/dist/proof/proof-record.d.ts +62 -172
  49. package/dist/proof/proof-record.js +0 -74
  50. package/dist/proof/signing-spec.d.ts +12 -86
  51. package/dist/proof/signing-spec.js +0 -71
  52. package/dist/proof.d.ts +16 -38
  53. package/dist/proof.js +3 -26
  54. package/dist/registry.d.ts +10 -27
  55. package/dist/registry.js +9 -30
  56. package/dist/runtime/errors.d.ts +0 -169
  57. package/dist/runtime/errors.js +0 -69
  58. package/dist/runtime/headers.d.ts +0 -50
  59. package/dist/runtime/headers.js +0 -30
  60. package/dist/runtime/index.d.ts +0 -4
  61. package/dist/runtime/index.js +0 -4
  62. package/dist/test.d.ts +0 -37
  63. package/dist/test.js +0 -37
  64. package/dist/tlkrc/index.d.ts +0 -4
  65. package/dist/tlkrc/index.js +0 -4
  66. package/dist/tlkrc/rotation.d.ts +12 -90
  67. package/dist/tlkrc/rotation.js +0 -72
  68. package/dist/tool-protection/index.d.ts +129 -0
  69. package/dist/tool-protection/index.js +80 -0
  70. package/dist/utils/validation.d.ts +0 -17
  71. package/dist/utils/validation.js +0 -14
  72. package/dist/vc/index.d.ts +0 -6
  73. package/dist/vc/index.js +0 -6
  74. package/dist/vc/schemas.d.ts +0 -596
  75. package/dist/vc/schemas.js +2 -111
  76. package/dist/vc/statuslist.d.ts +0 -202
  77. package/dist/vc/statuslist.js +1 -73
  78. package/dist/verifier.d.ts +9 -13
  79. package/dist/verifier.js +0 -8
  80. package/dist/well-known/index.d.ts +248 -0
  81. package/dist/well-known/index.js +104 -0
  82. package/package.json +27 -5
@@ -1,42 +1,19 @@
1
1
  "use strict";
2
- /**
3
- * Proof Record (Archive)
4
- *
5
- * Schema for proof records stored in KV/archive for audit trails
6
- *
7
- * Related Spec: MCP-I §5
8
- * Python Reference: Edge-Delegation-Verification.md
9
- */
10
2
  Object.defineProperty(exports, "__esModule", { value: true });
11
3
  exports.DEFAULT_PROOF_RECORD_TTL_MS = exports.ProofRecordSchema = exports.VerificationInfoSchema = exports.CrispInfoSchema = exports.LinkageInfoSchema = exports.ProofDetailsSchema = exports.ResponseInfoSchema = exports.RequestInfoSchema = void 0;
12
4
  exports.validateProofRecord = validateProofRecord;
13
5
  exports.isProofRecordExpired = isProofRecordExpired;
14
6
  const zod_1 = require("zod");
15
- /**
16
- * Request Info Schema
17
- *
18
- * Information about the request that was proven
19
- */
20
7
  exports.RequestInfoSchema = zod_1.z.object({
21
8
  method: zod_1.z.string(),
22
9
  url: zod_1.z.string().url(),
23
10
  bodyHash: zod_1.z.string().optional(),
24
11
  headersHash: zod_1.z.string().optional(),
25
12
  });
26
- /**
27
- * Response Info Schema
28
- *
29
- * Information about the response
30
- */
31
13
  exports.ResponseInfoSchema = zod_1.z.object({
32
14
  status: zod_1.z.number().int(),
33
15
  bodyHash: zod_1.z.string().optional(),
34
16
  });
35
- /**
36
- * Proof Details Schema
37
- *
38
- * Core proof information
39
- */
40
17
  exports.ProofDetailsSchema = zod_1.z.object({
41
18
  timestamp: zod_1.z.number().int().positive(),
42
19
  nonce: zod_1.z.string().min(1),
@@ -48,87 +25,36 @@ exports.ProofDetailsSchema = zod_1.z.object({
48
25
  request: exports.RequestInfoSchema.optional(),
49
26
  response: exports.ResponseInfoSchema.optional(),
50
27
  });
51
- /**
52
- * Linkage Info Schema
53
- *
54
- * Links to delegations and credentials
55
- */
56
28
  exports.LinkageInfoSchema = zod_1.z.object({
57
29
  delegationId: zod_1.z.string().optional(),
58
30
  credentialId: zod_1.z.string().optional(),
59
31
  chainDepth: zod_1.z.number().int().nonnegative().optional(),
60
32
  });
61
- /**
62
- * CRISP Info Schema
63
- *
64
- * CRISP spending information
65
- */
66
33
  exports.CrispInfoSchema = zod_1.z.object({
67
34
  unit: zod_1.z.enum(['USD', 'ops', 'points']),
68
35
  delta: zod_1.z.number().optional(),
69
36
  remaining: zod_1.z.number().optional(),
70
37
  });
71
- /**
72
- * Verification Info Schema
73
- *
74
- * Verification result for the proof
75
- */
76
38
  exports.VerificationInfoSchema = zod_1.z.object({
77
39
  result: zod_1.z.enum(['pending', 'pass', 'fail']),
78
40
  reason: zod_1.z.string().optional(),
79
41
  checkedAt: zod_1.z.number().int().positive().optional(),
80
42
  });
81
- /**
82
- * Proof Record Schema
83
- *
84
- * Complete proof record for archive/KV storage
85
- */
86
43
  exports.ProofRecordSchema = zod_1.z.object({
87
- /** Unique identifier for the proof record */
88
44
  id: zod_1.z.string().min(1),
89
- /** Tool/service name that created the proof */
90
45
  toolName: zod_1.z.string().min(1),
91
- /** Timestamp when stored (milliseconds since epoch) */
92
46
  storedAt: zod_1.z.number().int().positive(),
93
- /** Expiration timestamp (milliseconds since epoch) */
94
47
  expiresAt: zod_1.z.number().int().positive(),
95
- /** Core proof details */
96
48
  proof: exports.ProofDetailsSchema,
97
- /** Optional linkage to delegations/credentials */
98
49
  linkage: exports.LinkageInfoSchema.optional(),
99
- /** Optional CRISP spending info */
100
50
  crisp: exports.CrispInfoSchema.optional(),
101
- /** Optional verification info */
102
51
  verification: exports.VerificationInfoSchema.optional(),
103
- /** Optional metadata */
104
52
  metadata: zod_1.z.record(zod_1.z.any()).optional(),
105
53
  }).passthrough();
106
- /**
107
- * Validation Helpers
108
- */
109
- /**
110
- * Validate a proof record
111
- *
112
- * @param record - The record to validate
113
- * @returns Validation result
114
- */
115
54
  function validateProofRecord(record) {
116
55
  return exports.ProofRecordSchema.safeParse(record);
117
56
  }
118
- /**
119
- * Check if proof record is expired
120
- *
121
- * @param record - The record to check
122
- * @returns true if expired
123
- */
124
57
  function isProofRecordExpired(record) {
125
58
  return Date.now() > record.expiresAt;
126
59
  }
127
- /**
128
- * Constants
129
- */
130
- /**
131
- * Default proof record TTL (30 days in milliseconds)
132
- */
133
60
  exports.DEFAULT_PROOF_RECORD_TTL_MS = 30 * 24 * 60 * 60 * 1000;
134
- //# sourceMappingURL=proof-record.js.map
@@ -1,61 +1,33 @@
1
- /**
2
- * Proof Signing Specification
3
- *
4
- * Canonical signing order and detached JWS contracts for proofs
5
- *
6
- * Related Spec: MCP-I §5
7
- * Python Reference: Edge-Delegation-Verification.md
8
- */
9
1
  import { z } from 'zod';
10
- /**
11
- * Canonical Request Parts Schema
12
- *
13
- * Parts of a request that are canonically signed
14
- */
15
2
  export declare const CanonicalRequestPartsSchema: z.ZodObject<{
16
- /** HTTP method (uppercased) */
17
3
  method: z.ZodString;
18
- /** Absolute URL */
19
4
  url: z.ZodString;
20
- /** Optional body hash (base64url of SHA-256) */
21
5
  bodyHash: z.ZodOptional<z.ZodString>;
22
- /** Optional headers hash (base64url of SHA-256 of allowlisted headers) */
23
6
  headersHash: z.ZodOptional<z.ZodString>;
24
- /** Nonce (base64) */
25
7
  nonce: z.ZodString;
26
- /** Timestamp (milliseconds since epoch) */
27
8
  timestamp: z.ZodNumber;
28
- /** Audience (e.g., 'mcp-client') */
29
9
  audience: z.ZodString;
30
10
  }, "strip", z.ZodTypeAny, {
31
- method: string;
32
- url: string;
33
11
  nonce: string;
34
- timestamp: number;
35
12
  audience: string;
13
+ timestamp: number;
14
+ url: string;
15
+ method: string;
36
16
  bodyHash?: string | undefined;
37
17
  headersHash?: string | undefined;
38
18
  }, {
39
- method: string;
40
- url: string;
41
19
  nonce: string;
42
- timestamp: number;
43
20
  audience: string;
21
+ timestamp: number;
22
+ url: string;
23
+ method: string;
44
24
  bodyHash?: string | undefined;
45
25
  headersHash?: string | undefined;
46
26
  }>;
47
27
  export type CanonicalRequestParts = z.infer<typeof CanonicalRequestPartsSchema>;
48
- /**
49
- * Detached JWS Schema
50
- *
51
- * Detached JSON Web Signature for proofs
52
- */
53
28
  export declare const DetachedJwsSchema: z.ZodObject<{
54
- /** Algorithm (Ed25519 or ES256) */
55
29
  alg: z.ZodEnum<["Ed25519", "ES256"]>;
56
- /** Optional key ID (fragment from DID) */
57
30
  kid: z.ZodOptional<z.ZodString>;
58
- /** Base64url-encoded signature */
59
31
  signature: z.ZodString;
60
32
  }, "strip", z.ZodTypeAny, {
61
33
  signature: string;
@@ -67,49 +39,25 @@ export declare const DetachedJwsSchema: z.ZodObject<{
67
39
  kid?: string | undefined;
68
40
  }>;
69
41
  export type DetachedJws = z.infer<typeof DetachedJwsSchema>;
70
- /**
71
- * Signing Order
72
- *
73
- * **CRITICAL**: This order MUST be used for canonical string generation.
74
- * Changing this order breaks signature verification.
75
- */
76
42
  export declare const SIGNING_ORDER: readonly ["method", "url", "bodyHash", "headersHash", "nonce", "timestamp", "audience"];
77
- /**
78
- * Type for signing order fields
79
- */
80
43
  export type SigningOrderField = (typeof SIGNING_ORDER)[number];
81
- /**
82
- * Validation Helpers
83
- */
84
- /**
85
- * Validate canonical request parts
86
- *
87
- * @param parts - The parts to validate
88
- * @returns Validation result
89
- */
90
44
  export declare function validateCanonicalRequestParts(parts: unknown): z.SafeParseReturnType<{
91
- method: string;
92
- url: string;
93
45
  nonce: string;
94
- timestamp: number;
95
46
  audience: string;
47
+ timestamp: number;
48
+ url: string;
49
+ method: string;
96
50
  bodyHash?: string | undefined;
97
51
  headersHash?: string | undefined;
98
52
  }, {
99
- method: string;
100
- url: string;
101
53
  nonce: string;
102
- timestamp: number;
103
54
  audience: string;
55
+ timestamp: number;
56
+ url: string;
57
+ method: string;
104
58
  bodyHash?: string | undefined;
105
59
  headersHash?: string | undefined;
106
60
  }>;
107
- /**
108
- * Validate detached JWS
109
- *
110
- * @param jws - The JWS to validate
111
- * @returns Validation result
112
- */
113
61
  export declare function validateDetachedJws(jws: unknown): z.SafeParseReturnType<{
114
62
  signature: string;
115
63
  alg: "Ed25519" | "ES256";
@@ -119,29 +67,7 @@ export declare function validateDetachedJws(jws: unknown): z.SafeParseReturnType
119
67
  alg: "Ed25519" | "ES256";
120
68
  kid?: string | undefined;
121
69
  }>;
122
- /**
123
- * Generate canonical signing string from parts
124
- *
125
- * **NOTE**: This is a type-level spec. Actual implementation
126
- * requires runtime string concatenation.
127
- *
128
- * @param parts - Canonical request parts
129
- * @returns Canonical string for signing
130
- */
131
70
  export declare function getCanonicalSigningString(parts: CanonicalRequestParts): string;
132
- /**
133
- * Constants
134
- */
135
- /**
136
- * Supported signing algorithms
137
- */
138
71
  export declare const SUPPORTED_SIGNING_ALGORITHMS: readonly ["Ed25519", "ES256"];
139
- /**
140
- * Hash algorithm for body/headers
141
- */
142
72
  export declare const SIGNING_HASH_ALGORITHM = "SHA-256";
143
- /**
144
- * Base64url pattern for validation
145
- */
146
73
  export declare const BASE64URL_PATTERN: RegExp;
147
- //# sourceMappingURL=signing-spec.d.ts.map
@@ -1,58 +1,24 @@
1
1
  "use strict";
2
- /**
3
- * Proof Signing Specification
4
- *
5
- * Canonical signing order and detached JWS contracts for proofs
6
- *
7
- * Related Spec: MCP-I §5
8
- * Python Reference: Edge-Delegation-Verification.md
9
- */
10
2
  Object.defineProperty(exports, "__esModule", { value: true });
11
3
  exports.BASE64URL_PATTERN = exports.SIGNING_HASH_ALGORITHM = exports.SUPPORTED_SIGNING_ALGORITHMS = exports.SIGNING_ORDER = exports.DetachedJwsSchema = exports.CanonicalRequestPartsSchema = void 0;
12
4
  exports.validateCanonicalRequestParts = validateCanonicalRequestParts;
13
5
  exports.validateDetachedJws = validateDetachedJws;
14
6
  exports.getCanonicalSigningString = getCanonicalSigningString;
15
7
  const zod_1 = require("zod");
16
- /**
17
- * Canonical Request Parts Schema
18
- *
19
- * Parts of a request that are canonically signed
20
- */
21
8
  exports.CanonicalRequestPartsSchema = zod_1.z.object({
22
- /** HTTP method (uppercased) */
23
9
  method: zod_1.z.string().toUpperCase(),
24
- /** Absolute URL */
25
10
  url: zod_1.z.string().url(),
26
- /** Optional body hash (base64url of SHA-256) */
27
11
  bodyHash: zod_1.z.string().regex(/^[A-Za-z0-9_-]+$/).optional(),
28
- /** Optional headers hash (base64url of SHA-256 of allowlisted headers) */
29
12
  headersHash: zod_1.z.string().regex(/^[A-Za-z0-9_-]+$/).optional(),
30
- /** Nonce (base64) */
31
13
  nonce: zod_1.z.string().min(1),
32
- /** Timestamp (milliseconds since epoch) */
33
14
  timestamp: zod_1.z.number().int().positive(),
34
- /** Audience (e.g., 'mcp-client') */
35
15
  audience: zod_1.z.string().min(1),
36
16
  });
37
- /**
38
- * Detached JWS Schema
39
- *
40
- * Detached JSON Web Signature for proofs
41
- */
42
17
  exports.DetachedJwsSchema = zod_1.z.object({
43
- /** Algorithm (Ed25519 or ES256) */
44
18
  alg: zod_1.z.enum(['Ed25519', 'ES256']),
45
- /** Optional key ID (fragment from DID) */
46
19
  kid: zod_1.z.string().optional(),
47
- /** Base64url-encoded signature */
48
20
  signature: zod_1.z.string().regex(/^[A-Za-z0-9_-]+$/),
49
21
  });
50
- /**
51
- * Signing Order
52
- *
53
- * **CRITICAL**: This order MUST be used for canonical string generation.
54
- * Changing this order breaks signature verification.
55
- */
56
22
  exports.SIGNING_ORDER = Object.freeze([
57
23
  'method',
58
24
  'url',
@@ -62,36 +28,12 @@ exports.SIGNING_ORDER = Object.freeze([
62
28
  'timestamp',
63
29
  'audience',
64
30
  ]);
65
- /**
66
- * Validation Helpers
67
- */
68
- /**
69
- * Validate canonical request parts
70
- *
71
- * @param parts - The parts to validate
72
- * @returns Validation result
73
- */
74
31
  function validateCanonicalRequestParts(parts) {
75
32
  return exports.CanonicalRequestPartsSchema.safeParse(parts);
76
33
  }
77
- /**
78
- * Validate detached JWS
79
- *
80
- * @param jws - The JWS to validate
81
- * @returns Validation result
82
- */
83
34
  function validateDetachedJws(jws) {
84
35
  return exports.DetachedJwsSchema.safeParse(jws);
85
36
  }
86
- /**
87
- * Generate canonical signing string from parts
88
- *
89
- * **NOTE**: This is a type-level spec. Actual implementation
90
- * requires runtime string concatenation.
91
- *
92
- * @param parts - Canonical request parts
93
- * @returns Canonical string for signing
94
- */
95
37
  function getCanonicalSigningString(parts) {
96
38
  const values = [];
97
39
  for (const field of exports.SIGNING_ORDER) {
@@ -105,19 +47,6 @@ function getCanonicalSigningString(parts) {
105
47
  }
106
48
  return values.join('\n');
107
49
  }
108
- /**
109
- * Constants
110
- */
111
- /**
112
- * Supported signing algorithms
113
- */
114
50
  exports.SUPPORTED_SIGNING_ALGORITHMS = ['Ed25519', 'ES256'];
115
- /**
116
- * Hash algorithm for body/headers
117
- */
118
51
  exports.SIGNING_HASH_ALGORITHM = 'SHA-256';
119
- /**
120
- * Base64url pattern for validation
121
- */
122
52
  exports.BASE64URL_PATTERN = /^[A-Za-z0-9_-]+$/;
123
- //# sourceMappingURL=signing-spec.js.map
package/dist/proof.d.ts CHANGED
@@ -1,14 +1,4 @@
1
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
2
  export declare const ProofMetaSchema: z.ZodObject<{
13
3
  did: z.ZodString;
14
4
  kid: z.ZodString;
@@ -23,10 +13,10 @@ export declare const ProofMetaSchema: z.ZodObject<{
23
13
  }, "strip", z.ZodTypeAny, {
24
14
  did: string;
25
15
  kid: string;
26
- ts: number;
27
16
  nonce: string;
28
17
  audience: string;
29
18
  sessionId: string;
19
+ ts: number;
30
20
  requestHash: string;
31
21
  responseHash: string;
32
22
  scopeId?: string | undefined;
@@ -34,10 +24,10 @@ export declare const ProofMetaSchema: z.ZodObject<{
34
24
  }, {
35
25
  did: string;
36
26
  kid: string;
37
- ts: number;
38
27
  nonce: string;
39
28
  audience: string;
40
29
  sessionId: string;
30
+ ts: number;
41
31
  requestHash: string;
42
32
  responseHash: string;
43
33
  scopeId?: string | undefined;
@@ -59,10 +49,10 @@ export declare const DetachedProofSchema: z.ZodObject<{
59
49
  }, "strip", z.ZodTypeAny, {
60
50
  did: string;
61
51
  kid: string;
62
- ts: number;
63
52
  nonce: string;
64
53
  audience: string;
65
54
  sessionId: string;
55
+ ts: number;
66
56
  requestHash: string;
67
57
  responseHash: string;
68
58
  scopeId?: string | undefined;
@@ -70,10 +60,10 @@ export declare const DetachedProofSchema: z.ZodObject<{
70
60
  }, {
71
61
  did: string;
72
62
  kid: string;
73
- ts: number;
74
63
  nonce: string;
75
64
  audience: string;
76
65
  sessionId: string;
66
+ ts: number;
77
67
  requestHash: string;
78
68
  responseHash: string;
79
69
  scopeId?: string | undefined;
@@ -84,10 +74,10 @@ export declare const DetachedProofSchema: z.ZodObject<{
84
74
  meta: {
85
75
  did: string;
86
76
  kid: string;
87
- ts: number;
88
77
  nonce: string;
89
78
  audience: string;
90
79
  sessionId: string;
80
+ ts: number;
91
81
  requestHash: string;
92
82
  responseHash: string;
93
83
  scopeId?: string | undefined;
@@ -98,10 +88,10 @@ export declare const DetachedProofSchema: z.ZodObject<{
98
88
  meta: {
99
89
  did: string;
100
90
  kid: string;
101
- ts: number;
102
91
  nonce: string;
103
92
  audience: string;
104
93
  sessionId: string;
94
+ ts: number;
105
95
  requestHash: string;
106
96
  responseHash: string;
107
97
  scopeId?: string | undefined;
@@ -130,22 +120,22 @@ export declare const AuditRecordSchema: z.ZodObject<{
130
120
  verified: z.ZodEnum<["yes", "no"]>;
131
121
  scope: z.ZodString;
132
122
  }, "strip", z.ZodTypeAny, {
123
+ version: "audit.v1";
133
124
  did: string;
134
125
  kid: string;
135
- ts: number;
136
126
  audience: string;
137
- version: "audit.v1";
127
+ ts: number;
138
128
  session: string;
139
129
  reqHash: string;
140
130
  resHash: string;
141
131
  verified: "yes" | "no";
142
132
  scope: string;
143
133
  }, {
134
+ version: "audit.v1";
144
135
  did: string;
145
136
  kid: string;
146
- ts: number;
147
137
  audience: string;
148
- version: "audit.v1";
138
+ ts: number;
149
139
  session: string;
150
140
  reqHash: string;
151
141
  resHash: string;
@@ -159,10 +149,6 @@ export type AuditRecord = z.infer<typeof AuditRecordSchema>;
159
149
  export declare const JWS_ALGORITHM = "EdDSA";
160
150
  export declare const HASH_ALGORITHM = "sha256";
161
151
  export declare const AUDIT_VERSION = "audit.v1";
162
- /**
163
- * Tool call context for AgentShield dashboard integration
164
- * Provides plaintext tool execution data alongside cryptographic proofs
165
- */
166
152
  export declare const ToolCallContextSchema: z.ZodObject<{
167
153
  tool: z.ZodString;
168
154
  args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -182,10 +168,6 @@ export declare const ToolCallContextSchema: z.ZodObject<{
182
168
  result?: unknown;
183
169
  userId?: string | undefined;
184
170
  }>;
185
- /**
186
- * Proof submission context for AgentShield API
187
- * Includes tool calls and optional MCP server URL for tool discovery
188
- */
189
171
  export declare const ProofSubmissionContextSchema: z.ZodObject<{
190
172
  toolCalls: z.ZodArray<z.ZodObject<{
191
173
  tool: z.ZodString;
@@ -226,9 +208,6 @@ export declare const ProofSubmissionContextSchema: z.ZodObject<{
226
208
  }[];
227
209
  mcpServerUrl?: string | undefined;
228
210
  }>;
229
- /**
230
- * Complete proof submission request to AgentShield
231
- */
232
211
  export declare const ProofSubmissionRequestSchema: z.ZodObject<{
233
212
  session_id: z.ZodString;
234
213
  delegation_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -248,10 +227,10 @@ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
248
227
  }, "strip", z.ZodTypeAny, {
249
228
  did: string;
250
229
  kid: string;
251
- ts: number;
252
230
  nonce: string;
253
231
  audience: string;
254
232
  sessionId: string;
233
+ ts: number;
255
234
  requestHash: string;
256
235
  responseHash: string;
257
236
  scopeId?: string | undefined;
@@ -259,10 +238,10 @@ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
259
238
  }, {
260
239
  did: string;
261
240
  kid: string;
262
- ts: number;
263
241
  nonce: string;
264
242
  audience: string;
265
243
  sessionId: string;
244
+ ts: number;
266
245
  requestHash: string;
267
246
  responseHash: string;
268
247
  scopeId?: string | undefined;
@@ -273,10 +252,10 @@ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
273
252
  meta: {
274
253
  did: string;
275
254
  kid: string;
276
- ts: number;
277
255
  nonce: string;
278
256
  audience: string;
279
257
  sessionId: string;
258
+ ts: number;
280
259
  requestHash: string;
281
260
  responseHash: string;
282
261
  scopeId?: string | undefined;
@@ -287,10 +266,10 @@ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
287
266
  meta: {
288
267
  did: string;
289
268
  kid: string;
290
- ts: number;
291
269
  nonce: string;
292
270
  audience: string;
293
271
  sessionId: string;
272
+ ts: number;
294
273
  requestHash: string;
295
274
  responseHash: string;
296
275
  scopeId?: string | undefined;
@@ -344,10 +323,10 @@ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
344
323
  meta: {
345
324
  did: string;
346
325
  kid: string;
347
- ts: number;
348
326
  nonce: string;
349
327
  audience: string;
350
328
  sessionId: string;
329
+ ts: number;
351
330
  requestHash: string;
352
331
  responseHash: string;
353
332
  scopeId?: string | undefined;
@@ -372,10 +351,10 @@ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
372
351
  meta: {
373
352
  did: string;
374
353
  kid: string;
375
- ts: number;
376
354
  nonce: string;
377
355
  audience: string;
378
356
  sessionId: string;
357
+ ts: number;
379
358
  requestHash: string;
380
359
  responseHash: string;
381
360
  scopeId?: string | undefined;
@@ -397,4 +376,3 @@ export declare const ProofSubmissionRequestSchema: z.ZodObject<{
397
376
  export type ToolCallContext = z.infer<typeof ToolCallContextSchema>;
398
377
  export type ProofSubmissionContext = z.infer<typeof ProofSubmissionContextSchema>;
399
378
  export type ProofSubmissionRequest = z.infer<typeof ProofSubmissionRequestSchema>;
400
- //# sourceMappingURL=proof.d.ts.map
package/dist/proof.js CHANGED
@@ -2,16 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
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
5
  exports.ProofMetaSchema = zod_1.z.object({
16
6
  did: zod_1.z.string().min(1),
17
7
  kid: zod_1.z.string().min(1),
@@ -25,8 +15,8 @@ exports.ProofMetaSchema = zod_1.z.object({
25
15
  delegationRef: zod_1.z.string().optional(),
26
16
  });
27
17
  exports.DetachedProofSchema = zod_1.z.object({
28
- jws: zod_1.z.string().min(1), // Full compact JWS format (header.payload.signature)
29
- meta: exports.ProofMetaSchema, // Convenience metadata (duplicates signed payload data)
18
+ jws: zod_1.z.string().min(1),
19
+ meta: exports.ProofMetaSchema,
30
20
  });
31
21
  exports.CanonicalHashesSchema = zod_1.z.object({
32
22
  requestHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
@@ -42,16 +32,11 @@ exports.AuditRecordSchema = zod_1.z.object({
42
32
  reqHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
43
33
  resHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
44
34
  verified: zod_1.z.enum(["yes", "no"]),
45
- scope: zod_1.z.string().min(1), // "-" for no scope
35
+ scope: zod_1.z.string().min(1),
46
36
  });
47
- // Constants
48
37
  exports.JWS_ALGORITHM = "EdDSA";
49
38
  exports.HASH_ALGORITHM = "sha256";
50
39
  exports.AUDIT_VERSION = "audit.v1";
51
- /**
52
- * Tool call context for AgentShield dashboard integration
53
- * Provides plaintext tool execution data alongside cryptographic proofs
54
- */
55
40
  exports.ToolCallContextSchema = zod_1.z.object({
56
41
  tool: zod_1.z.string().min(1),
57
42
  args: zod_1.z.record(zod_1.z.unknown()),
@@ -59,17 +44,10 @@ exports.ToolCallContextSchema = zod_1.z.object({
59
44
  scopeId: zod_1.z.string(),
60
45
  userId: zod_1.z.string().optional(),
61
46
  });
62
- /**
63
- * Proof submission context for AgentShield API
64
- * Includes tool calls and optional MCP server URL for tool discovery
65
- */
66
47
  exports.ProofSubmissionContextSchema = zod_1.z.object({
67
48
  toolCalls: zod_1.z.array(exports.ToolCallContextSchema),
68
49
  mcpServerUrl: zod_1.z.string().url().optional(),
69
50
  });
70
- /**
71
- * Complete proof submission request to AgentShield
72
- */
73
51
  exports.ProofSubmissionRequestSchema = zod_1.z.object({
74
52
  session_id: zod_1.z.string().min(1),
75
53
  delegation_id: zod_1.z.string().nullable().optional(),
@@ -79,4 +57,3 @@ exports.ProofSubmissionRequestSchema = zod_1.z.object({
79
57
  })),
80
58
  context: exports.ProofSubmissionContextSchema.optional(),
81
59
  });
82
- //# sourceMappingURL=proof.js.map