@kya-os/contracts 1.6.3 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audit/index.d.ts +4 -4
- package/dist/config/identity.d.ts +477 -6
- package/dist/config/identity.js +68 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +6 -1
- package/dist/config/tool-context.d.ts +14 -2
- package/dist/dashboard-config/index.d.ts +2 -2
- package/dist/dashboard-config/index.js +4 -1
- package/dist/dashboard-config/schemas.d.ts +6595 -3160
- package/dist/dashboard-config/schemas.js +23 -1
- package/dist/dashboard-config/types.d.ts +28 -1
- package/package.json +5 -1
package/dist/audit/index.d.ts
CHANGED
|
@@ -72,8 +72,8 @@ export declare const AuditContextSchema: z.ZodObject<{
|
|
|
72
72
|
[k: string]: unknown;
|
|
73
73
|
};
|
|
74
74
|
session: {
|
|
75
|
-
audience: string;
|
|
76
75
|
sessionId: string;
|
|
76
|
+
audience: string;
|
|
77
77
|
} & {
|
|
78
78
|
[k: string]: unknown;
|
|
79
79
|
};
|
|
@@ -89,8 +89,8 @@ export declare const AuditContextSchema: z.ZodObject<{
|
|
|
89
89
|
[k: string]: unknown;
|
|
90
90
|
};
|
|
91
91
|
session: {
|
|
92
|
-
audience: string;
|
|
93
92
|
sessionId: string;
|
|
93
|
+
audience: string;
|
|
94
94
|
} & {
|
|
95
95
|
[k: string]: unknown;
|
|
96
96
|
};
|
|
@@ -160,8 +160,8 @@ export declare const AuditEventContextSchema: z.ZodObject<{
|
|
|
160
160
|
[k: string]: unknown;
|
|
161
161
|
};
|
|
162
162
|
session: {
|
|
163
|
-
audience: string;
|
|
164
163
|
sessionId: string;
|
|
164
|
+
audience: string;
|
|
165
165
|
} & {
|
|
166
166
|
[k: string]: unknown;
|
|
167
167
|
};
|
|
@@ -175,8 +175,8 @@ export declare const AuditEventContextSchema: z.ZodObject<{
|
|
|
175
175
|
[k: string]: unknown;
|
|
176
176
|
};
|
|
177
177
|
session: {
|
|
178
|
-
audience: string;
|
|
179
178
|
sessionId: string;
|
|
179
|
+
audience: string;
|
|
180
180
|
} & {
|
|
181
181
|
[k: string]: unknown;
|
|
182
182
|
};
|
|
@@ -74,6 +74,219 @@ export interface RuntimeIdentityConfig {
|
|
|
74
74
|
*/
|
|
75
75
|
userDidStorage?: "ephemeral" | "persistent";
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Auth Provider Type
|
|
79
|
+
*
|
|
80
|
+
* Discriminator for provider configuration types.
|
|
81
|
+
*/
|
|
82
|
+
export type AuthProviderType = "oauth2" | "credential";
|
|
83
|
+
/**
|
|
84
|
+
* Base Provider Configuration
|
|
85
|
+
*
|
|
86
|
+
* Common fields shared by all provider types.
|
|
87
|
+
*/
|
|
88
|
+
export interface BaseProviderConfig {
|
|
89
|
+
/** Provider type discriminator */
|
|
90
|
+
type: AuthProviderType;
|
|
91
|
+
/** Human-readable display name for the provider */
|
|
92
|
+
displayName?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Credential Provider Configuration
|
|
96
|
+
*
|
|
97
|
+
* Configuration for credential-based authentication (email/password).
|
|
98
|
+
* Used for customers who don't use OAuth and want direct login.
|
|
99
|
+
*/
|
|
100
|
+
export interface CredentialProviderConfig extends BaseProviderConfig {
|
|
101
|
+
type: "credential";
|
|
102
|
+
/** Authentication endpoint URL to POST credentials */
|
|
103
|
+
authEndpoint: string;
|
|
104
|
+
/**
|
|
105
|
+
* Request body template mapping form fields to API fields
|
|
106
|
+
* Use {{fieldName}} placeholders that will be replaced with form values
|
|
107
|
+
* @example { email: "{{email}}", password: "{{password}}" }
|
|
108
|
+
*/
|
|
109
|
+
requestBodyTemplate: Record<string, string>;
|
|
110
|
+
/**
|
|
111
|
+
* Response field mappings to extract data from auth response
|
|
112
|
+
*/
|
|
113
|
+
responseFields: {
|
|
114
|
+
/** JSON path to session token, or "cookie" to extract from Set-Cookie header */
|
|
115
|
+
sessionToken: string;
|
|
116
|
+
/** JSON path to user ID (optional) */
|
|
117
|
+
userId?: string;
|
|
118
|
+
/** JSON path to user email (optional) */
|
|
119
|
+
userEmail?: string;
|
|
120
|
+
/** JSON path to user display name (optional) */
|
|
121
|
+
userDisplayName?: string;
|
|
122
|
+
/** JSON path to token expiration in seconds (optional) */
|
|
123
|
+
expiresIn?: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Success validation configuration
|
|
127
|
+
* Checks if a field in the response matches an expected value
|
|
128
|
+
*/
|
|
129
|
+
successCheck?: {
|
|
130
|
+
/** JSON path to check in response */
|
|
131
|
+
path: string;
|
|
132
|
+
/** Expected value (string, boolean, or number) */
|
|
133
|
+
expectedValue: string | boolean | number;
|
|
134
|
+
};
|
|
135
|
+
/** Custom headers to include in auth request */
|
|
136
|
+
headers?: Record<string, string>;
|
|
137
|
+
/**
|
|
138
|
+
* How to use the token for subsequent API calls
|
|
139
|
+
* - "cookie": Send as Cookie header
|
|
140
|
+
* - "bearer": Send as Authorization: Bearer xxx
|
|
141
|
+
* - "header": Send as custom header (specify tokenHeader)
|
|
142
|
+
* @default "cookie"
|
|
143
|
+
*/
|
|
144
|
+
tokenUsage?: "cookie" | "bearer" | "header";
|
|
145
|
+
/** Custom header name when tokenUsage is "header" */
|
|
146
|
+
tokenHeader?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Cookie format template when tokenUsage is "cookie"
|
|
149
|
+
* Use {{token}} placeholder for the token value
|
|
150
|
+
* @example "CIX={{token}}; customerCookie={{token}}"
|
|
151
|
+
*/
|
|
152
|
+
cookieFormat?: string;
|
|
153
|
+
/** Additional headers to include in subsequent API calls */
|
|
154
|
+
apiHeaders?: Record<string, string>;
|
|
155
|
+
/**
|
|
156
|
+
* Consent page customization overrides
|
|
157
|
+
*/
|
|
158
|
+
consentOverrides?: {
|
|
159
|
+
branding?: Record<string, unknown>;
|
|
160
|
+
formTitle?: string;
|
|
161
|
+
formDescription?: string;
|
|
162
|
+
identityFieldLabel?: string;
|
|
163
|
+
passwordFieldLabel?: string;
|
|
164
|
+
submitButtonText?: string;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Zod schema for CredentialProviderConfig validation
|
|
169
|
+
*/
|
|
170
|
+
export declare const CredentialProviderConfigSchema: z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"credential">;
|
|
172
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
173
|
+
authEndpoint: z.ZodString;
|
|
174
|
+
requestBodyTemplate: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
175
|
+
responseFields: z.ZodObject<{
|
|
176
|
+
sessionToken: z.ZodString;
|
|
177
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
178
|
+
userEmail: z.ZodOptional<z.ZodString>;
|
|
179
|
+
userDisplayName: z.ZodOptional<z.ZodString>;
|
|
180
|
+
expiresIn: z.ZodOptional<z.ZodString>;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
sessionToken: string;
|
|
183
|
+
userId?: string | undefined;
|
|
184
|
+
userEmail?: string | undefined;
|
|
185
|
+
userDisplayName?: string | undefined;
|
|
186
|
+
expiresIn?: string | undefined;
|
|
187
|
+
}, {
|
|
188
|
+
sessionToken: string;
|
|
189
|
+
userId?: string | undefined;
|
|
190
|
+
userEmail?: string | undefined;
|
|
191
|
+
userDisplayName?: string | undefined;
|
|
192
|
+
expiresIn?: string | undefined;
|
|
193
|
+
}>;
|
|
194
|
+
successCheck: z.ZodOptional<z.ZodObject<{
|
|
195
|
+
path: z.ZodString;
|
|
196
|
+
expectedValue: z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
path: string;
|
|
199
|
+
expectedValue: string | number | boolean;
|
|
200
|
+
}, {
|
|
201
|
+
path: string;
|
|
202
|
+
expectedValue: string | number | boolean;
|
|
203
|
+
}>>;
|
|
204
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
205
|
+
tokenUsage: z.ZodOptional<z.ZodEnum<["cookie", "bearer", "header"]>>;
|
|
206
|
+
tokenHeader: z.ZodOptional<z.ZodString>;
|
|
207
|
+
cookieFormat: z.ZodOptional<z.ZodString>;
|
|
208
|
+
apiHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
209
|
+
consentOverrides: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
branding: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
211
|
+
formTitle: z.ZodOptional<z.ZodString>;
|
|
212
|
+
formDescription: z.ZodOptional<z.ZodString>;
|
|
213
|
+
identityFieldLabel: z.ZodOptional<z.ZodString>;
|
|
214
|
+
passwordFieldLabel: z.ZodOptional<z.ZodString>;
|
|
215
|
+
submitButtonText: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, "strip", z.ZodTypeAny, {
|
|
217
|
+
branding?: Record<string, unknown> | undefined;
|
|
218
|
+
formTitle?: string | undefined;
|
|
219
|
+
formDescription?: string | undefined;
|
|
220
|
+
identityFieldLabel?: string | undefined;
|
|
221
|
+
passwordFieldLabel?: string | undefined;
|
|
222
|
+
submitButtonText?: string | undefined;
|
|
223
|
+
}, {
|
|
224
|
+
branding?: Record<string, unknown> | undefined;
|
|
225
|
+
formTitle?: string | undefined;
|
|
226
|
+
formDescription?: string | undefined;
|
|
227
|
+
identityFieldLabel?: string | undefined;
|
|
228
|
+
passwordFieldLabel?: string | undefined;
|
|
229
|
+
submitButtonText?: string | undefined;
|
|
230
|
+
}>>;
|
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
|
232
|
+
type: "credential";
|
|
233
|
+
authEndpoint: string;
|
|
234
|
+
requestBodyTemplate: Record<string, string>;
|
|
235
|
+
responseFields: {
|
|
236
|
+
sessionToken: string;
|
|
237
|
+
userId?: string | undefined;
|
|
238
|
+
userEmail?: string | undefined;
|
|
239
|
+
userDisplayName?: string | undefined;
|
|
240
|
+
expiresIn?: string | undefined;
|
|
241
|
+
};
|
|
242
|
+
displayName?: string | undefined;
|
|
243
|
+
successCheck?: {
|
|
244
|
+
path: string;
|
|
245
|
+
expectedValue: string | number | boolean;
|
|
246
|
+
} | undefined;
|
|
247
|
+
headers?: Record<string, string> | undefined;
|
|
248
|
+
tokenUsage?: "cookie" | "bearer" | "header" | undefined;
|
|
249
|
+
tokenHeader?: string | undefined;
|
|
250
|
+
cookieFormat?: string | undefined;
|
|
251
|
+
apiHeaders?: Record<string, string> | undefined;
|
|
252
|
+
consentOverrides?: {
|
|
253
|
+
branding?: Record<string, unknown> | undefined;
|
|
254
|
+
formTitle?: string | undefined;
|
|
255
|
+
formDescription?: string | undefined;
|
|
256
|
+
identityFieldLabel?: string | undefined;
|
|
257
|
+
passwordFieldLabel?: string | undefined;
|
|
258
|
+
submitButtonText?: string | undefined;
|
|
259
|
+
} | undefined;
|
|
260
|
+
}, {
|
|
261
|
+
type: "credential";
|
|
262
|
+
authEndpoint: string;
|
|
263
|
+
requestBodyTemplate: Record<string, string>;
|
|
264
|
+
responseFields: {
|
|
265
|
+
sessionToken: string;
|
|
266
|
+
userId?: string | undefined;
|
|
267
|
+
userEmail?: string | undefined;
|
|
268
|
+
userDisplayName?: string | undefined;
|
|
269
|
+
expiresIn?: string | undefined;
|
|
270
|
+
};
|
|
271
|
+
displayName?: string | undefined;
|
|
272
|
+
successCheck?: {
|
|
273
|
+
path: string;
|
|
274
|
+
expectedValue: string | number | boolean;
|
|
275
|
+
} | undefined;
|
|
276
|
+
headers?: Record<string, string> | undefined;
|
|
277
|
+
tokenUsage?: "cookie" | "bearer" | "header" | undefined;
|
|
278
|
+
tokenHeader?: string | undefined;
|
|
279
|
+
cookieFormat?: string | undefined;
|
|
280
|
+
apiHeaders?: Record<string, string> | undefined;
|
|
281
|
+
consentOverrides?: {
|
|
282
|
+
branding?: Record<string, unknown> | undefined;
|
|
283
|
+
formTitle?: string | undefined;
|
|
284
|
+
formDescription?: string | undefined;
|
|
285
|
+
identityFieldLabel?: string | undefined;
|
|
286
|
+
passwordFieldLabel?: string | undefined;
|
|
287
|
+
submitButtonText?: string | undefined;
|
|
288
|
+
} | undefined;
|
|
289
|
+
}>;
|
|
77
290
|
/**
|
|
78
291
|
* OAuth Provider Configuration
|
|
79
292
|
*
|
|
@@ -155,9 +368,9 @@ export declare const OAuthProviderSchema: z.ZodObject<{
|
|
|
155
368
|
requiresClientSecret: boolean;
|
|
156
369
|
responseType: string;
|
|
157
370
|
grantType: string;
|
|
158
|
-
scopes?: string[] | undefined;
|
|
159
371
|
clientSecret?: string | null | undefined;
|
|
160
372
|
userInfoUrl?: string | undefined;
|
|
373
|
+
scopes?: string[] | undefined;
|
|
161
374
|
defaultScopes?: string[] | undefined;
|
|
162
375
|
proxyMode?: boolean | undefined;
|
|
163
376
|
customParams?: Record<string, string> | undefined;
|
|
@@ -168,9 +381,9 @@ export declare const OAuthProviderSchema: z.ZodObject<{
|
|
|
168
381
|
tokenUrl: string;
|
|
169
382
|
supportsPKCE: boolean;
|
|
170
383
|
requiresClientSecret: boolean;
|
|
171
|
-
scopes?: string[] | undefined;
|
|
172
384
|
clientSecret?: string | null | undefined;
|
|
173
385
|
userInfoUrl?: string | undefined;
|
|
386
|
+
scopes?: string[] | undefined;
|
|
174
387
|
defaultScopes?: string[] | undefined;
|
|
175
388
|
proxyMode?: boolean | undefined;
|
|
176
389
|
customParams?: Record<string, string> | undefined;
|
|
@@ -205,9 +418,9 @@ export declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
205
418
|
requiresClientSecret: boolean;
|
|
206
419
|
responseType: string;
|
|
207
420
|
grantType: string;
|
|
208
|
-
scopes?: string[] | undefined;
|
|
209
421
|
clientSecret?: string | null | undefined;
|
|
210
422
|
userInfoUrl?: string | undefined;
|
|
423
|
+
scopes?: string[] | undefined;
|
|
211
424
|
defaultScopes?: string[] | undefined;
|
|
212
425
|
proxyMode?: boolean | undefined;
|
|
213
426
|
customParams?: Record<string, string> | undefined;
|
|
@@ -218,9 +431,9 @@ export declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
218
431
|
tokenUrl: string;
|
|
219
432
|
supportsPKCE: boolean;
|
|
220
433
|
requiresClientSecret: boolean;
|
|
221
|
-
scopes?: string[] | undefined;
|
|
222
434
|
clientSecret?: string | null | undefined;
|
|
223
435
|
userInfoUrl?: string | undefined;
|
|
436
|
+
scopes?: string[] | undefined;
|
|
224
437
|
defaultScopes?: string[] | undefined;
|
|
225
438
|
proxyMode?: boolean | undefined;
|
|
226
439
|
customParams?: Record<string, string> | undefined;
|
|
@@ -238,9 +451,9 @@ export declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
238
451
|
requiresClientSecret: boolean;
|
|
239
452
|
responseType: string;
|
|
240
453
|
grantType: string;
|
|
241
|
-
scopes?: string[] | undefined;
|
|
242
454
|
clientSecret?: string | null | undefined;
|
|
243
455
|
userInfoUrl?: string | undefined;
|
|
456
|
+
scopes?: string[] | undefined;
|
|
244
457
|
defaultScopes?: string[] | undefined;
|
|
245
458
|
proxyMode?: boolean | undefined;
|
|
246
459
|
customParams?: Record<string, string> | undefined;
|
|
@@ -254,9 +467,9 @@ export declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
254
467
|
tokenUrl: string;
|
|
255
468
|
supportsPKCE: boolean;
|
|
256
469
|
requiresClientSecret: boolean;
|
|
257
|
-
scopes?: string[] | undefined;
|
|
258
470
|
clientSecret?: string | null | undefined;
|
|
259
471
|
userInfoUrl?: string | undefined;
|
|
472
|
+
scopes?: string[] | undefined;
|
|
260
473
|
defaultScopes?: string[] | undefined;
|
|
261
474
|
proxyMode?: boolean | undefined;
|
|
262
475
|
customParams?: Record<string, string> | undefined;
|
|
@@ -266,6 +479,264 @@ export declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
266
479
|
}>;
|
|
267
480
|
configuredProvider?: string | null | undefined;
|
|
268
481
|
}>;
|
|
482
|
+
/**
|
|
483
|
+
* OAuth2 Provider Configuration (explicit type for discriminated union)
|
|
484
|
+
*
|
|
485
|
+
* Wrapper around OAuthProvider with explicit type discriminator.
|
|
486
|
+
*/
|
|
487
|
+
export interface OAuth2ProviderConfig extends BaseProviderConfig {
|
|
488
|
+
type: "oauth2";
|
|
489
|
+
clientId: string;
|
|
490
|
+
clientSecret?: string | null;
|
|
491
|
+
authorizationUrl: string;
|
|
492
|
+
tokenUrl: string;
|
|
493
|
+
userInfoUrl?: string;
|
|
494
|
+
supportsPKCE: boolean;
|
|
495
|
+
requiresClientSecret: boolean;
|
|
496
|
+
scopes?: string[];
|
|
497
|
+
defaultScopes?: string[];
|
|
498
|
+
proxyMode?: boolean;
|
|
499
|
+
customParams?: Record<string, string>;
|
|
500
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic";
|
|
501
|
+
responseType?: string;
|
|
502
|
+
grantType?: string;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Zod schema for OAuth2ProviderConfig validation
|
|
506
|
+
*/
|
|
507
|
+
export declare const OAuth2ProviderConfigSchema: z.ZodObject<{
|
|
508
|
+
type: z.ZodLiteral<"oauth2">;
|
|
509
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
510
|
+
clientId: z.ZodString;
|
|
511
|
+
clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
512
|
+
authorizationUrl: z.ZodString;
|
|
513
|
+
tokenUrl: z.ZodString;
|
|
514
|
+
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
515
|
+
supportsPKCE: z.ZodBoolean;
|
|
516
|
+
requiresClientSecret: z.ZodBoolean;
|
|
517
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
518
|
+
defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
519
|
+
proxyMode: z.ZodOptional<z.ZodBoolean>;
|
|
520
|
+
customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
521
|
+
tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
|
|
522
|
+
responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
523
|
+
grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
524
|
+
}, "strip", z.ZodTypeAny, {
|
|
525
|
+
type: "oauth2";
|
|
526
|
+
clientId: string;
|
|
527
|
+
authorizationUrl: string;
|
|
528
|
+
tokenUrl: string;
|
|
529
|
+
supportsPKCE: boolean;
|
|
530
|
+
requiresClientSecret: boolean;
|
|
531
|
+
responseType: string;
|
|
532
|
+
grantType: string;
|
|
533
|
+
displayName?: string | undefined;
|
|
534
|
+
clientSecret?: string | null | undefined;
|
|
535
|
+
userInfoUrl?: string | undefined;
|
|
536
|
+
scopes?: string[] | undefined;
|
|
537
|
+
defaultScopes?: string[] | undefined;
|
|
538
|
+
proxyMode?: boolean | undefined;
|
|
539
|
+
customParams?: Record<string, string> | undefined;
|
|
540
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
541
|
+
}, {
|
|
542
|
+
type: "oauth2";
|
|
543
|
+
clientId: string;
|
|
544
|
+
authorizationUrl: string;
|
|
545
|
+
tokenUrl: string;
|
|
546
|
+
supportsPKCE: boolean;
|
|
547
|
+
requiresClientSecret: boolean;
|
|
548
|
+
displayName?: string | undefined;
|
|
549
|
+
clientSecret?: string | null | undefined;
|
|
550
|
+
userInfoUrl?: string | undefined;
|
|
551
|
+
scopes?: string[] | undefined;
|
|
552
|
+
defaultScopes?: string[] | undefined;
|
|
553
|
+
proxyMode?: boolean | undefined;
|
|
554
|
+
customParams?: Record<string, string> | undefined;
|
|
555
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
556
|
+
responseType?: string | undefined;
|
|
557
|
+
grantType?: string | undefined;
|
|
558
|
+
}>;
|
|
559
|
+
/**
|
|
560
|
+
* Unified Auth Provider Type
|
|
561
|
+
*
|
|
562
|
+
* Discriminated union of all supported authentication provider types.
|
|
563
|
+
* Use `type` field to determine which configuration shape to expect.
|
|
564
|
+
*/
|
|
565
|
+
export type AuthProvider = OAuth2ProviderConfig | CredentialProviderConfig;
|
|
566
|
+
/**
|
|
567
|
+
* Zod schema for AuthProvider validation (discriminated union)
|
|
568
|
+
*/
|
|
569
|
+
export declare const AuthProviderSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
570
|
+
type: z.ZodLiteral<"oauth2">;
|
|
571
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
572
|
+
clientId: z.ZodString;
|
|
573
|
+
clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
574
|
+
authorizationUrl: z.ZodString;
|
|
575
|
+
tokenUrl: z.ZodString;
|
|
576
|
+
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
577
|
+
supportsPKCE: z.ZodBoolean;
|
|
578
|
+
requiresClientSecret: z.ZodBoolean;
|
|
579
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
580
|
+
defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
581
|
+
proxyMode: z.ZodOptional<z.ZodBoolean>;
|
|
582
|
+
customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
583
|
+
tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
|
|
584
|
+
responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
585
|
+
grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
586
|
+
}, "strip", z.ZodTypeAny, {
|
|
587
|
+
type: "oauth2";
|
|
588
|
+
clientId: string;
|
|
589
|
+
authorizationUrl: string;
|
|
590
|
+
tokenUrl: string;
|
|
591
|
+
supportsPKCE: boolean;
|
|
592
|
+
requiresClientSecret: boolean;
|
|
593
|
+
responseType: string;
|
|
594
|
+
grantType: string;
|
|
595
|
+
displayName?: string | undefined;
|
|
596
|
+
clientSecret?: string | null | undefined;
|
|
597
|
+
userInfoUrl?: string | undefined;
|
|
598
|
+
scopes?: string[] | undefined;
|
|
599
|
+
defaultScopes?: string[] | undefined;
|
|
600
|
+
proxyMode?: boolean | undefined;
|
|
601
|
+
customParams?: Record<string, string> | undefined;
|
|
602
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
603
|
+
}, {
|
|
604
|
+
type: "oauth2";
|
|
605
|
+
clientId: string;
|
|
606
|
+
authorizationUrl: string;
|
|
607
|
+
tokenUrl: string;
|
|
608
|
+
supportsPKCE: boolean;
|
|
609
|
+
requiresClientSecret: boolean;
|
|
610
|
+
displayName?: string | undefined;
|
|
611
|
+
clientSecret?: string | null | undefined;
|
|
612
|
+
userInfoUrl?: string | undefined;
|
|
613
|
+
scopes?: string[] | undefined;
|
|
614
|
+
defaultScopes?: string[] | undefined;
|
|
615
|
+
proxyMode?: boolean | undefined;
|
|
616
|
+
customParams?: Record<string, string> | undefined;
|
|
617
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
618
|
+
responseType?: string | undefined;
|
|
619
|
+
grantType?: string | undefined;
|
|
620
|
+
}>, z.ZodObject<{
|
|
621
|
+
type: z.ZodLiteral<"credential">;
|
|
622
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
623
|
+
authEndpoint: z.ZodString;
|
|
624
|
+
requestBodyTemplate: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
625
|
+
responseFields: z.ZodObject<{
|
|
626
|
+
sessionToken: z.ZodString;
|
|
627
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
628
|
+
userEmail: z.ZodOptional<z.ZodString>;
|
|
629
|
+
userDisplayName: z.ZodOptional<z.ZodString>;
|
|
630
|
+
expiresIn: z.ZodOptional<z.ZodString>;
|
|
631
|
+
}, "strip", z.ZodTypeAny, {
|
|
632
|
+
sessionToken: string;
|
|
633
|
+
userId?: string | undefined;
|
|
634
|
+
userEmail?: string | undefined;
|
|
635
|
+
userDisplayName?: string | undefined;
|
|
636
|
+
expiresIn?: string | undefined;
|
|
637
|
+
}, {
|
|
638
|
+
sessionToken: string;
|
|
639
|
+
userId?: string | undefined;
|
|
640
|
+
userEmail?: string | undefined;
|
|
641
|
+
userDisplayName?: string | undefined;
|
|
642
|
+
expiresIn?: string | undefined;
|
|
643
|
+
}>;
|
|
644
|
+
successCheck: z.ZodOptional<z.ZodObject<{
|
|
645
|
+
path: z.ZodString;
|
|
646
|
+
expectedValue: z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
647
|
+
}, "strip", z.ZodTypeAny, {
|
|
648
|
+
path: string;
|
|
649
|
+
expectedValue: string | number | boolean;
|
|
650
|
+
}, {
|
|
651
|
+
path: string;
|
|
652
|
+
expectedValue: string | number | boolean;
|
|
653
|
+
}>>;
|
|
654
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
655
|
+
tokenUsage: z.ZodOptional<z.ZodEnum<["cookie", "bearer", "header"]>>;
|
|
656
|
+
tokenHeader: z.ZodOptional<z.ZodString>;
|
|
657
|
+
cookieFormat: z.ZodOptional<z.ZodString>;
|
|
658
|
+
apiHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
659
|
+
consentOverrides: z.ZodOptional<z.ZodObject<{
|
|
660
|
+
branding: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
661
|
+
formTitle: z.ZodOptional<z.ZodString>;
|
|
662
|
+
formDescription: z.ZodOptional<z.ZodString>;
|
|
663
|
+
identityFieldLabel: z.ZodOptional<z.ZodString>;
|
|
664
|
+
passwordFieldLabel: z.ZodOptional<z.ZodString>;
|
|
665
|
+
submitButtonText: z.ZodOptional<z.ZodString>;
|
|
666
|
+
}, "strip", z.ZodTypeAny, {
|
|
667
|
+
branding?: Record<string, unknown> | undefined;
|
|
668
|
+
formTitle?: string | undefined;
|
|
669
|
+
formDescription?: string | undefined;
|
|
670
|
+
identityFieldLabel?: string | undefined;
|
|
671
|
+
passwordFieldLabel?: string | undefined;
|
|
672
|
+
submitButtonText?: string | undefined;
|
|
673
|
+
}, {
|
|
674
|
+
branding?: Record<string, unknown> | undefined;
|
|
675
|
+
formTitle?: string | undefined;
|
|
676
|
+
formDescription?: string | undefined;
|
|
677
|
+
identityFieldLabel?: string | undefined;
|
|
678
|
+
passwordFieldLabel?: string | undefined;
|
|
679
|
+
submitButtonText?: string | undefined;
|
|
680
|
+
}>>;
|
|
681
|
+
}, "strip", z.ZodTypeAny, {
|
|
682
|
+
type: "credential";
|
|
683
|
+
authEndpoint: string;
|
|
684
|
+
requestBodyTemplate: Record<string, string>;
|
|
685
|
+
responseFields: {
|
|
686
|
+
sessionToken: string;
|
|
687
|
+
userId?: string | undefined;
|
|
688
|
+
userEmail?: string | undefined;
|
|
689
|
+
userDisplayName?: string | undefined;
|
|
690
|
+
expiresIn?: string | undefined;
|
|
691
|
+
};
|
|
692
|
+
displayName?: string | undefined;
|
|
693
|
+
successCheck?: {
|
|
694
|
+
path: string;
|
|
695
|
+
expectedValue: string | number | boolean;
|
|
696
|
+
} | undefined;
|
|
697
|
+
headers?: Record<string, string> | undefined;
|
|
698
|
+
tokenUsage?: "cookie" | "bearer" | "header" | undefined;
|
|
699
|
+
tokenHeader?: string | undefined;
|
|
700
|
+
cookieFormat?: string | undefined;
|
|
701
|
+
apiHeaders?: Record<string, string> | undefined;
|
|
702
|
+
consentOverrides?: {
|
|
703
|
+
branding?: Record<string, unknown> | undefined;
|
|
704
|
+
formTitle?: string | undefined;
|
|
705
|
+
formDescription?: string | undefined;
|
|
706
|
+
identityFieldLabel?: string | undefined;
|
|
707
|
+
passwordFieldLabel?: string | undefined;
|
|
708
|
+
submitButtonText?: string | undefined;
|
|
709
|
+
} | undefined;
|
|
710
|
+
}, {
|
|
711
|
+
type: "credential";
|
|
712
|
+
authEndpoint: string;
|
|
713
|
+
requestBodyTemplate: Record<string, string>;
|
|
714
|
+
responseFields: {
|
|
715
|
+
sessionToken: string;
|
|
716
|
+
userId?: string | undefined;
|
|
717
|
+
userEmail?: string | undefined;
|
|
718
|
+
userDisplayName?: string | undefined;
|
|
719
|
+
expiresIn?: string | undefined;
|
|
720
|
+
};
|
|
721
|
+
displayName?: string | undefined;
|
|
722
|
+
successCheck?: {
|
|
723
|
+
path: string;
|
|
724
|
+
expectedValue: string | number | boolean;
|
|
725
|
+
} | undefined;
|
|
726
|
+
headers?: Record<string, string> | undefined;
|
|
727
|
+
tokenUsage?: "cookie" | "bearer" | "header" | undefined;
|
|
728
|
+
tokenHeader?: string | undefined;
|
|
729
|
+
cookieFormat?: string | undefined;
|
|
730
|
+
apiHeaders?: Record<string, string> | undefined;
|
|
731
|
+
consentOverrides?: {
|
|
732
|
+
branding?: Record<string, unknown> | undefined;
|
|
733
|
+
formTitle?: string | undefined;
|
|
734
|
+
formDescription?: string | undefined;
|
|
735
|
+
identityFieldLabel?: string | undefined;
|
|
736
|
+
passwordFieldLabel?: string | undefined;
|
|
737
|
+
submitButtonText?: string | undefined;
|
|
738
|
+
} | undefined;
|
|
739
|
+
}>]>;
|
|
269
740
|
/**
|
|
270
741
|
* IDP Tokens
|
|
271
742
|
*
|
package/dist/config/identity.js
CHANGED
|
@@ -8,8 +8,45 @@
|
|
|
8
8
|
* @module @kya-os/contracts/config
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.OAuthConfigSchema = exports.OAuthProviderSchema = void 0;
|
|
11
|
+
exports.AuthProviderSchema = exports.OAuth2ProviderConfigSchema = exports.OAuthConfigSchema = exports.OAuthProviderSchema = exports.CredentialProviderConfigSchema = void 0;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
|
+
/**
|
|
14
|
+
* Zod schema for CredentialProviderConfig validation
|
|
15
|
+
*/
|
|
16
|
+
exports.CredentialProviderConfigSchema = zod_1.z.object({
|
|
17
|
+
type: zod_1.z.literal("credential"),
|
|
18
|
+
displayName: zod_1.z.string().optional(),
|
|
19
|
+
authEndpoint: zod_1.z.string().url(),
|
|
20
|
+
requestBodyTemplate: zod_1.z.record(zod_1.z.string()),
|
|
21
|
+
responseFields: zod_1.z.object({
|
|
22
|
+
sessionToken: zod_1.z.string(),
|
|
23
|
+
userId: zod_1.z.string().optional(),
|
|
24
|
+
userEmail: zod_1.z.string().optional(),
|
|
25
|
+
userDisplayName: zod_1.z.string().optional(),
|
|
26
|
+
expiresIn: zod_1.z.string().optional(),
|
|
27
|
+
}),
|
|
28
|
+
successCheck: zod_1.z
|
|
29
|
+
.object({
|
|
30
|
+
path: zod_1.z.string(),
|
|
31
|
+
expectedValue: zod_1.z.union([zod_1.z.string(), zod_1.z.boolean(), zod_1.z.number()]),
|
|
32
|
+
})
|
|
33
|
+
.optional(),
|
|
34
|
+
headers: zod_1.z.record(zod_1.z.string()).optional(),
|
|
35
|
+
tokenUsage: zod_1.z.enum(["cookie", "bearer", "header"]).optional(),
|
|
36
|
+
tokenHeader: zod_1.z.string().optional(),
|
|
37
|
+
cookieFormat: zod_1.z.string().optional(),
|
|
38
|
+
apiHeaders: zod_1.z.record(zod_1.z.string()).optional(),
|
|
39
|
+
consentOverrides: zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
branding: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
42
|
+
formTitle: zod_1.z.string().optional(),
|
|
43
|
+
formDescription: zod_1.z.string().optional(),
|
|
44
|
+
identityFieldLabel: zod_1.z.string().optional(),
|
|
45
|
+
passwordFieldLabel: zod_1.z.string().optional(),
|
|
46
|
+
submitButtonText: zod_1.z.string().optional(),
|
|
47
|
+
})
|
|
48
|
+
.optional(),
|
|
49
|
+
});
|
|
13
50
|
/**
|
|
14
51
|
* Zod schema for OAuthProvider validation
|
|
15
52
|
*/
|
|
@@ -37,3 +74,33 @@ exports.OAuthConfigSchema = zod_1.z.object({
|
|
|
37
74
|
providers: zod_1.z.record(zod_1.z.string(), exports.OAuthProviderSchema),
|
|
38
75
|
configuredProvider: zod_1.z.string().nullable().optional(),
|
|
39
76
|
});
|
|
77
|
+
/**
|
|
78
|
+
* Zod schema for OAuth2ProviderConfig validation
|
|
79
|
+
*/
|
|
80
|
+
exports.OAuth2ProviderConfigSchema = zod_1.z.object({
|
|
81
|
+
type: zod_1.z.literal("oauth2"),
|
|
82
|
+
displayName: zod_1.z.string().optional(),
|
|
83
|
+
clientId: zod_1.z.string().min(1),
|
|
84
|
+
clientSecret: zod_1.z.string().nullable().optional(),
|
|
85
|
+
authorizationUrl: zod_1.z.string().url(),
|
|
86
|
+
tokenUrl: zod_1.z.string().url(),
|
|
87
|
+
userInfoUrl: zod_1.z.string().url().optional(),
|
|
88
|
+
supportsPKCE: zod_1.z.boolean(),
|
|
89
|
+
requiresClientSecret: zod_1.z.boolean(),
|
|
90
|
+
scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
91
|
+
defaultScopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
92
|
+
proxyMode: zod_1.z.boolean().optional(),
|
|
93
|
+
customParams: zod_1.z.record(zod_1.z.string()).optional(),
|
|
94
|
+
tokenEndpointAuthMethod: zod_1.z
|
|
95
|
+
.enum(["client_secret_post", "client_secret_basic"])
|
|
96
|
+
.optional(),
|
|
97
|
+
responseType: zod_1.z.string().optional().default("code"),
|
|
98
|
+
grantType: zod_1.z.string().optional().default("authorization_code"),
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* Zod schema for AuthProvider validation (discriminated union)
|
|
102
|
+
*/
|
|
103
|
+
exports.AuthProviderSchema = zod_1.z.discriminatedUnion("type", [
|
|
104
|
+
exports.OAuth2ProviderConfigSchema,
|
|
105
|
+
exports.CredentialProviderConfigSchema,
|
|
106
|
+
]);
|
package/dist/config/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { ProofingConfig } from "./proofing.js";
|
|
|
12
12
|
import type { DelegationConfig } from "./delegation.js";
|
|
13
13
|
import type { ToolProtectionSourceConfig } from "./tool-protection.js";
|
|
14
14
|
export { MCPIBaseConfig } from "./base.js";
|
|
15
|
-
export { RuntimeIdentityConfig, AgentIdentity, OAuthProvider, OAuthConfig, IdpTokens, } from "./identity.js";
|
|
15
|
+
export { RuntimeIdentityConfig, AgentIdentity, OAuthProvider, OAuthConfig, IdpTokens, AuthProviderType, BaseProviderConfig, CredentialProviderConfig, CredentialProviderConfigSchema, OAuth2ProviderConfig, OAuth2ProviderConfigSchema, AuthProvider, AuthProviderSchema, } from "./identity.js";
|
|
16
16
|
export type { ToolExecutionContext } from "./tool-context.js";
|
|
17
17
|
/**
|
|
18
18
|
* @deprecated Use RuntimeIdentityConfig instead
|
package/dist/config/index.js
CHANGED
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
* @module @kya-os/contracts/config
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.buildBaseConfig = void 0;
|
|
11
|
+
exports.buildBaseConfig = exports.AuthProviderSchema = exports.OAuth2ProviderConfigSchema = exports.CredentialProviderConfigSchema = void 0;
|
|
12
|
+
// Identity configuration
|
|
13
|
+
var identity_js_1 = require("./identity.js");
|
|
14
|
+
Object.defineProperty(exports, "CredentialProviderConfigSchema", { enumerable: true, get: function () { return identity_js_1.CredentialProviderConfigSchema; } });
|
|
15
|
+
Object.defineProperty(exports, "OAuth2ProviderConfigSchema", { enumerable: true, get: function () { return identity_js_1.OAuth2ProviderConfigSchema; } });
|
|
16
|
+
Object.defineProperty(exports, "AuthProviderSchema", { enumerable: true, get: function () { return identity_js_1.AuthProviderSchema; } });
|
|
12
17
|
// Configuration builder utilities
|
|
13
18
|
var builder_js_1 = require("./builder.js");
|
|
14
19
|
Object.defineProperty(exports, "buildBaseConfig", { enumerable: true, get: function () { return builder_js_1.buildBaseConfig; } });
|