@kya-os/contracts 1.5.3-canary.15 → 1.5.3-canary.16
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/config/identity.d.ts +138 -3
- package/dist/config/identity.js +28 -0
- package/package.json +1 -1
|
@@ -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
|
+
});
|