@kya-os/contracts 1.5.3-canary.15 → 1.5.3-canary.17
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/.turbo/turbo-build.log +17 -0
- package/.turbo/turbo-test$colon$coverage.log +85 -0
- package/.turbo/turbo-test.log +32 -0
- package/coverage/coverage-final.json +38 -0
- package/dist/config/identity.d.ts +138 -3
- package/dist/config/identity.js +28 -0
- package/dist/consent/schemas.d.ts +18 -0
- package/dist/consent/schemas.js +10 -0
- package/dist/dashboard-config/schemas.d.ts +1424 -220
- package/dist/tool-protection/index.d.ts +418 -8
- package/dist/tool-protection/index.js +61 -2
- package/package.json +35 -129
- package/schemas/cli/register-output/v1.0.0.json +69 -0
- package/schemas/identity/v1.0.0.json +46 -0
- package/schemas/proof/v1.0.0.json +80 -0
- package/schemas/registry/receipt-v1.0.0.json +60 -0
- package/schemas/verifier/verify-page/v1.0.0.json +94 -0
- package/schemas/well-known/agent/v1.0.0.json +67 -0
- package/schemas/well-known/did/v1.0.0.json +174 -0
- package/scripts/emit-schemas.js +11 -0
- package/src/agentshield-api/admin-schemas.ts +31 -0
- package/src/agentshield-api/admin-types.ts +47 -0
- package/src/agentshield-api/endpoints.ts +60 -0
- package/src/agentshield-api/index.ts +70 -0
- package/src/agentshield-api/schemas.ts +304 -0
- package/src/agentshield-api/types.ts +317 -0
- package/src/audit/index.ts +128 -0
- package/src/cli.ts +156 -0
- package/src/config/base.ts +107 -0
- package/src/config/builder.ts +97 -0
- package/src/config/delegation.ts +232 -0
- package/src/config/identity.ts +252 -0
- package/src/config/index.ts +78 -0
- package/src/config/proofing.ts +138 -0
- package/src/config/tool-context.ts +41 -0
- package/src/config/tool-protection.ts +174 -0
- package/src/consent/index.ts +32 -0
- package/src/consent/schemas.ts +334 -0
- package/src/consent/types.ts +199 -0
- package/src/dashboard-config/default-config.json +86 -0
- package/src/dashboard-config/default-config.ts +266 -0
- package/src/dashboard-config/index.ts +48 -0
- package/src/dashboard-config/schemas.ts +286 -0
- package/src/dashboard-config/types.ts +404 -0
- package/src/delegation/constraints.ts +267 -0
- package/src/delegation/index.ts +8 -0
- package/src/delegation/schemas.ts +595 -0
- package/src/did/index.ts +9 -0
- package/src/did/resolve-contract.ts +255 -0
- package/src/did/schemas.ts +190 -0
- package/src/did/types.ts +224 -0
- package/src/env/constants.ts +70 -0
- package/src/env/index.ts +5 -0
- package/src/handshake.ts +125 -0
- package/src/index.ts +45 -0
- package/src/proof/index.ts +31 -0
- package/src/proof/proof-record.ts +163 -0
- package/src/proof/signing-spec.ts +146 -0
- package/src/proof.ts +99 -0
- package/src/registry.ts +146 -0
- package/src/runtime/errors.ts +153 -0
- package/src/runtime/headers.ts +136 -0
- package/src/runtime/index.ts +6 -0
- package/src/test.ts +143 -0
- package/src/tlkrc/index.ts +5 -0
- package/src/tlkrc/rotation.ts +153 -0
- package/src/tool-protection/index.ts +343 -0
- package/src/utils/validation.ts +93 -0
- package/src/vc/index.ts +8 -0
- package/src/vc/schemas.ts +277 -0
- package/src/vc/statuslist.ts +279 -0
- package/src/verifier.ts +92 -0
- package/src/well-known/index.ts +237 -0
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module @kya-os/contracts/config
|
|
8
8
|
*/
|
|
9
|
+
import { z } from "zod";
|
|
9
10
|
/**
|
|
10
11
|
* Runtime Identity Configuration
|
|
11
12
|
*
|
|
@@ -25,7 +26,7 @@ export interface RuntimeIdentityConfig {
|
|
|
25
26
|
* Runtime environment for identity
|
|
26
27
|
* Determines where keys come from and how they're managed
|
|
27
28
|
*/
|
|
28
|
-
environment:
|
|
29
|
+
environment: "development" | "production";
|
|
29
30
|
/**
|
|
30
31
|
* Production identity configuration
|
|
31
32
|
* Used when environment is 'production'
|
|
@@ -71,7 +72,7 @@ export interface RuntimeIdentityConfig {
|
|
|
71
72
|
* - 'persistent': User DIDs are persisted in storage (requires did:web setup)
|
|
72
73
|
* @default 'ephemeral'
|
|
73
74
|
*/
|
|
74
|
-
userDidStorage?:
|
|
75
|
+
userDidStorage?: "ephemeral" | "persistent";
|
|
75
76
|
}
|
|
76
77
|
/**
|
|
77
78
|
* OAuth Provider Configuration
|
|
@@ -102,7 +103,7 @@ export interface OAuthProvider {
|
|
|
102
103
|
/** Custom OAuth parameters to include in authorization URL (e.g., audience, acr_values) */
|
|
103
104
|
customParams?: Record<string, string>;
|
|
104
105
|
/** Token endpoint authentication method */
|
|
105
|
-
tokenEndpointAuthMethod?:
|
|
106
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic";
|
|
106
107
|
/** OAuth response type (default: "code") */
|
|
107
108
|
responseType?: string;
|
|
108
109
|
/** OAuth grant type (default: "authorization_code") */
|
|
@@ -122,6 +123,140 @@ export interface OAuthConfig {
|
|
|
122
123
|
/** Map of provider names to provider configurations */
|
|
123
124
|
providers: Record<string, OAuthProvider>;
|
|
124
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Zod schema for OAuthProvider validation
|
|
128
|
+
*/
|
|
129
|
+
export declare const OAuthProviderSchema: z.ZodObject<{
|
|
130
|
+
clientId: z.ZodString;
|
|
131
|
+
clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
|
+
authorizationUrl: z.ZodString;
|
|
133
|
+
tokenUrl: z.ZodString;
|
|
134
|
+
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
135
|
+
supportsPKCE: z.ZodBoolean;
|
|
136
|
+
requiresClientSecret: z.ZodBoolean;
|
|
137
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
138
|
+
defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
139
|
+
proxyMode: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
141
|
+
tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
|
|
142
|
+
responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
143
|
+
grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
clientId: string;
|
|
146
|
+
authorizationUrl: string;
|
|
147
|
+
tokenUrl: string;
|
|
148
|
+
supportsPKCE: boolean;
|
|
149
|
+
requiresClientSecret: boolean;
|
|
150
|
+
responseType: string;
|
|
151
|
+
grantType: string;
|
|
152
|
+
clientSecret?: string | null | undefined;
|
|
153
|
+
userInfoUrl?: string | undefined;
|
|
154
|
+
scopes?: string[] | undefined;
|
|
155
|
+
defaultScopes?: string[] | undefined;
|
|
156
|
+
proxyMode?: boolean | undefined;
|
|
157
|
+
customParams?: Record<string, string> | undefined;
|
|
158
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
159
|
+
}, {
|
|
160
|
+
clientId: string;
|
|
161
|
+
authorizationUrl: string;
|
|
162
|
+
tokenUrl: string;
|
|
163
|
+
supportsPKCE: boolean;
|
|
164
|
+
requiresClientSecret: boolean;
|
|
165
|
+
clientSecret?: string | null | undefined;
|
|
166
|
+
userInfoUrl?: string | undefined;
|
|
167
|
+
scopes?: string[] | undefined;
|
|
168
|
+
defaultScopes?: string[] | undefined;
|
|
169
|
+
proxyMode?: boolean | undefined;
|
|
170
|
+
customParams?: Record<string, string> | undefined;
|
|
171
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
172
|
+
responseType?: string | undefined;
|
|
173
|
+
grantType?: string | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
/**
|
|
176
|
+
* Zod schema for OAuthConfig validation
|
|
177
|
+
*/
|
|
178
|
+
export declare const OAuthConfigSchema: z.ZodObject<{
|
|
179
|
+
providers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
180
|
+
clientId: z.ZodString;
|
|
181
|
+
clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
authorizationUrl: z.ZodString;
|
|
183
|
+
tokenUrl: z.ZodString;
|
|
184
|
+
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
185
|
+
supportsPKCE: z.ZodBoolean;
|
|
186
|
+
requiresClientSecret: z.ZodBoolean;
|
|
187
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
188
|
+
defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
189
|
+
proxyMode: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
191
|
+
tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
|
|
192
|
+
responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
193
|
+
grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
clientId: string;
|
|
196
|
+
authorizationUrl: string;
|
|
197
|
+
tokenUrl: string;
|
|
198
|
+
supportsPKCE: boolean;
|
|
199
|
+
requiresClientSecret: boolean;
|
|
200
|
+
responseType: string;
|
|
201
|
+
grantType: string;
|
|
202
|
+
clientSecret?: string | null | undefined;
|
|
203
|
+
userInfoUrl?: string | undefined;
|
|
204
|
+
scopes?: string[] | undefined;
|
|
205
|
+
defaultScopes?: string[] | undefined;
|
|
206
|
+
proxyMode?: boolean | undefined;
|
|
207
|
+
customParams?: Record<string, string> | undefined;
|
|
208
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
209
|
+
}, {
|
|
210
|
+
clientId: string;
|
|
211
|
+
authorizationUrl: string;
|
|
212
|
+
tokenUrl: string;
|
|
213
|
+
supportsPKCE: boolean;
|
|
214
|
+
requiresClientSecret: boolean;
|
|
215
|
+
clientSecret?: string | null | undefined;
|
|
216
|
+
userInfoUrl?: string | undefined;
|
|
217
|
+
scopes?: string[] | undefined;
|
|
218
|
+
defaultScopes?: string[] | undefined;
|
|
219
|
+
proxyMode?: boolean | undefined;
|
|
220
|
+
customParams?: Record<string, string> | undefined;
|
|
221
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
222
|
+
responseType?: string | undefined;
|
|
223
|
+
grantType?: string | undefined;
|
|
224
|
+
}>>;
|
|
225
|
+
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
providers: Record<string, {
|
|
227
|
+
clientId: string;
|
|
228
|
+
authorizationUrl: string;
|
|
229
|
+
tokenUrl: string;
|
|
230
|
+
supportsPKCE: boolean;
|
|
231
|
+
requiresClientSecret: boolean;
|
|
232
|
+
responseType: string;
|
|
233
|
+
grantType: string;
|
|
234
|
+
clientSecret?: string | null | undefined;
|
|
235
|
+
userInfoUrl?: string | undefined;
|
|
236
|
+
scopes?: string[] | undefined;
|
|
237
|
+
defaultScopes?: string[] | undefined;
|
|
238
|
+
proxyMode?: boolean | undefined;
|
|
239
|
+
customParams?: Record<string, string> | undefined;
|
|
240
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
241
|
+
}>;
|
|
242
|
+
}, {
|
|
243
|
+
providers: Record<string, {
|
|
244
|
+
clientId: string;
|
|
245
|
+
authorizationUrl: string;
|
|
246
|
+
tokenUrl: string;
|
|
247
|
+
supportsPKCE: boolean;
|
|
248
|
+
requiresClientSecret: boolean;
|
|
249
|
+
clientSecret?: string | null | undefined;
|
|
250
|
+
userInfoUrl?: string | undefined;
|
|
251
|
+
scopes?: string[] | undefined;
|
|
252
|
+
defaultScopes?: string[] | undefined;
|
|
253
|
+
proxyMode?: boolean | undefined;
|
|
254
|
+
customParams?: Record<string, string> | undefined;
|
|
255
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
256
|
+
responseType?: string | undefined;
|
|
257
|
+
grantType?: string | undefined;
|
|
258
|
+
}>;
|
|
259
|
+
}>;
|
|
125
260
|
/**
|
|
126
261
|
* IDP Tokens
|
|
127
262
|
*
|
package/dist/config/identity.js
CHANGED
|
@@ -8,3 +8,31 @@
|
|
|
8
8
|
* @module @kya-os/contracts/config
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.OAuthConfigSchema = exports.OAuthProviderSchema = void 0;
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
/**
|
|
14
|
+
* Zod schema for OAuthProvider validation
|
|
15
|
+
*/
|
|
16
|
+
exports.OAuthProviderSchema = zod_1.z.object({
|
|
17
|
+
clientId: zod_1.z.string().min(1),
|
|
18
|
+
clientSecret: zod_1.z.string().nullable().optional(),
|
|
19
|
+
authorizationUrl: zod_1.z.string().url(),
|
|
20
|
+
tokenUrl: zod_1.z.string().url(),
|
|
21
|
+
userInfoUrl: zod_1.z.string().url().optional(),
|
|
22
|
+
supportsPKCE: zod_1.z.boolean(),
|
|
23
|
+
requiresClientSecret: zod_1.z.boolean(),
|
|
24
|
+
scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
25
|
+
defaultScopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
26
|
+
proxyMode: zod_1.z.boolean().optional(),
|
|
27
|
+
// Phase 3: Custom IDP Support
|
|
28
|
+
customParams: zod_1.z.record(zod_1.z.string()).optional(),
|
|
29
|
+
tokenEndpointAuthMethod: zod_1.z.enum(["client_secret_post", "client_secret_basic"]).optional(),
|
|
30
|
+
responseType: zod_1.z.string().optional().default("code"),
|
|
31
|
+
grantType: zod_1.z.string().optional().default("authorization_code"),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Zod schema for OAuthConfig validation
|
|
35
|
+
*/
|
|
36
|
+
exports.OAuthConfigSchema = zod_1.z.object({
|
|
37
|
+
providers: zod_1.z.record(zod_1.z.string(), exports.OAuthProviderSchema),
|
|
38
|
+
});
|
|
@@ -269,6 +269,16 @@ export declare const consentPageConfigSchema: z.ZodObject<{
|
|
|
269
269
|
}>, "many">>;
|
|
270
270
|
serverUrl: z.ZodString;
|
|
271
271
|
autoClose: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
/**
|
|
273
|
+
* Whether OAuth authorization is required immediately
|
|
274
|
+
* If true, the consent page will act as a landing page before redirecting
|
|
275
|
+
*/
|
|
276
|
+
oauthRequired: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
/**
|
|
278
|
+
* The OAuth authorization URL to redirect to
|
|
279
|
+
* Required if oauthRequired is true
|
|
280
|
+
*/
|
|
281
|
+
oauthUrl: z.ZodOptional<z.ZodString>;
|
|
272
282
|
}, "strip", z.ZodTypeAny, {
|
|
273
283
|
agentDid: string;
|
|
274
284
|
serverUrl: string;
|
|
@@ -303,6 +313,8 @@ export declare const consentPageConfigSchema: z.ZodObject<{
|
|
|
303
313
|
pattern?: string | undefined;
|
|
304
314
|
}[] | undefined;
|
|
305
315
|
autoClose?: boolean | undefined;
|
|
316
|
+
oauthRequired?: boolean | undefined;
|
|
317
|
+
oauthUrl?: string | undefined;
|
|
306
318
|
}, {
|
|
307
319
|
agentDid: string;
|
|
308
320
|
serverUrl: string;
|
|
@@ -337,6 +349,8 @@ export declare const consentPageConfigSchema: z.ZodObject<{
|
|
|
337
349
|
pattern?: string | undefined;
|
|
338
350
|
}[] | undefined;
|
|
339
351
|
autoClose?: boolean | undefined;
|
|
352
|
+
oauthRequired?: boolean | undefined;
|
|
353
|
+
oauthUrl?: string | undefined;
|
|
340
354
|
}>;
|
|
341
355
|
export type ConsentPageConfig = z.infer<typeof consentPageConfigSchema>;
|
|
342
356
|
/**
|
|
@@ -689,6 +703,8 @@ export declare function validateConsentPageConfig(config: unknown): z.SafeParseR
|
|
|
689
703
|
pattern?: string | undefined;
|
|
690
704
|
}[] | undefined;
|
|
691
705
|
autoClose?: boolean | undefined;
|
|
706
|
+
oauthRequired?: boolean | undefined;
|
|
707
|
+
oauthUrl?: string | undefined;
|
|
692
708
|
}, {
|
|
693
709
|
agentDid: string;
|
|
694
710
|
serverUrl: string;
|
|
@@ -723,6 +739,8 @@ export declare function validateConsentPageConfig(config: unknown): z.SafeParseR
|
|
|
723
739
|
pattern?: string | undefined;
|
|
724
740
|
}[] | undefined;
|
|
725
741
|
autoClose?: boolean | undefined;
|
|
742
|
+
oauthRequired?: boolean | undefined;
|
|
743
|
+
oauthUrl?: string | undefined;
|
|
726
744
|
}>;
|
|
727
745
|
/**
|
|
728
746
|
* Validate a consent approval request
|
package/dist/consent/schemas.js
CHANGED
|
@@ -150,6 +150,16 @@ exports.consentPageConfigSchema = zod_1.z.object({
|
|
|
150
150
|
.optional(),
|
|
151
151
|
serverUrl: zod_1.z.string().url("Server URL must be a valid URL"),
|
|
152
152
|
autoClose: zod_1.z.boolean().optional(),
|
|
153
|
+
/**
|
|
154
|
+
* Whether OAuth authorization is required immediately
|
|
155
|
+
* If true, the consent page will act as a landing page before redirecting
|
|
156
|
+
*/
|
|
157
|
+
oauthRequired: zod_1.z.boolean().optional(),
|
|
158
|
+
/**
|
|
159
|
+
* The OAuth authorization URL to redirect to
|
|
160
|
+
* Required if oauthRequired is true
|
|
161
|
+
*/
|
|
162
|
+
oauthUrl: zod_1.z.string().url().optional(),
|
|
153
163
|
});
|
|
154
164
|
/**
|
|
155
165
|
* Consent Approval Request Schema
|