@kya-os/contracts 1.3.4 → 1.4.0
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 +38 -0
- package/dist/agentshield-api/schemas.d.ts +9914 -0
- package/dist/agentshield-api/schemas.js +165 -0
- package/dist/agentshield-api/types.d.ts +168 -0
- package/dist/agentshield-api/types.js +27 -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/delegation.d.ts +194 -0
- package/dist/config/delegation.js +10 -0
- package/dist/config/identity.d.ts +117 -0
- package/dist/config/identity.js +11 -0
- package/dist/config/index.d.ts +33 -0
- package/dist/config/index.js +11 -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/dashboard-config/index.d.ts +10 -0
- package/dist/dashboard-config/index.js +31 -0
- package/dist/dashboard-config/schemas.d.ts +5847 -0
- package/dist/dashboard-config/schemas.js +251 -0
- package/dist/dashboard-config/types.d.ts +331 -0
- package/dist/dashboard-config/types.js +11 -0
- package/dist/delegation/constraints.d.ts +991 -0
- package/dist/delegation/constraints.js +209 -0
- package/dist/delegation/index.d.ts +7 -0
- package/dist/delegation/index.js +23 -0
- package/dist/delegation/schemas.d.ts +8381 -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 +158 -0
- package/dist/handshake.js +57 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +56 -0
- package/dist/proof/index.d.ts +8 -0
- package/dist/proof/index.js +24 -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 +415 -0
- package/dist/proof.js +83 -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 +6 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Verifier middleware schemas and headers
|
|
4
|
+
*/
|
|
5
|
+
export declare const AgentContextSchema: z.ZodObject<{
|
|
6
|
+
did: z.ZodString;
|
|
7
|
+
kid: z.ZodString;
|
|
8
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
9
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
session: z.ZodString;
|
|
11
|
+
confidence: z.ZodLiteral<"verified">;
|
|
12
|
+
delegationRef: z.ZodOptional<z.ZodString>;
|
|
13
|
+
registry: z.ZodString;
|
|
14
|
+
verifiedAt: z.ZodNumber;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
did: string;
|
|
17
|
+
kid: string;
|
|
18
|
+
session: string;
|
|
19
|
+
scopes: string[];
|
|
20
|
+
confidence: "verified";
|
|
21
|
+
registry: string;
|
|
22
|
+
verifiedAt: number;
|
|
23
|
+
delegationRef?: string | undefined;
|
|
24
|
+
subject?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
did: string;
|
|
27
|
+
kid: string;
|
|
28
|
+
session: string;
|
|
29
|
+
confidence: "verified";
|
|
30
|
+
registry: string;
|
|
31
|
+
verifiedAt: number;
|
|
32
|
+
delegationRef?: string | undefined;
|
|
33
|
+
subject?: string | undefined;
|
|
34
|
+
scopes?: string[] | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const VerifierResultSchema: z.ZodObject<{
|
|
37
|
+
success: z.ZodBoolean;
|
|
38
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
39
|
+
agentContext: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
did: z.ZodString;
|
|
41
|
+
kid: z.ZodString;
|
|
42
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
43
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
44
|
+
session: z.ZodString;
|
|
45
|
+
confidence: z.ZodLiteral<"verified">;
|
|
46
|
+
delegationRef: z.ZodOptional<z.ZodString>;
|
|
47
|
+
registry: z.ZodString;
|
|
48
|
+
verifiedAt: z.ZodNumber;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
did: string;
|
|
51
|
+
kid: string;
|
|
52
|
+
session: string;
|
|
53
|
+
scopes: string[];
|
|
54
|
+
confidence: "verified";
|
|
55
|
+
registry: string;
|
|
56
|
+
verifiedAt: number;
|
|
57
|
+
delegationRef?: string | undefined;
|
|
58
|
+
subject?: string | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
did: string;
|
|
61
|
+
kid: string;
|
|
62
|
+
session: string;
|
|
63
|
+
confidence: "verified";
|
|
64
|
+
registry: string;
|
|
65
|
+
verifiedAt: number;
|
|
66
|
+
delegationRef?: string | undefined;
|
|
67
|
+
subject?: string | undefined;
|
|
68
|
+
scopes?: string[] | undefined;
|
|
69
|
+
}>>;
|
|
70
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
code: z.ZodString;
|
|
72
|
+
message: z.ZodString;
|
|
73
|
+
details: z.ZodOptional<z.ZodAny>;
|
|
74
|
+
httpStatus: z.ZodNumber;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
code: string;
|
|
77
|
+
message: string;
|
|
78
|
+
httpStatus: number;
|
|
79
|
+
details?: any;
|
|
80
|
+
}, {
|
|
81
|
+
code: string;
|
|
82
|
+
message: string;
|
|
83
|
+
httpStatus: number;
|
|
84
|
+
details?: any;
|
|
85
|
+
}>>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
success: boolean;
|
|
88
|
+
error?: {
|
|
89
|
+
code: string;
|
|
90
|
+
message: string;
|
|
91
|
+
httpStatus: number;
|
|
92
|
+
details?: any;
|
|
93
|
+
} | undefined;
|
|
94
|
+
headers?: Record<string, string> | undefined;
|
|
95
|
+
agentContext?: {
|
|
96
|
+
did: string;
|
|
97
|
+
kid: string;
|
|
98
|
+
session: string;
|
|
99
|
+
scopes: string[];
|
|
100
|
+
confidence: "verified";
|
|
101
|
+
registry: string;
|
|
102
|
+
verifiedAt: number;
|
|
103
|
+
delegationRef?: string | undefined;
|
|
104
|
+
subject?: string | undefined;
|
|
105
|
+
} | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
success: boolean;
|
|
108
|
+
error?: {
|
|
109
|
+
code: string;
|
|
110
|
+
message: string;
|
|
111
|
+
httpStatus: number;
|
|
112
|
+
details?: any;
|
|
113
|
+
} | undefined;
|
|
114
|
+
headers?: Record<string, string> | undefined;
|
|
115
|
+
agentContext?: {
|
|
116
|
+
did: string;
|
|
117
|
+
kid: string;
|
|
118
|
+
session: string;
|
|
119
|
+
confidence: "verified";
|
|
120
|
+
registry: string;
|
|
121
|
+
verifiedAt: number;
|
|
122
|
+
delegationRef?: string | undefined;
|
|
123
|
+
subject?: string | undefined;
|
|
124
|
+
scopes?: string[] | undefined;
|
|
125
|
+
} | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
export declare const StructuredErrorSchema: z.ZodObject<{
|
|
128
|
+
code: z.ZodString;
|
|
129
|
+
message: z.ZodString;
|
|
130
|
+
httpStatus: z.ZodNumber;
|
|
131
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
132
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
133
|
+
expected: z.ZodOptional<z.ZodAny>;
|
|
134
|
+
received: z.ZodOptional<z.ZodAny>;
|
|
135
|
+
remediation: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
expected?: any;
|
|
138
|
+
received?: any;
|
|
139
|
+
reason?: string | undefined;
|
|
140
|
+
remediation?: string | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
expected?: any;
|
|
143
|
+
received?: any;
|
|
144
|
+
reason?: string | undefined;
|
|
145
|
+
remediation?: string | undefined;
|
|
146
|
+
}>>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
code: string;
|
|
149
|
+
message: string;
|
|
150
|
+
httpStatus: number;
|
|
151
|
+
details?: {
|
|
152
|
+
expected?: any;
|
|
153
|
+
received?: any;
|
|
154
|
+
reason?: string | undefined;
|
|
155
|
+
remediation?: string | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
}, {
|
|
158
|
+
code: string;
|
|
159
|
+
message: string;
|
|
160
|
+
httpStatus: number;
|
|
161
|
+
details?: {
|
|
162
|
+
expected?: any;
|
|
163
|
+
received?: any;
|
|
164
|
+
reason?: string | undefined;
|
|
165
|
+
remediation?: string | undefined;
|
|
166
|
+
} | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
export type AgentContext = z.infer<typeof AgentContextSchema>;
|
|
169
|
+
export type VerifierResult = z.infer<typeof VerifierResultSchema>;
|
|
170
|
+
export type StructuredError = z.infer<typeof StructuredErrorSchema>;
|
|
171
|
+
export declare const AGENT_HEADERS: {
|
|
172
|
+
readonly DID: "X-Agent-DID";
|
|
173
|
+
readonly KEY_ID: "X-Agent-KeyId";
|
|
174
|
+
readonly SUBJECT: "X-Agent-Subject";
|
|
175
|
+
readonly SCOPES: "X-Agent-Scopes";
|
|
176
|
+
readonly SESSION: "X-Agent-Session";
|
|
177
|
+
readonly CONFIDENCE: "X-Agent-Confidence";
|
|
178
|
+
readonly DELEGATION_REF: "X-Agent-Delegation-Ref";
|
|
179
|
+
readonly REGISTRY: "X-Agent-Registry";
|
|
180
|
+
readonly VERIFIED_AT: "X-Agent-Verified-At";
|
|
181
|
+
};
|
|
182
|
+
export declare const VERIFIER_ERROR_CODES: {
|
|
183
|
+
readonly PROOF_INVALID_TS: "XMCP_I_PROOF_INVALID_TS";
|
|
184
|
+
readonly PROOF_FUTURE_TS: "XMCP_I_PROOF_FUTURE_TS";
|
|
185
|
+
readonly PROOF_TOO_OLD: "XMCP_I_PROOF_TOO_OLD";
|
|
186
|
+
readonly PROOF_SKEW_EXCEEDED: "XMCP_I_PROOF_SKEW_EXCEEDED";
|
|
187
|
+
readonly SESSION_IDLE_EXPIRED: "XMCP_I_SESSION_IDLE_EXPIRED";
|
|
188
|
+
readonly SERVER_TIME_INVALID: "XMCP_I_SERVER_TIME_INVALID";
|
|
189
|
+
};
|
|
190
|
+
export declare const ERROR_HTTP_STATUS: {
|
|
191
|
+
readonly XMCP_I_EBADPROOF: 403;
|
|
192
|
+
readonly XMCP_I_ENOIDENTITY: 500;
|
|
193
|
+
readonly XMCP_I_EMIRRORPENDING: 200;
|
|
194
|
+
readonly XMCP_I_EHANDSHAKE: 401;
|
|
195
|
+
readonly XMCP_I_ESESSION: 401;
|
|
196
|
+
readonly XMCP_I_ECLAIM: 400;
|
|
197
|
+
readonly XMCP_I_ECONFIG: 500;
|
|
198
|
+
readonly XMCP_I_ERUNTIME: 500;
|
|
199
|
+
readonly XMCP_I_PROOF_INVALID_TS: 403;
|
|
200
|
+
readonly XMCP_I_PROOF_FUTURE_TS: 403;
|
|
201
|
+
readonly XMCP_I_PROOF_TOO_OLD: 403;
|
|
202
|
+
readonly XMCP_I_PROOF_SKEW_EXCEEDED: 401;
|
|
203
|
+
readonly XMCP_I_SESSION_IDLE_EXPIRED: 401;
|
|
204
|
+
readonly XMCP_I_SERVER_TIME_INVALID: 500;
|
|
205
|
+
};
|
package/dist/verifier.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Verifier middleware schemas and headers
|
|
7
|
+
*/
|
|
8
|
+
exports.AgentContextSchema = zod_1.z.object({
|
|
9
|
+
did: zod_1.z.string().min(1),
|
|
10
|
+
kid: zod_1.z.string().min(1),
|
|
11
|
+
subject: zod_1.z.string().optional(),
|
|
12
|
+
scopes: zod_1.z.array(zod_1.z.string()).default([]),
|
|
13
|
+
session: zod_1.z.string().min(1),
|
|
14
|
+
confidence: zod_1.z.literal("verified"),
|
|
15
|
+
delegationRef: zod_1.z.string().optional(),
|
|
16
|
+
registry: zod_1.z.string().url(),
|
|
17
|
+
verifiedAt: zod_1.z.number().int().positive(),
|
|
18
|
+
});
|
|
19
|
+
exports.VerifierResultSchema = zod_1.z.object({
|
|
20
|
+
success: zod_1.z.boolean(),
|
|
21
|
+
headers: zod_1.z.record(zod_1.z.string()).optional(),
|
|
22
|
+
agentContext: exports.AgentContextSchema.optional(),
|
|
23
|
+
error: zod_1.z
|
|
24
|
+
.object({
|
|
25
|
+
code: zod_1.z.string(),
|
|
26
|
+
message: zod_1.z.string(),
|
|
27
|
+
details: zod_1.z.any().optional(),
|
|
28
|
+
httpStatus: zod_1.z.number().int().min(400).max(599),
|
|
29
|
+
})
|
|
30
|
+
.optional(),
|
|
31
|
+
});
|
|
32
|
+
exports.StructuredErrorSchema = zod_1.z.object({
|
|
33
|
+
code: zod_1.z.string(),
|
|
34
|
+
message: zod_1.z.string(),
|
|
35
|
+
httpStatus: zod_1.z.number().int().min(400).max(599),
|
|
36
|
+
details: zod_1.z
|
|
37
|
+
.object({
|
|
38
|
+
reason: zod_1.z.string().optional(),
|
|
39
|
+
expected: zod_1.z.any().optional(),
|
|
40
|
+
received: zod_1.z.any().optional(),
|
|
41
|
+
remediation: zod_1.z.string().optional(),
|
|
42
|
+
})
|
|
43
|
+
.optional(),
|
|
44
|
+
});
|
|
45
|
+
// Header constants (frozen names)
|
|
46
|
+
exports.AGENT_HEADERS = {
|
|
47
|
+
DID: "X-Agent-DID",
|
|
48
|
+
KEY_ID: "X-Agent-KeyId",
|
|
49
|
+
SUBJECT: "X-Agent-Subject",
|
|
50
|
+
SCOPES: "X-Agent-Scopes",
|
|
51
|
+
SESSION: "X-Agent-Session",
|
|
52
|
+
CONFIDENCE: "X-Agent-Confidence",
|
|
53
|
+
DELEGATION_REF: "X-Agent-Delegation-Ref",
|
|
54
|
+
REGISTRY: "X-Agent-Registry",
|
|
55
|
+
VERIFIED_AT: "X-Agent-Verified-At",
|
|
56
|
+
};
|
|
57
|
+
// Verifier-specific error codes
|
|
58
|
+
exports.VERIFIER_ERROR_CODES = {
|
|
59
|
+
PROOF_INVALID_TS: "XMCP_I_PROOF_INVALID_TS",
|
|
60
|
+
PROOF_FUTURE_TS: "XMCP_I_PROOF_FUTURE_TS",
|
|
61
|
+
PROOF_TOO_OLD: "XMCP_I_PROOF_TOO_OLD",
|
|
62
|
+
PROOF_SKEW_EXCEEDED: "XMCP_I_PROOF_SKEW_EXCEEDED",
|
|
63
|
+
SESSION_IDLE_EXPIRED: "XMCP_I_SESSION_IDLE_EXPIRED",
|
|
64
|
+
SERVER_TIME_INVALID: "XMCP_I_SERVER_TIME_INVALID",
|
|
65
|
+
};
|
|
66
|
+
// HTTP status mappings
|
|
67
|
+
exports.ERROR_HTTP_STATUS = {
|
|
68
|
+
XMCP_I_EBADPROOF: 403,
|
|
69
|
+
XMCP_I_ENOIDENTITY: 500,
|
|
70
|
+
XMCP_I_EMIRRORPENDING: 200,
|
|
71
|
+
XMCP_I_EHANDSHAKE: 401,
|
|
72
|
+
XMCP_I_ESESSION: 401,
|
|
73
|
+
XMCP_I_ECLAIM: 400,
|
|
74
|
+
XMCP_I_ECONFIG: 500,
|
|
75
|
+
XMCP_I_ERUNTIME: 500,
|
|
76
|
+
// Verifier-specific codes
|
|
77
|
+
[exports.VERIFIER_ERROR_CODES.PROOF_INVALID_TS]: 403,
|
|
78
|
+
[exports.VERIFIER_ERROR_CODES.PROOF_FUTURE_TS]: 403,
|
|
79
|
+
[exports.VERIFIER_ERROR_CODES.PROOF_TOO_OLD]: 403,
|
|
80
|
+
[exports.VERIFIER_ERROR_CODES.PROOF_SKEW_EXCEEDED]: 401,
|
|
81
|
+
[exports.VERIFIER_ERROR_CODES.SESSION_IDLE_EXPIRED]: 401,
|
|
82
|
+
[exports.VERIFIER_ERROR_CODES.SERVER_TIME_INVALID]: 500,
|
|
83
|
+
};
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP-I Well-Known Endpoints Specification
|
|
3
|
+
*
|
|
4
|
+
* This module defines the types for well-known endpoints as specified in the
|
|
5
|
+
* MCP-I protocol. These endpoints provide identity discovery and verification
|
|
6
|
+
* capabilities for MCP-I agents.
|
|
7
|
+
*
|
|
8
|
+
* @module @kya-os/contracts/well-known
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
/**
|
|
12
|
+
* DID Document as per W3C DID specification
|
|
13
|
+
* Returned from /.well-known/did.json
|
|
14
|
+
*/
|
|
15
|
+
export interface DIDDocument {
|
|
16
|
+
'@context': string[];
|
|
17
|
+
id: string;
|
|
18
|
+
verificationMethod: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
type: string;
|
|
21
|
+
controller: string;
|
|
22
|
+
publicKeyBase64?: string;
|
|
23
|
+
publicKeyMultibase?: string;
|
|
24
|
+
}>;
|
|
25
|
+
authentication?: string[];
|
|
26
|
+
assertionMethod?: string[];
|
|
27
|
+
capabilityInvocation?: string[];
|
|
28
|
+
capabilityDelegation?: string[];
|
|
29
|
+
keyAgreement?: string[];
|
|
30
|
+
service?: Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
type: string;
|
|
33
|
+
serviceEndpoint: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Agent Document for MCP-I capability discovery
|
|
38
|
+
* Returned from /.well-known/agent.json
|
|
39
|
+
*/
|
|
40
|
+
export interface AgentDocument {
|
|
41
|
+
/** The agent's DID */
|
|
42
|
+
id: string;
|
|
43
|
+
/** Capabilities supported by this agent */
|
|
44
|
+
capabilities: {
|
|
45
|
+
'mcp-i': Array<'handshake' | 'signing' | 'verification' | 'delegation' | 'proof-generation'>;
|
|
46
|
+
[key: string]: string[];
|
|
47
|
+
};
|
|
48
|
+
/** Optional metadata about the agent */
|
|
49
|
+
metadata?: {
|
|
50
|
+
name?: string;
|
|
51
|
+
serviceEndpoint?: string;
|
|
52
|
+
version?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* MCP Identity information
|
|
58
|
+
* Returned from /.well-known/mcp-identity
|
|
59
|
+
*/
|
|
60
|
+
export interface MCPIdentity {
|
|
61
|
+
/** The agent's DID */
|
|
62
|
+
did: string;
|
|
63
|
+
/** The agent's public key */
|
|
64
|
+
publicKey: string;
|
|
65
|
+
/** Service name */
|
|
66
|
+
serviceName: string;
|
|
67
|
+
/** Service endpoint URL */
|
|
68
|
+
serviceEndpoint: string;
|
|
69
|
+
/** Timestamp of when this was generated */
|
|
70
|
+
timestamp: number;
|
|
71
|
+
/** Optional additional metadata */
|
|
72
|
+
metadata?: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Well-known endpoint handler configuration
|
|
76
|
+
*/
|
|
77
|
+
export interface WellKnownConfig {
|
|
78
|
+
/** Service name to advertise */
|
|
79
|
+
serviceName?: string;
|
|
80
|
+
/** Service endpoint URL */
|
|
81
|
+
serviceEndpoint?: string;
|
|
82
|
+
/** Additional metadata to include */
|
|
83
|
+
metadata?: Record<string, unknown>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Well-known endpoint response
|
|
87
|
+
*/
|
|
88
|
+
export interface WellKnownResponse {
|
|
89
|
+
status: number;
|
|
90
|
+
headers: Record<string, string>;
|
|
91
|
+
body: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Well-known endpoint paths
|
|
95
|
+
*/
|
|
96
|
+
export declare enum WellKnownPath {
|
|
97
|
+
DID_DOCUMENT = "/.well-known/did.json",
|
|
98
|
+
AGENT_DOCUMENT = "/.well-known/agent.json",
|
|
99
|
+
MCP_IDENTITY = "/.well-known/mcp-identity",
|
|
100
|
+
TOOL_PROTECTIONS = "/.well-known/tool-protections.json"
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Zod Schemas for Validation
|
|
104
|
+
*/
|
|
105
|
+
export declare const DIDDocumentSchema: z.ZodObject<{
|
|
106
|
+
'@context': z.ZodArray<z.ZodString, "many">;
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
verificationMethod: z.ZodArray<z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
type: z.ZodString;
|
|
111
|
+
controller: z.ZodString;
|
|
112
|
+
publicKeyBase64: z.ZodOptional<z.ZodString>;
|
|
113
|
+
publicKeyMultibase: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
type: string;
|
|
116
|
+
id: string;
|
|
117
|
+
controller: string;
|
|
118
|
+
publicKeyMultibase?: string | undefined;
|
|
119
|
+
publicKeyBase64?: string | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
type: string;
|
|
122
|
+
id: string;
|
|
123
|
+
controller: string;
|
|
124
|
+
publicKeyMultibase?: string | undefined;
|
|
125
|
+
publicKeyBase64?: string | undefined;
|
|
126
|
+
}>, "many">;
|
|
127
|
+
authentication: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
128
|
+
assertionMethod: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
129
|
+
capabilityInvocation: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
130
|
+
capabilityDelegation: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
keyAgreement: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
132
|
+
service: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
133
|
+
id: z.ZodString;
|
|
134
|
+
type: z.ZodString;
|
|
135
|
+
serviceEndpoint: z.ZodString;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
type: string;
|
|
138
|
+
id: string;
|
|
139
|
+
serviceEndpoint: string;
|
|
140
|
+
}, {
|
|
141
|
+
type: string;
|
|
142
|
+
id: string;
|
|
143
|
+
serviceEndpoint: string;
|
|
144
|
+
}>, "many">>;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
id: string;
|
|
147
|
+
verificationMethod: {
|
|
148
|
+
type: string;
|
|
149
|
+
id: string;
|
|
150
|
+
controller: string;
|
|
151
|
+
publicKeyMultibase?: string | undefined;
|
|
152
|
+
publicKeyBase64?: string | undefined;
|
|
153
|
+
}[];
|
|
154
|
+
'@context': string[];
|
|
155
|
+
authentication?: string[] | undefined;
|
|
156
|
+
assertionMethod?: string[] | undefined;
|
|
157
|
+
keyAgreement?: string[] | undefined;
|
|
158
|
+
capabilityInvocation?: string[] | undefined;
|
|
159
|
+
capabilityDelegation?: string[] | undefined;
|
|
160
|
+
service?: {
|
|
161
|
+
type: string;
|
|
162
|
+
id: string;
|
|
163
|
+
serviceEndpoint: string;
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
id: string;
|
|
167
|
+
verificationMethod: {
|
|
168
|
+
type: string;
|
|
169
|
+
id: string;
|
|
170
|
+
controller: string;
|
|
171
|
+
publicKeyMultibase?: string | undefined;
|
|
172
|
+
publicKeyBase64?: string | undefined;
|
|
173
|
+
}[];
|
|
174
|
+
'@context': string[];
|
|
175
|
+
authentication?: string[] | undefined;
|
|
176
|
+
assertionMethod?: string[] | undefined;
|
|
177
|
+
keyAgreement?: string[] | undefined;
|
|
178
|
+
capabilityInvocation?: string[] | undefined;
|
|
179
|
+
capabilityDelegation?: string[] | undefined;
|
|
180
|
+
service?: {
|
|
181
|
+
type: string;
|
|
182
|
+
id: string;
|
|
183
|
+
serviceEndpoint: string;
|
|
184
|
+
}[] | undefined;
|
|
185
|
+
}>;
|
|
186
|
+
export declare const AgentDocumentSchema: z.ZodObject<{
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
capabilities: z.ZodObject<{
|
|
189
|
+
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
190
|
+
}, "strip", z.ZodArray<z.ZodString, "many">, z.objectOutputType<{
|
|
191
|
+
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
192
|
+
}, z.ZodArray<z.ZodString, "many">, "strip">, z.objectInputType<{
|
|
193
|
+
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
194
|
+
}, z.ZodArray<z.ZodString, "many">, "strip">>;
|
|
195
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
196
|
+
name: z.ZodOptional<z.ZodString>;
|
|
197
|
+
serviceEndpoint: z.ZodOptional<z.ZodString>;
|
|
198
|
+
version: z.ZodOptional<z.ZodString>;
|
|
199
|
+
description: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
version?: string | undefined;
|
|
202
|
+
name?: string | undefined;
|
|
203
|
+
serviceEndpoint?: string | undefined;
|
|
204
|
+
description?: string | undefined;
|
|
205
|
+
}, {
|
|
206
|
+
version?: string | undefined;
|
|
207
|
+
name?: string | undefined;
|
|
208
|
+
serviceEndpoint?: string | undefined;
|
|
209
|
+
description?: string | undefined;
|
|
210
|
+
}>>;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
id: string;
|
|
213
|
+
capabilities: {
|
|
214
|
+
'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
|
|
215
|
+
} & {
|
|
216
|
+
[k: string]: string[];
|
|
217
|
+
};
|
|
218
|
+
metadata?: {
|
|
219
|
+
version?: string | undefined;
|
|
220
|
+
name?: string | undefined;
|
|
221
|
+
serviceEndpoint?: string | undefined;
|
|
222
|
+
description?: string | undefined;
|
|
223
|
+
} | undefined;
|
|
224
|
+
}, {
|
|
225
|
+
id: string;
|
|
226
|
+
capabilities: {
|
|
227
|
+
'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
|
|
228
|
+
} & {
|
|
229
|
+
[k: string]: string[];
|
|
230
|
+
};
|
|
231
|
+
metadata?: {
|
|
232
|
+
version?: string | undefined;
|
|
233
|
+
name?: string | undefined;
|
|
234
|
+
serviceEndpoint?: string | undefined;
|
|
235
|
+
description?: string | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
}>;
|
|
238
|
+
export declare const MCPIdentitySchema: z.ZodObject<{
|
|
239
|
+
did: z.ZodString;
|
|
240
|
+
publicKey: z.ZodString;
|
|
241
|
+
serviceName: z.ZodString;
|
|
242
|
+
serviceEndpoint: z.ZodString;
|
|
243
|
+
timestamp: z.ZodNumber;
|
|
244
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
|
246
|
+
did: string;
|
|
247
|
+
publicKey: string;
|
|
248
|
+
timestamp: number;
|
|
249
|
+
serviceEndpoint: string;
|
|
250
|
+
serviceName: string;
|
|
251
|
+
metadata?: Record<string, unknown> | undefined;
|
|
252
|
+
}, {
|
|
253
|
+
did: string;
|
|
254
|
+
publicKey: string;
|
|
255
|
+
timestamp: number;
|
|
256
|
+
serviceEndpoint: string;
|
|
257
|
+
serviceName: string;
|
|
258
|
+
metadata?: Record<string, unknown> | undefined;
|
|
259
|
+
}>;
|
|
260
|
+
export declare const WellKnownConfigSchema: z.ZodObject<{
|
|
261
|
+
serviceName: z.ZodOptional<z.ZodString>;
|
|
262
|
+
serviceEndpoint: z.ZodOptional<z.ZodString>;
|
|
263
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
metadata?: Record<string, unknown> | undefined;
|
|
266
|
+
serviceEndpoint?: string | undefined;
|
|
267
|
+
serviceName?: string | undefined;
|
|
268
|
+
}, {
|
|
269
|
+
metadata?: Record<string, unknown> | undefined;
|
|
270
|
+
serviceEndpoint?: string | undefined;
|
|
271
|
+
serviceName?: string | undefined;
|
|
272
|
+
}>;
|
|
273
|
+
export declare const WellKnownResponseSchema: z.ZodObject<{
|
|
274
|
+
status: z.ZodNumber;
|
|
275
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
276
|
+
body: z.ZodString;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
status: number;
|
|
279
|
+
headers: Record<string, string>;
|
|
280
|
+
body: string;
|
|
281
|
+
}, {
|
|
282
|
+
status: number;
|
|
283
|
+
headers: Record<string, string>;
|
|
284
|
+
body: string;
|
|
285
|
+
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Type Guards
|
|
288
|
+
*/
|
|
289
|
+
export declare function isDIDDocument(obj: any): obj is DIDDocument;
|
|
290
|
+
export declare function isAgentDocument(obj: any): obj is AgentDocument;
|
|
291
|
+
export declare function isMCPIdentity(obj: any): obj is MCPIdentity;
|
|
292
|
+
/**
|
|
293
|
+
* Validation Functions
|
|
294
|
+
*/
|
|
295
|
+
export declare function validateDIDDocument(obj: any): DIDDocument;
|
|
296
|
+
export declare function validateAgentDocument(obj: any): AgentDocument;
|
|
297
|
+
export declare function validateMCPIdentity(obj: any): MCPIdentity;
|
|
298
|
+
/**
|
|
299
|
+
* Utility Functions
|
|
300
|
+
*/
|
|
301
|
+
/**
|
|
302
|
+
* Check if a path is a well-known endpoint
|
|
303
|
+
*/
|
|
304
|
+
export declare function isWellKnownPath(path: string): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Get the content type for a well-known endpoint
|
|
307
|
+
*/
|
|
308
|
+
export declare function getWellKnownContentType(path: WellKnownPath | string): string;
|