@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.
- package/package.json +3 -2
- package/README.md +0 -130
- package/dist/agentshield-api/endpoints.d.ts +0 -21
- package/dist/agentshield-api/endpoints.js +0 -20
- package/dist/agentshield-api/index.d.ts +0 -5
- package/dist/agentshield-api/index.js +0 -27
- package/dist/agentshield-api/schemas.d.ts +0 -9846
- package/dist/agentshield-api/schemas.js +0 -92
- package/dist/agentshield-api/types.d.ts +0 -92
- package/dist/agentshield-api/types.js +0 -12
- package/dist/cli.d.ts +0 -375
- package/dist/cli.js +0 -109
- package/dist/config/base.d.ts +0 -19
- package/dist/config/base.js +0 -2
- package/dist/config/delegation.d.ts +0 -46
- package/dist/config/delegation.js +0 -2
- package/dist/config/identity.d.ts +0 -22
- package/dist/config/identity.js +0 -2
- package/dist/config/index.d.ts +0 -17
- package/dist/config/index.js +0 -2
- package/dist/config/proofing.d.ts +0 -26
- package/dist/config/proofing.js +0 -2
- package/dist/config/tool-protection.d.ts +0 -36
- package/dist/config/tool-protection.js +0 -2
- package/dist/delegation/constraints.d.ts +0 -726
- package/dist/delegation/constraints.js +0 -103
- package/dist/delegation/index.d.ts +0 -2
- package/dist/delegation/index.js +0 -18
- package/dist/delegation/schemas.d.ts +0 -8042
- package/dist/delegation/schemas.js +0 -232
- package/dist/did/index.d.ts +0 -3
- package/dist/did/index.js +0 -19
- package/dist/did/resolve-contract.d.ts +0 -53
- package/dist/did/resolve-contract.js +0 -12
- package/dist/did/schemas.d.ts +0 -33
- package/dist/did/schemas.js +0 -80
- package/dist/did/types.d.ts +0 -38
- package/dist/did/types.js +0 -37
- package/dist/env/constants.d.ts +0 -13
- package/dist/env/constants.js +0 -15
- package/dist/env/index.d.ts +0 -1
- package/dist/env/index.js +0 -17
- package/dist/handshake.d.ts +0 -138
- package/dist/handshake.js +0 -50
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -28
- package/dist/proof/index.d.ts +0 -2
- package/dist/proof/index.js +0 -18
- package/dist/proof/proof-record.d.ts +0 -728
- package/dist/proof/proof-record.js +0 -60
- package/dist/proof/signing-spec.d.ts +0 -73
- package/dist/proof/signing-spec.js +0 -52
- package/dist/proof.d.ts +0 -378
- package/dist/proof.js +0 -59
- package/dist/registry.d.ts +0 -326
- package/dist/registry.js +0 -98
- package/dist/runtime/errors.d.ts +0 -179
- package/dist/runtime/errors.js +0 -51
- package/dist/runtime/headers.d.ts +0 -34
- package/dist/runtime/headers.js +0 -52
- package/dist/runtime/index.d.ts +0 -2
- package/dist/runtime/index.js +0 -18
- package/dist/test.d.ts +0 -215
- package/dist/test.js +0 -83
- package/dist/tlkrc/index.d.ts +0 -1
- package/dist/tlkrc/index.js +0 -17
- package/dist/tlkrc/rotation.d.ts +0 -168
- package/dist/tlkrc/rotation.js +0 -55
- package/dist/tool-protection/index.d.ts +0 -129
- package/dist/tool-protection/index.js +0 -80
- package/dist/utils/validation.d.ts +0 -14
- package/dist/utils/validation.js +0 -56
- package/dist/vc/index.d.ts +0 -2
- package/dist/vc/index.js +0 -18
- package/dist/vc/schemas.d.ts +0 -1888
- package/dist/vc/schemas.js +0 -116
- package/dist/vc/statuslist.d.ts +0 -292
- package/dist/vc/statuslist.js +0 -61
- package/dist/verifier.d.ts +0 -202
- package/dist/verifier.js +0 -76
- package/dist/well-known/index.d.ts +0 -248
- package/dist/well-known/index.js +0 -104
package/dist/verifier.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERROR_HTTP_STATUS = exports.VERIFIER_ERROR_CODES = exports.AGENT_HEADERS = exports.StructuredErrorSchema = exports.VerifierResultSchema = exports.AgentContextSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.AgentContextSchema = zod_1.z.object({
|
|
6
|
-
did: zod_1.z.string().min(1),
|
|
7
|
-
kid: zod_1.z.string().min(1),
|
|
8
|
-
subject: zod_1.z.string().optional(),
|
|
9
|
-
scopes: zod_1.z.array(zod_1.z.string()).default([]),
|
|
10
|
-
session: zod_1.z.string().min(1),
|
|
11
|
-
confidence: zod_1.z.literal("verified"),
|
|
12
|
-
delegationRef: zod_1.z.string().optional(),
|
|
13
|
-
registry: zod_1.z.string().url(),
|
|
14
|
-
verifiedAt: zod_1.z.number().int().positive(),
|
|
15
|
-
});
|
|
16
|
-
exports.VerifierResultSchema = zod_1.z.object({
|
|
17
|
-
success: zod_1.z.boolean(),
|
|
18
|
-
headers: zod_1.z.record(zod_1.z.string()).optional(),
|
|
19
|
-
agentContext: exports.AgentContextSchema.optional(),
|
|
20
|
-
error: zod_1.z
|
|
21
|
-
.object({
|
|
22
|
-
code: zod_1.z.string(),
|
|
23
|
-
message: zod_1.z.string(),
|
|
24
|
-
details: zod_1.z.any().optional(),
|
|
25
|
-
httpStatus: zod_1.z.number().int().min(400).max(599),
|
|
26
|
-
})
|
|
27
|
-
.optional(),
|
|
28
|
-
});
|
|
29
|
-
exports.StructuredErrorSchema = zod_1.z.object({
|
|
30
|
-
code: zod_1.z.string(),
|
|
31
|
-
message: zod_1.z.string(),
|
|
32
|
-
httpStatus: zod_1.z.number().int().min(400).max(599),
|
|
33
|
-
details: zod_1.z
|
|
34
|
-
.object({
|
|
35
|
-
reason: zod_1.z.string().optional(),
|
|
36
|
-
expected: zod_1.z.any().optional(),
|
|
37
|
-
received: zod_1.z.any().optional(),
|
|
38
|
-
remediation: zod_1.z.string().optional(),
|
|
39
|
-
})
|
|
40
|
-
.optional(),
|
|
41
|
-
});
|
|
42
|
-
exports.AGENT_HEADERS = {
|
|
43
|
-
DID: "X-Agent-DID",
|
|
44
|
-
KEY_ID: "X-Agent-KeyId",
|
|
45
|
-
SUBJECT: "X-Agent-Subject",
|
|
46
|
-
SCOPES: "X-Agent-Scopes",
|
|
47
|
-
SESSION: "X-Agent-Session",
|
|
48
|
-
CONFIDENCE: "X-Agent-Confidence",
|
|
49
|
-
DELEGATION_REF: "X-Agent-Delegation-Ref",
|
|
50
|
-
REGISTRY: "X-Agent-Registry",
|
|
51
|
-
VERIFIED_AT: "X-Agent-Verified-At",
|
|
52
|
-
};
|
|
53
|
-
exports.VERIFIER_ERROR_CODES = {
|
|
54
|
-
PROOF_INVALID_TS: "XMCP_I_PROOF_INVALID_TS",
|
|
55
|
-
PROOF_FUTURE_TS: "XMCP_I_PROOF_FUTURE_TS",
|
|
56
|
-
PROOF_TOO_OLD: "XMCP_I_PROOF_TOO_OLD",
|
|
57
|
-
PROOF_SKEW_EXCEEDED: "XMCP_I_PROOF_SKEW_EXCEEDED",
|
|
58
|
-
SESSION_IDLE_EXPIRED: "XMCP_I_SESSION_IDLE_EXPIRED",
|
|
59
|
-
SERVER_TIME_INVALID: "XMCP_I_SERVER_TIME_INVALID",
|
|
60
|
-
};
|
|
61
|
-
exports.ERROR_HTTP_STATUS = {
|
|
62
|
-
XMCP_I_EBADPROOF: 403,
|
|
63
|
-
XMCP_I_ENOIDENTITY: 500,
|
|
64
|
-
XMCP_I_EMIRRORPENDING: 200,
|
|
65
|
-
XMCP_I_EHANDSHAKE: 401,
|
|
66
|
-
XMCP_I_ESESSION: 401,
|
|
67
|
-
XMCP_I_ECLAIM: 400,
|
|
68
|
-
XMCP_I_ECONFIG: 500,
|
|
69
|
-
XMCP_I_ERUNTIME: 500,
|
|
70
|
-
[exports.VERIFIER_ERROR_CODES.PROOF_INVALID_TS]: 403,
|
|
71
|
-
[exports.VERIFIER_ERROR_CODES.PROOF_FUTURE_TS]: 403,
|
|
72
|
-
[exports.VERIFIER_ERROR_CODES.PROOF_TOO_OLD]: 403,
|
|
73
|
-
[exports.VERIFIER_ERROR_CODES.PROOF_SKEW_EXCEEDED]: 401,
|
|
74
|
-
[exports.VERIFIER_ERROR_CODES.SESSION_IDLE_EXPIRED]: 401,
|
|
75
|
-
[exports.VERIFIER_ERROR_CODES.SERVER_TIME_INVALID]: 500,
|
|
76
|
-
};
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export interface DIDDocument {
|
|
3
|
-
'@context': string[];
|
|
4
|
-
id: string;
|
|
5
|
-
verificationMethod: Array<{
|
|
6
|
-
id: string;
|
|
7
|
-
type: string;
|
|
8
|
-
controller: string;
|
|
9
|
-
publicKeyBase64?: string;
|
|
10
|
-
publicKeyMultibase?: string;
|
|
11
|
-
}>;
|
|
12
|
-
authentication?: string[];
|
|
13
|
-
assertionMethod?: string[];
|
|
14
|
-
capabilityInvocation?: string[];
|
|
15
|
-
capabilityDelegation?: string[];
|
|
16
|
-
keyAgreement?: string[];
|
|
17
|
-
service?: Array<{
|
|
18
|
-
id: string;
|
|
19
|
-
type: string;
|
|
20
|
-
serviceEndpoint: string;
|
|
21
|
-
}>;
|
|
22
|
-
}
|
|
23
|
-
export interface AgentDocument {
|
|
24
|
-
id: string;
|
|
25
|
-
capabilities: {
|
|
26
|
-
'mcp-i': Array<'handshake' | 'signing' | 'verification' | 'delegation' | 'proof-generation'>;
|
|
27
|
-
[key: string]: string[];
|
|
28
|
-
};
|
|
29
|
-
metadata?: {
|
|
30
|
-
name?: string;
|
|
31
|
-
serviceEndpoint?: string;
|
|
32
|
-
version?: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface MCPIdentity {
|
|
37
|
-
did: string;
|
|
38
|
-
publicKey: string;
|
|
39
|
-
serviceName: string;
|
|
40
|
-
serviceEndpoint: string;
|
|
41
|
-
timestamp: number;
|
|
42
|
-
metadata?: Record<string, unknown>;
|
|
43
|
-
}
|
|
44
|
-
export interface WellKnownConfig {
|
|
45
|
-
serviceName?: string;
|
|
46
|
-
serviceEndpoint?: string;
|
|
47
|
-
metadata?: Record<string, unknown>;
|
|
48
|
-
}
|
|
49
|
-
export interface WellKnownResponse {
|
|
50
|
-
status: number;
|
|
51
|
-
headers: Record<string, string>;
|
|
52
|
-
body: string;
|
|
53
|
-
}
|
|
54
|
-
export declare enum WellKnownPath {
|
|
55
|
-
DID_DOCUMENT = "/.well-known/did.json",
|
|
56
|
-
AGENT_DOCUMENT = "/.well-known/agent.json",
|
|
57
|
-
MCP_IDENTITY = "/.well-known/mcp-identity",
|
|
58
|
-
TOOL_PROTECTIONS = "/.well-known/tool-protections.json"
|
|
59
|
-
}
|
|
60
|
-
export declare const DIDDocumentSchema: z.ZodObject<{
|
|
61
|
-
'@context': z.ZodArray<z.ZodString, "many">;
|
|
62
|
-
id: z.ZodString;
|
|
63
|
-
verificationMethod: z.ZodArray<z.ZodObject<{
|
|
64
|
-
id: z.ZodString;
|
|
65
|
-
type: z.ZodString;
|
|
66
|
-
controller: z.ZodString;
|
|
67
|
-
publicKeyBase64: z.ZodOptional<z.ZodString>;
|
|
68
|
-
publicKeyMultibase: z.ZodOptional<z.ZodString>;
|
|
69
|
-
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
type: string;
|
|
71
|
-
id: string;
|
|
72
|
-
controller: string;
|
|
73
|
-
publicKeyMultibase?: string | undefined;
|
|
74
|
-
publicKeyBase64?: string | undefined;
|
|
75
|
-
}, {
|
|
76
|
-
type: string;
|
|
77
|
-
id: string;
|
|
78
|
-
controller: string;
|
|
79
|
-
publicKeyMultibase?: string | undefined;
|
|
80
|
-
publicKeyBase64?: string | undefined;
|
|
81
|
-
}>, "many">;
|
|
82
|
-
authentication: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
83
|
-
assertionMethod: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
84
|
-
capabilityInvocation: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
85
|
-
capabilityDelegation: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
86
|
-
keyAgreement: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
87
|
-
service: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
|
-
id: z.ZodString;
|
|
89
|
-
type: z.ZodString;
|
|
90
|
-
serviceEndpoint: z.ZodString;
|
|
91
|
-
}, "strip", z.ZodTypeAny, {
|
|
92
|
-
type: string;
|
|
93
|
-
id: string;
|
|
94
|
-
serviceEndpoint: string;
|
|
95
|
-
}, {
|
|
96
|
-
type: string;
|
|
97
|
-
id: string;
|
|
98
|
-
serviceEndpoint: string;
|
|
99
|
-
}>, "many">>;
|
|
100
|
-
}, "strip", z.ZodTypeAny, {
|
|
101
|
-
id: string;
|
|
102
|
-
verificationMethod: {
|
|
103
|
-
type: string;
|
|
104
|
-
id: string;
|
|
105
|
-
controller: string;
|
|
106
|
-
publicKeyMultibase?: string | undefined;
|
|
107
|
-
publicKeyBase64?: string | undefined;
|
|
108
|
-
}[];
|
|
109
|
-
'@context': string[];
|
|
110
|
-
authentication?: string[] | undefined;
|
|
111
|
-
assertionMethod?: string[] | undefined;
|
|
112
|
-
keyAgreement?: string[] | undefined;
|
|
113
|
-
capabilityInvocation?: string[] | undefined;
|
|
114
|
-
capabilityDelegation?: string[] | undefined;
|
|
115
|
-
service?: {
|
|
116
|
-
type: string;
|
|
117
|
-
id: string;
|
|
118
|
-
serviceEndpoint: string;
|
|
119
|
-
}[] | undefined;
|
|
120
|
-
}, {
|
|
121
|
-
id: string;
|
|
122
|
-
verificationMethod: {
|
|
123
|
-
type: string;
|
|
124
|
-
id: string;
|
|
125
|
-
controller: string;
|
|
126
|
-
publicKeyMultibase?: string | undefined;
|
|
127
|
-
publicKeyBase64?: string | undefined;
|
|
128
|
-
}[];
|
|
129
|
-
'@context': string[];
|
|
130
|
-
authentication?: string[] | undefined;
|
|
131
|
-
assertionMethod?: string[] | undefined;
|
|
132
|
-
keyAgreement?: string[] | undefined;
|
|
133
|
-
capabilityInvocation?: string[] | undefined;
|
|
134
|
-
capabilityDelegation?: string[] | undefined;
|
|
135
|
-
service?: {
|
|
136
|
-
type: string;
|
|
137
|
-
id: string;
|
|
138
|
-
serviceEndpoint: string;
|
|
139
|
-
}[] | undefined;
|
|
140
|
-
}>;
|
|
141
|
-
export declare const AgentDocumentSchema: z.ZodObject<{
|
|
142
|
-
id: z.ZodString;
|
|
143
|
-
capabilities: z.ZodObject<{
|
|
144
|
-
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
145
|
-
}, "strip", z.ZodArray<z.ZodString, "many">, z.objectOutputType<{
|
|
146
|
-
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
147
|
-
}, z.ZodArray<z.ZodString, "many">, "strip">, z.objectInputType<{
|
|
148
|
-
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
149
|
-
}, z.ZodArray<z.ZodString, "many">, "strip">>;
|
|
150
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
151
|
-
name: z.ZodOptional<z.ZodString>;
|
|
152
|
-
serviceEndpoint: z.ZodOptional<z.ZodString>;
|
|
153
|
-
version: z.ZodOptional<z.ZodString>;
|
|
154
|
-
description: z.ZodOptional<z.ZodString>;
|
|
155
|
-
}, "strip", z.ZodTypeAny, {
|
|
156
|
-
version?: string | undefined;
|
|
157
|
-
name?: string | undefined;
|
|
158
|
-
serviceEndpoint?: string | undefined;
|
|
159
|
-
description?: string | undefined;
|
|
160
|
-
}, {
|
|
161
|
-
version?: string | undefined;
|
|
162
|
-
name?: string | undefined;
|
|
163
|
-
serviceEndpoint?: string | undefined;
|
|
164
|
-
description?: string | undefined;
|
|
165
|
-
}>>;
|
|
166
|
-
}, "strip", z.ZodTypeAny, {
|
|
167
|
-
id: string;
|
|
168
|
-
capabilities: {
|
|
169
|
-
'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
|
|
170
|
-
} & {
|
|
171
|
-
[k: string]: string[];
|
|
172
|
-
};
|
|
173
|
-
metadata?: {
|
|
174
|
-
version?: string | undefined;
|
|
175
|
-
name?: string | undefined;
|
|
176
|
-
serviceEndpoint?: string | undefined;
|
|
177
|
-
description?: string | undefined;
|
|
178
|
-
} | undefined;
|
|
179
|
-
}, {
|
|
180
|
-
id: string;
|
|
181
|
-
capabilities: {
|
|
182
|
-
'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
|
|
183
|
-
} & {
|
|
184
|
-
[k: string]: string[];
|
|
185
|
-
};
|
|
186
|
-
metadata?: {
|
|
187
|
-
version?: string | undefined;
|
|
188
|
-
name?: string | undefined;
|
|
189
|
-
serviceEndpoint?: string | undefined;
|
|
190
|
-
description?: string | undefined;
|
|
191
|
-
} | undefined;
|
|
192
|
-
}>;
|
|
193
|
-
export declare const MCPIdentitySchema: z.ZodObject<{
|
|
194
|
-
did: z.ZodString;
|
|
195
|
-
publicKey: z.ZodString;
|
|
196
|
-
serviceName: z.ZodString;
|
|
197
|
-
serviceEndpoint: z.ZodString;
|
|
198
|
-
timestamp: z.ZodNumber;
|
|
199
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
200
|
-
}, "strip", z.ZodTypeAny, {
|
|
201
|
-
did: string;
|
|
202
|
-
publicKey: string;
|
|
203
|
-
timestamp: number;
|
|
204
|
-
serviceEndpoint: string;
|
|
205
|
-
serviceName: string;
|
|
206
|
-
metadata?: Record<string, unknown> | undefined;
|
|
207
|
-
}, {
|
|
208
|
-
did: string;
|
|
209
|
-
publicKey: string;
|
|
210
|
-
timestamp: number;
|
|
211
|
-
serviceEndpoint: string;
|
|
212
|
-
serviceName: string;
|
|
213
|
-
metadata?: Record<string, unknown> | undefined;
|
|
214
|
-
}>;
|
|
215
|
-
export declare const WellKnownConfigSchema: z.ZodObject<{
|
|
216
|
-
serviceName: z.ZodOptional<z.ZodString>;
|
|
217
|
-
serviceEndpoint: z.ZodOptional<z.ZodString>;
|
|
218
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
219
|
-
}, "strip", z.ZodTypeAny, {
|
|
220
|
-
metadata?: Record<string, unknown> | undefined;
|
|
221
|
-
serviceEndpoint?: string | undefined;
|
|
222
|
-
serviceName?: string | undefined;
|
|
223
|
-
}, {
|
|
224
|
-
metadata?: Record<string, unknown> | undefined;
|
|
225
|
-
serviceEndpoint?: string | undefined;
|
|
226
|
-
serviceName?: string | undefined;
|
|
227
|
-
}>;
|
|
228
|
-
export declare const WellKnownResponseSchema: z.ZodObject<{
|
|
229
|
-
status: z.ZodNumber;
|
|
230
|
-
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
231
|
-
body: z.ZodString;
|
|
232
|
-
}, "strip", z.ZodTypeAny, {
|
|
233
|
-
status: number;
|
|
234
|
-
headers: Record<string, string>;
|
|
235
|
-
body: string;
|
|
236
|
-
}, {
|
|
237
|
-
status: number;
|
|
238
|
-
headers: Record<string, string>;
|
|
239
|
-
body: string;
|
|
240
|
-
}>;
|
|
241
|
-
export declare function isDIDDocument(obj: any): obj is DIDDocument;
|
|
242
|
-
export declare function isAgentDocument(obj: any): obj is AgentDocument;
|
|
243
|
-
export declare function isMCPIdentity(obj: any): obj is MCPIdentity;
|
|
244
|
-
export declare function validateDIDDocument(obj: any): DIDDocument;
|
|
245
|
-
export declare function validateAgentDocument(obj: any): AgentDocument;
|
|
246
|
-
export declare function validateMCPIdentity(obj: any): MCPIdentity;
|
|
247
|
-
export declare function isWellKnownPath(path: string): boolean;
|
|
248
|
-
export declare function getWellKnownContentType(path: WellKnownPath | string): string;
|
package/dist/well-known/index.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WellKnownResponseSchema = exports.WellKnownConfigSchema = exports.MCPIdentitySchema = exports.AgentDocumentSchema = exports.DIDDocumentSchema = exports.WellKnownPath = void 0;
|
|
4
|
-
exports.isDIDDocument = isDIDDocument;
|
|
5
|
-
exports.isAgentDocument = isAgentDocument;
|
|
6
|
-
exports.isMCPIdentity = isMCPIdentity;
|
|
7
|
-
exports.validateDIDDocument = validateDIDDocument;
|
|
8
|
-
exports.validateAgentDocument = validateAgentDocument;
|
|
9
|
-
exports.validateMCPIdentity = validateMCPIdentity;
|
|
10
|
-
exports.isWellKnownPath = isWellKnownPath;
|
|
11
|
-
exports.getWellKnownContentType = getWellKnownContentType;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
var WellKnownPath;
|
|
14
|
-
(function (WellKnownPath) {
|
|
15
|
-
WellKnownPath["DID_DOCUMENT"] = "/.well-known/did.json";
|
|
16
|
-
WellKnownPath["AGENT_DOCUMENT"] = "/.well-known/agent.json";
|
|
17
|
-
WellKnownPath["MCP_IDENTITY"] = "/.well-known/mcp-identity";
|
|
18
|
-
WellKnownPath["TOOL_PROTECTIONS"] = "/.well-known/tool-protections.json";
|
|
19
|
-
})(WellKnownPath || (exports.WellKnownPath = WellKnownPath = {}));
|
|
20
|
-
exports.DIDDocumentSchema = zod_1.z.object({
|
|
21
|
-
'@context': zod_1.z.array(zod_1.z.string()),
|
|
22
|
-
id: zod_1.z.string(),
|
|
23
|
-
verificationMethod: zod_1.z.array(zod_1.z.object({
|
|
24
|
-
id: zod_1.z.string(),
|
|
25
|
-
type: zod_1.z.string(),
|
|
26
|
-
controller: zod_1.z.string(),
|
|
27
|
-
publicKeyBase64: zod_1.z.string().optional(),
|
|
28
|
-
publicKeyMultibase: zod_1.z.string().optional()
|
|
29
|
-
})),
|
|
30
|
-
authentication: zod_1.z.array(zod_1.z.string()).optional(),
|
|
31
|
-
assertionMethod: zod_1.z.array(zod_1.z.string()).optional(),
|
|
32
|
-
capabilityInvocation: zod_1.z.array(zod_1.z.string()).optional(),
|
|
33
|
-
capabilityDelegation: zod_1.z.array(zod_1.z.string()).optional(),
|
|
34
|
-
keyAgreement: zod_1.z.array(zod_1.z.string()).optional(),
|
|
35
|
-
service: zod_1.z.array(zod_1.z.object({
|
|
36
|
-
id: zod_1.z.string(),
|
|
37
|
-
type: zod_1.z.string(),
|
|
38
|
-
serviceEndpoint: zod_1.z.string()
|
|
39
|
-
})).optional()
|
|
40
|
-
});
|
|
41
|
-
exports.AgentDocumentSchema = zod_1.z.object({
|
|
42
|
-
id: zod_1.z.string(),
|
|
43
|
-
capabilities: zod_1.z.object({
|
|
44
|
-
'mcp-i': zod_1.z.array(zod_1.z.enum(['handshake', 'signing', 'verification', 'delegation', 'proof-generation']))
|
|
45
|
-
}).catchall(zod_1.z.array(zod_1.z.string())),
|
|
46
|
-
metadata: zod_1.z.object({
|
|
47
|
-
name: zod_1.z.string().optional(),
|
|
48
|
-
serviceEndpoint: zod_1.z.string().optional(),
|
|
49
|
-
version: zod_1.z.string().optional(),
|
|
50
|
-
description: zod_1.z.string().optional()
|
|
51
|
-
}).optional()
|
|
52
|
-
});
|
|
53
|
-
exports.MCPIdentitySchema = zod_1.z.object({
|
|
54
|
-
did: zod_1.z.string(),
|
|
55
|
-
publicKey: zod_1.z.string(),
|
|
56
|
-
serviceName: zod_1.z.string(),
|
|
57
|
-
serviceEndpoint: zod_1.z.string(),
|
|
58
|
-
timestamp: zod_1.z.number(),
|
|
59
|
-
metadata: zod_1.z.record(zod_1.z.unknown()).optional()
|
|
60
|
-
});
|
|
61
|
-
exports.WellKnownConfigSchema = zod_1.z.object({
|
|
62
|
-
serviceName: zod_1.z.string().optional(),
|
|
63
|
-
serviceEndpoint: zod_1.z.string().optional(),
|
|
64
|
-
metadata: zod_1.z.record(zod_1.z.unknown()).optional()
|
|
65
|
-
});
|
|
66
|
-
exports.WellKnownResponseSchema = zod_1.z.object({
|
|
67
|
-
status: zod_1.z.number(),
|
|
68
|
-
headers: zod_1.z.record(zod_1.z.string()),
|
|
69
|
-
body: zod_1.z.string()
|
|
70
|
-
});
|
|
71
|
-
function isDIDDocument(obj) {
|
|
72
|
-
return exports.DIDDocumentSchema.safeParse(obj).success;
|
|
73
|
-
}
|
|
74
|
-
function isAgentDocument(obj) {
|
|
75
|
-
return exports.AgentDocumentSchema.safeParse(obj).success;
|
|
76
|
-
}
|
|
77
|
-
function isMCPIdentity(obj) {
|
|
78
|
-
return exports.MCPIdentitySchema.safeParse(obj).success;
|
|
79
|
-
}
|
|
80
|
-
function validateDIDDocument(obj) {
|
|
81
|
-
return exports.DIDDocumentSchema.parse(obj);
|
|
82
|
-
}
|
|
83
|
-
function validateAgentDocument(obj) {
|
|
84
|
-
return exports.AgentDocumentSchema.parse(obj);
|
|
85
|
-
}
|
|
86
|
-
function validateMCPIdentity(obj) {
|
|
87
|
-
return exports.MCPIdentitySchema.parse(obj);
|
|
88
|
-
}
|
|
89
|
-
function isWellKnownPath(path) {
|
|
90
|
-
return Object.values(WellKnownPath).includes(path);
|
|
91
|
-
}
|
|
92
|
-
function getWellKnownContentType(path) {
|
|
93
|
-
switch (path) {
|
|
94
|
-
case WellKnownPath.DID_DOCUMENT:
|
|
95
|
-
return 'application/did+json';
|
|
96
|
-
case WellKnownPath.AGENT_DOCUMENT:
|
|
97
|
-
case WellKnownPath.TOOL_PROTECTIONS:
|
|
98
|
-
return 'application/json';
|
|
99
|
-
case WellKnownPath.MCP_IDENTITY:
|
|
100
|
-
return 'application/json';
|
|
101
|
-
default:
|
|
102
|
-
return 'application/json';
|
|
103
|
-
}
|
|
104
|
-
}
|