@willyim/idp 0.2.0 → 0.3.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/README.md +22 -0
- package/dist/src/schemas/index.d.ts +116 -0
- package/dist/src/schemas/index.d.ts.map +1 -1
- package/dist/src/schemas/index.js +85 -0
- package/dist/src/schemas/openapi.d.ts.map +1 -1
- package/dist/src/schemas/openapi.js +2 -1
- package/dist/src/schemas/operations.d.ts +205 -0
- package/dist/src/schemas/operations.d.ts.map +1 -1
- package/dist/src/schemas/operations.js +96 -1
- package/openapi/idp-api.json +1097 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -340,6 +340,28 @@ const { members } = await api.request("get", "/api/v1/apps/{app}/members", {
|
|
|
340
340
|
})
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
+
### Admin keys
|
|
344
|
+
|
|
345
|
+
Most management endpoints take a scoped `wim_` key, which is bound to one
|
|
346
|
+
application and carries an explicit permission set. IdP-level work — registering
|
|
347
|
+
an application, listing users across apps — needs superadmin instead, and for
|
|
348
|
+
that there are **admin keys**: `/api/v1/admin-keys` mints a named, optionally
|
|
349
|
+
expiring, revocable credential that holds every permission on every app. Mint
|
|
350
|
+
one per agent, so the audit trail records `adminkey:<id>` rather than an
|
|
351
|
+
anonymous shared secret, and revoke it when that agent is done.
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
const { token } = await api.request("post", "/api/v1/admin-keys", {
|
|
355
|
+
body: { name: "release-bot", expiresAt: "2026-12-31T00:00:00.000Z" },
|
|
356
|
+
})
|
|
357
|
+
// Shown exactly once. Presented like any other key:
|
|
358
|
+
// Authorization: Bearer wim_…
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
The IdP's static `ADMIN_API_TOKEN` still works and still grants superadmin, but
|
|
362
|
+
it is break-glass only: one shared secret, no name, no expiry, and no way to
|
|
363
|
+
revoke it short of a redeploy.
|
|
364
|
+
|
|
343
365
|
The OIDC endpoints are not in that document and never will be: they are
|
|
344
366
|
standards-defined and discovered at runtime from `.well-known`.
|
|
345
367
|
|
|
@@ -14,6 +14,8 @@ export declare const ApplicationSchema: z.ZodObject<{
|
|
|
14
14
|
clientId: z.ZodString;
|
|
15
15
|
name: z.ZodNullable<z.ZodString>;
|
|
16
16
|
app: z.ZodNullable<z.ZodString>;
|
|
17
|
+
allowSignup: z.ZodBoolean;
|
|
18
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
17
19
|
redirectUris: z.ZodArray<z.ZodString>;
|
|
18
20
|
disabled: z.ZodBoolean;
|
|
19
21
|
createdAt: z.ZodString;
|
|
@@ -37,11 +39,44 @@ export declare const ApplicationListSchema: z.ZodObject<{
|
|
|
37
39
|
clientId: z.ZodString;
|
|
38
40
|
name: z.ZodNullable<z.ZodString>;
|
|
39
41
|
app: z.ZodNullable<z.ZodString>;
|
|
42
|
+
allowSignup: z.ZodBoolean;
|
|
43
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
40
44
|
redirectUris: z.ZodArray<z.ZodString>;
|
|
41
45
|
disabled: z.ZodBoolean;
|
|
42
46
|
createdAt: z.ZodString;
|
|
43
47
|
}, z.core.$strip>>;
|
|
44
48
|
}, z.core.$strip>;
|
|
49
|
+
/**
|
|
50
|
+
* Register an application. Superadmin only — there is no app to scope it to
|
|
51
|
+
* yet, so no per-app permission could authorize it.
|
|
52
|
+
*/
|
|
53
|
+
export declare const CreateApplicationInput: z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
app: z.ZodString;
|
|
56
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
57
|
+
firstAdminUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export declare const ApplicationCreatedSchema: z.ZodObject<{
|
|
60
|
+
clientId: z.ZodString;
|
|
61
|
+
clientSecret: z.ZodString;
|
|
62
|
+
app: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
/** Partial update of an application. Omitted fields are left alone. */
|
|
65
|
+
export declare const UpdateApplicationInput: z.ZodObject<{
|
|
66
|
+
name: z.ZodOptional<z.ZodString>;
|
|
67
|
+
redirectUris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
allowSignup: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export declare const ClientSecretSchema: z.ZodObject<{
|
|
71
|
+
clientSecret: z.ZodString;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
/** Replaces the app's product-permission catalog wholesale. */
|
|
74
|
+
export declare const SetAppPermissionsInput: z.ZodObject<{
|
|
75
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export declare const AppPermissionsSchema: z.ZodObject<{
|
|
78
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
45
80
|
export declare const UserListSchema: z.ZodObject<{
|
|
46
81
|
users: z.ZodArray<z.ZodObject<{
|
|
47
82
|
id: z.ZodString;
|
|
@@ -204,4 +239,85 @@ export declare const AuditListSchema: z.ZodObject<{
|
|
|
204
239
|
createdAt: z.ZodString;
|
|
205
240
|
}, z.core.$strip>>;
|
|
206
241
|
}, z.core.$strip>;
|
|
242
|
+
export declare const ApiKeySchema: z.ZodObject<{
|
|
243
|
+
id: z.ZodString;
|
|
244
|
+
name: z.ZodString;
|
|
245
|
+
prefix: z.ZodString;
|
|
246
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
247
|
+
status: z.ZodEnum<{
|
|
248
|
+
active: "active";
|
|
249
|
+
expired: "expired";
|
|
250
|
+
revoked: "revoked";
|
|
251
|
+
}>;
|
|
252
|
+
createdAt: z.ZodString;
|
|
253
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
254
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
255
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
|
+
export declare const ApiKeyListSchema: z.ZodObject<{
|
|
258
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
259
|
+
id: z.ZodString;
|
|
260
|
+
name: z.ZodString;
|
|
261
|
+
prefix: z.ZodString;
|
|
262
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
263
|
+
status: z.ZodEnum<{
|
|
264
|
+
active: "active";
|
|
265
|
+
expired: "expired";
|
|
266
|
+
revoked: "revoked";
|
|
267
|
+
}>;
|
|
268
|
+
createdAt: z.ZodString;
|
|
269
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
270
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
271
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
272
|
+
}, z.core.$strip>>;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
export declare const CreateApiKeyInput: z.ZodObject<{
|
|
275
|
+
name: z.ZodString;
|
|
276
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
277
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
278
|
+
}, z.core.$strip>;
|
|
279
|
+
export declare const ApiKeyCreatedSchema: z.ZodObject<{
|
|
280
|
+
id: z.ZodString;
|
|
281
|
+
token: z.ZodString;
|
|
282
|
+
prefix: z.ZodString;
|
|
283
|
+
}, z.core.$strip>;
|
|
284
|
+
export declare const AdminKeySchema: z.ZodObject<{
|
|
285
|
+
id: z.ZodString;
|
|
286
|
+
name: z.ZodString;
|
|
287
|
+
prefix: z.ZodString;
|
|
288
|
+
status: z.ZodEnum<{
|
|
289
|
+
active: "active";
|
|
290
|
+
expired: "expired";
|
|
291
|
+
revoked: "revoked";
|
|
292
|
+
}>;
|
|
293
|
+
createdAt: z.ZodString;
|
|
294
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
295
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
296
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
297
|
+
}, z.core.$strip>;
|
|
298
|
+
export declare const AdminKeyListSchema: z.ZodObject<{
|
|
299
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
300
|
+
id: z.ZodString;
|
|
301
|
+
name: z.ZodString;
|
|
302
|
+
prefix: z.ZodString;
|
|
303
|
+
status: z.ZodEnum<{
|
|
304
|
+
active: "active";
|
|
305
|
+
expired: "expired";
|
|
306
|
+
revoked: "revoked";
|
|
307
|
+
}>;
|
|
308
|
+
createdAt: z.ZodString;
|
|
309
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
310
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
311
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
312
|
+
}, z.core.$strip>>;
|
|
313
|
+
}, z.core.$strip>;
|
|
314
|
+
export declare const CreateAdminKeyInput: z.ZodObject<{
|
|
315
|
+
name: z.ZodString;
|
|
316
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
317
|
+
}, z.core.$strip>;
|
|
318
|
+
export declare const AdminKeyCreatedSchema: z.ZodObject<{
|
|
319
|
+
id: z.ZodString;
|
|
320
|
+
token: z.ZodString;
|
|
321
|
+
prefix: z.ZodString;
|
|
322
|
+
}, z.core.$strip>;
|
|
207
323
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB;;;;;;;;;iBAS5B,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;iBAMrB,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;iBAM1B,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;iBAAyD,CAAA;AAE3F;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;iBAejC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;iBAInC,CAAA;AAEF,uEAAuE;AACvE,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAA;AAEF,eAAO,MAAM,kBAAkB;;iBAE7B,CAAA;AAEF,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB;;iBAEjC,CAAA;AACF,eAAO,MAAM,oBAAoB;;iBAAiD,CAAA;AAClF,eAAO,MAAM,cAAc;;;;;;;;iBAA2C,CAAA;AACtE,eAAO,MAAM,mBAAmB;;;;;;;;iBAAqD,CAAA;AAIrF,eAAO,MAAM,UAAU;;;EAA8B,CAAA;AAErD,eAAO,MAAM,YAAY;;;;;;;;;iBAMvB,CAAA;AACF,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAA+C,CAAA;AAE5E,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB;;;;;;;iBAI5B,CAAA;AACF,eAAO,MAAM,kBAAkB;;;;;iBAG7B,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;iBAG5B,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;iBAM/B,CAAA;AACF,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAA;AAEF,eAAO,MAAM,QAAQ;;iBAAoC,CAAA;AAIzD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;iBAW3B,CAAA;AACF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;iBAAgD,CAAA;AAEjF,eAAO,MAAM,qBAAqB;;;;;;iBAMhC,CAAA;AACF,eAAO,MAAM,uBAAuB;;;;iBAIlC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;iBAAyC,CAAA;AAC7E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;mBAUrC,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;iBAQ3B,CAAA;AACF,eAAO,MAAM,eAAe;;;;;;;;;;iBAAmD,CAAA;AAI/E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;iBAUvB,CAAA;AACF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;iBAA4C,CAAA;AAEzE,eAAO,MAAM,iBAAiB;;;;iBAM5B,CAAA;AACF,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAA;AAIF,eAAO,MAAM,cAAc;;;;;;;;;;;;;iBASzB,CAAA;AACF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;iBAA8C,CAAA;AAE7E,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAA;AACF,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAA"}
|
|
@@ -14,6 +14,8 @@ export const ApplicationSchema = z.object({
|
|
|
14
14
|
clientId: z.string(),
|
|
15
15
|
name: z.string().nullable(),
|
|
16
16
|
app: z.string().nullable().describe("Application key; consumer workspace claims are filtered by this"),
|
|
17
|
+
allowSignup: z.boolean().describe("Whether unknown users may sign themselves up"),
|
|
18
|
+
permissions: z.array(z.string()).describe("The app's declared product-permission catalog"),
|
|
17
19
|
redirectUris: z.array(z.string()),
|
|
18
20
|
disabled: z.boolean(),
|
|
19
21
|
createdAt: z.string().describe("ISO 8601 timestamp"),
|
|
@@ -33,6 +35,43 @@ export const WorkspaceSchema = z.object({
|
|
|
33
35
|
createdAt: z.string(),
|
|
34
36
|
});
|
|
35
37
|
export const ApplicationListSchema = z.object({ applications: z.array(ApplicationSchema) });
|
|
38
|
+
/**
|
|
39
|
+
* Register an application. Superadmin only — there is no app to scope it to
|
|
40
|
+
* yet, so no per-app permission could authorize it.
|
|
41
|
+
*/
|
|
42
|
+
export const CreateApplicationInput = z.object({
|
|
43
|
+
name: z.string().min(1),
|
|
44
|
+
app: z
|
|
45
|
+
.string()
|
|
46
|
+
.min(1)
|
|
47
|
+
.regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, numbers and dashes only")
|
|
48
|
+
.describe("Stable application key — the join key for members, workspaces and keys"),
|
|
49
|
+
redirectUris: z.array(z.string().min(1)).min(1),
|
|
50
|
+
firstAdminUserId: z
|
|
51
|
+
.string()
|
|
52
|
+
.nullable()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("Who becomes the app's first IdP admin. Defaults to the calling user; null leaves the app with no members (superadmin-managed)."),
|
|
55
|
+
});
|
|
56
|
+
export const ApplicationCreatedSchema = z.object({
|
|
57
|
+
clientId: z.string(),
|
|
58
|
+
clientSecret: z.string().describe("Plaintext client secret — shown exactly once, never stored"),
|
|
59
|
+
app: z.string(),
|
|
60
|
+
});
|
|
61
|
+
/** Partial update of an application. Omitted fields are left alone. */
|
|
62
|
+
export const UpdateApplicationInput = z.object({
|
|
63
|
+
name: z.string().min(1).optional(),
|
|
64
|
+
redirectUris: z.array(z.string().min(1)).min(1).optional(),
|
|
65
|
+
allowSignup: z.boolean().optional(),
|
|
66
|
+
});
|
|
67
|
+
export const ClientSecretSchema = z.object({
|
|
68
|
+
clientSecret: z.string().describe("Plaintext client secret — shown exactly once, never stored"),
|
|
69
|
+
});
|
|
70
|
+
/** Replaces the app's product-permission catalog wholesale. */
|
|
71
|
+
export const SetAppPermissionsInput = z.object({
|
|
72
|
+
permissions: z.array(z.string().min(1)),
|
|
73
|
+
});
|
|
74
|
+
export const AppPermissionsSchema = z.object({ permissions: z.array(z.string()) });
|
|
36
75
|
export const UserListSchema = z.object({ users: z.array(UserSchema) });
|
|
37
76
|
export const WorkspaceListSchema = z.object({ workspaces: z.array(WorkspaceSchema) });
|
|
38
77
|
// --- Write management API (scoped-key authenticated, per-app) ---
|
|
@@ -120,3 +159,49 @@ export const AuditEntrySchema = z.object({
|
|
|
120
159
|
createdAt: z.string(),
|
|
121
160
|
});
|
|
122
161
|
export const AuditListSchema = z.object({ entries: z.array(AuditEntrySchema) });
|
|
162
|
+
// --- Scoped management API keys (drive this API for one app) ---
|
|
163
|
+
export const ApiKeySchema = z.object({
|
|
164
|
+
id: z.string(),
|
|
165
|
+
name: z.string(),
|
|
166
|
+
prefix: z.string().describe("Non-secret token prefix (wim_…) for display"),
|
|
167
|
+
permissions: z.array(z.string()).describe("IdP management permissions this key holds"),
|
|
168
|
+
status: z.enum(["active", "expired", "revoked"]),
|
|
169
|
+
createdAt: z.string(),
|
|
170
|
+
lastUsedAt: z.string().nullable(),
|
|
171
|
+
expiresAt: z.string().nullable(),
|
|
172
|
+
revokedAt: z.string().nullable(),
|
|
173
|
+
});
|
|
174
|
+
export const ApiKeyListSchema = z.object({ keys: z.array(ApiKeySchema) });
|
|
175
|
+
export const CreateApiKeyInput = z.object({
|
|
176
|
+
name: z.string().min(1),
|
|
177
|
+
permissions: z
|
|
178
|
+
.array(z.string().min(1))
|
|
179
|
+
.describe("IdP management permissions; must be a subset of the caller's own on this app"),
|
|
180
|
+
expiresAt: z.iso.datetime().optional().describe("ISO 8601; omit for non-expiring"),
|
|
181
|
+
});
|
|
182
|
+
export const ApiKeyCreatedSchema = z.object({
|
|
183
|
+
id: z.string(),
|
|
184
|
+
token: z.string().describe("Plaintext key — shown exactly once, never stored"),
|
|
185
|
+
prefix: z.string(),
|
|
186
|
+
});
|
|
187
|
+
// --- IdP-level admin keys (superadmin over every app) ---
|
|
188
|
+
export const AdminKeySchema = z.object({
|
|
189
|
+
id: z.string(),
|
|
190
|
+
name: z.string(),
|
|
191
|
+
prefix: z.string().describe("Non-secret token prefix (wim_…) for display"),
|
|
192
|
+
status: z.enum(["active", "expired", "revoked"]),
|
|
193
|
+
createdAt: z.string(),
|
|
194
|
+
lastUsedAt: z.string().nullable(),
|
|
195
|
+
expiresAt: z.string().nullable(),
|
|
196
|
+
revokedAt: z.string().nullable(),
|
|
197
|
+
});
|
|
198
|
+
export const AdminKeyListSchema = z.object({ keys: z.array(AdminKeySchema) });
|
|
199
|
+
export const CreateAdminKeyInput = z.object({
|
|
200
|
+
name: z.string().min(1).describe("Who holds it — one key per agent, so the audit log reads"),
|
|
201
|
+
expiresAt: z.iso.datetime().optional().describe("ISO 8601; omit for non-expiring"),
|
|
202
|
+
});
|
|
203
|
+
export const AdminKeyCreatedSchema = z.object({
|
|
204
|
+
id: z.string(),
|
|
205
|
+
token: z.string().describe("Plaintext key — shown exactly once, never stored"),
|
|
206
|
+
prefix: z.string(),
|
|
207
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/schemas/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/schemas/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqFH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;EA6B9D"}
|
|
@@ -16,7 +16,7 @@ import { lookup, operations } from "./operations.js";
|
|
|
16
16
|
*/
|
|
17
17
|
const json = (schema) => z.toJSONSchema(schema);
|
|
18
18
|
const jsonInput = (schema) => z.toJSONSchema(schema, { io: "input" });
|
|
19
|
-
const DESCRIPTION = "Management API for the willy.im identity provider. Authenticate with `Authorization: Bearer <token>`. Two kinds of token: the superadmin `ADMIN_API_TOKEN` (every app) and per-app **scoped API keys** minted in the admin console (one app, a fixed permission set). The cross-app
|
|
19
|
+
const DESCRIPTION = "Management API for the willy.im identity provider. Authenticate with `Authorization: Bearer <token>`. Two kinds of token: the superadmin `ADMIN_API_TOKEN` (every app) and per-app **scoped API keys** minted in the admin console (one app, a fixed permission set). The cross-app endpoints below require the superadmin token.";
|
|
20
20
|
function pathParamNames(path) {
|
|
21
21
|
return [...path.matchAll(/\{([^}]+)\}/g)].map((match) => match[1]);
|
|
22
22
|
}
|
|
@@ -74,6 +74,7 @@ function operationObject(method, path, def) {
|
|
|
74
74
|
"409": { description: "Conflict (already a member, last admin, slug taken, …)" },
|
|
75
75
|
}
|
|
76
76
|
: {}),
|
|
77
|
+
...(def.notFound ? { "404": { description: def.notFound } } : {}),
|
|
77
78
|
...(def.input ? { "422": { description: "Body failed validation" } } : {}),
|
|
78
79
|
},
|
|
79
80
|
};
|
|
@@ -26,6 +26,8 @@ export type OperationDef = {
|
|
|
26
26
|
query?: readonly QueryParam[];
|
|
27
27
|
/** Path-parameter descriptions, keyed by name. Purely documentation. */
|
|
28
28
|
params?: Readonly<Record<string, string>>;
|
|
29
|
+
/** Set when the operation addresses a single row that may not exist. */
|
|
30
|
+
notFound?: string;
|
|
29
31
|
input?: z.ZodType;
|
|
30
32
|
successCode: "200" | "201";
|
|
31
33
|
success: z.ZodType;
|
|
@@ -39,12 +41,215 @@ export declare const operations: {
|
|
|
39
41
|
clientId: z.ZodString;
|
|
40
42
|
name: z.ZodNullable<z.ZodString>;
|
|
41
43
|
app: z.ZodNullable<z.ZodString>;
|
|
44
|
+
allowSignup: z.ZodBoolean;
|
|
45
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
42
46
|
redirectUris: z.ZodArray<z.ZodString>;
|
|
43
47
|
disabled: z.ZodBoolean;
|
|
44
48
|
createdAt: z.ZodString;
|
|
45
49
|
}, z.core.$strip>>;
|
|
46
50
|
}, z.core.$strip>;
|
|
47
51
|
};
|
|
52
|
+
readonly "post /api/v1/applications": {
|
|
53
|
+
readonly summary: "Register an application (client secret returned once)";
|
|
54
|
+
readonly description: "Requires the superadmin token. Creating an application is an IdP-level act — there is no app to scope a permission to yet.";
|
|
55
|
+
readonly input: z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
app: z.ZodString;
|
|
58
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
59
|
+
firstAdminUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
readonly successCode: "201";
|
|
62
|
+
readonly success: z.ZodObject<{
|
|
63
|
+
clientId: z.ZodString;
|
|
64
|
+
clientSecret: z.ZodString;
|
|
65
|
+
app: z.ZodString;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
};
|
|
68
|
+
readonly "get /api/v1/applications/{clientId}": {
|
|
69
|
+
readonly summary: "Get one application";
|
|
70
|
+
readonly permission: "app:read";
|
|
71
|
+
readonly params: {
|
|
72
|
+
readonly clientId: "OAuth client id of the application.";
|
|
73
|
+
};
|
|
74
|
+
readonly notFound: "No application with that client id";
|
|
75
|
+
readonly successCode: "200";
|
|
76
|
+
readonly success: z.ZodObject<{
|
|
77
|
+
clientId: z.ZodString;
|
|
78
|
+
name: z.ZodNullable<z.ZodString>;
|
|
79
|
+
app: z.ZodNullable<z.ZodString>;
|
|
80
|
+
allowSignup: z.ZodBoolean;
|
|
81
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
82
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
83
|
+
disabled: z.ZodBoolean;
|
|
84
|
+
createdAt: z.ZodString;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
};
|
|
87
|
+
readonly "patch /api/v1/applications/{clientId}": {
|
|
88
|
+
readonly summary: "Update an application";
|
|
89
|
+
readonly permission: "app:update";
|
|
90
|
+
readonly params: {
|
|
91
|
+
readonly clientId: "OAuth client id of the application.";
|
|
92
|
+
};
|
|
93
|
+
readonly notFound: "No application with that client id";
|
|
94
|
+
readonly input: z.ZodObject<{
|
|
95
|
+
name: z.ZodOptional<z.ZodString>;
|
|
96
|
+
redirectUris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
97
|
+
allowSignup: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
readonly successCode: "200";
|
|
100
|
+
readonly success: z.ZodObject<{
|
|
101
|
+
clientId: z.ZodString;
|
|
102
|
+
name: z.ZodNullable<z.ZodString>;
|
|
103
|
+
app: z.ZodNullable<z.ZodString>;
|
|
104
|
+
allowSignup: z.ZodBoolean;
|
|
105
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
106
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
107
|
+
disabled: z.ZodBoolean;
|
|
108
|
+
createdAt: z.ZodString;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
};
|
|
111
|
+
readonly "delete /api/v1/applications/{clientId}": {
|
|
112
|
+
readonly summary: "Deregister an application";
|
|
113
|
+
readonly permission: "app:delete";
|
|
114
|
+
readonly params: {
|
|
115
|
+
readonly clientId: "OAuth client id of the application.";
|
|
116
|
+
};
|
|
117
|
+
readonly notFound: "No application with that client id";
|
|
118
|
+
readonly successCode: "200";
|
|
119
|
+
readonly success: z.ZodObject<{
|
|
120
|
+
ok: z.ZodLiteral<true>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
};
|
|
123
|
+
readonly "post /api/v1/applications/{clientId}/rotate-secret": {
|
|
124
|
+
readonly summary: "Rotate the client secret (returned once; the old one stops working)";
|
|
125
|
+
readonly permission: "app:update";
|
|
126
|
+
readonly params: {
|
|
127
|
+
readonly clientId: "OAuth client id of the application.";
|
|
128
|
+
};
|
|
129
|
+
readonly notFound: "No application with that client id";
|
|
130
|
+
readonly successCode: "200";
|
|
131
|
+
readonly success: z.ZodObject<{
|
|
132
|
+
clientSecret: z.ZodString;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
};
|
|
135
|
+
readonly "put /api/v1/apps/{app}/permissions": {
|
|
136
|
+
readonly summary: "Replace the app's product-permission catalog";
|
|
137
|
+
readonly permission: "app:update";
|
|
138
|
+
readonly params: {
|
|
139
|
+
readonly app: "Application key (oauth_client.metadata.app).";
|
|
140
|
+
};
|
|
141
|
+
readonly notFound: "No application with that app key";
|
|
142
|
+
readonly input: z.ZodObject<{
|
|
143
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
readonly successCode: "200";
|
|
146
|
+
readonly success: z.ZodObject<{
|
|
147
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
};
|
|
150
|
+
readonly "get /api/v1/apps/{app}/keys": {
|
|
151
|
+
readonly summary: "List scoped management API keys (never the hashes)";
|
|
152
|
+
readonly permission: "apikey:read";
|
|
153
|
+
readonly params: {
|
|
154
|
+
readonly app: "Application key (oauth_client.metadata.app).";
|
|
155
|
+
};
|
|
156
|
+
readonly successCode: "200";
|
|
157
|
+
readonly success: z.ZodObject<{
|
|
158
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
name: z.ZodString;
|
|
161
|
+
prefix: z.ZodString;
|
|
162
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
163
|
+
status: z.ZodEnum<{
|
|
164
|
+
active: "active";
|
|
165
|
+
expired: "expired";
|
|
166
|
+
revoked: "revoked";
|
|
167
|
+
}>;
|
|
168
|
+
createdAt: z.ZodString;
|
|
169
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
170
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
171
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
}, z.core.$strip>;
|
|
174
|
+
};
|
|
175
|
+
readonly "post /api/v1/apps/{app}/keys": {
|
|
176
|
+
readonly summary: "Mint a scoped management API key (plaintext returned once)";
|
|
177
|
+
readonly description: "Requires `apikey:create` on the path app (or the superadmin token). The requested permissions must be a subset of the caller's own, otherwise 403 `permissions_exceed_caller` — without that rule any key holding `apikey:create` could mint itself a more powerful successor.";
|
|
178
|
+
readonly permission: "apikey:create";
|
|
179
|
+
readonly params: {
|
|
180
|
+
readonly app: "Application key (oauth_client.metadata.app).";
|
|
181
|
+
};
|
|
182
|
+
readonly input: z.ZodObject<{
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
185
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
readonly successCode: "201";
|
|
188
|
+
readonly success: z.ZodObject<{
|
|
189
|
+
id: z.ZodString;
|
|
190
|
+
token: z.ZodString;
|
|
191
|
+
prefix: z.ZodString;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
};
|
|
194
|
+
readonly "delete /api/v1/apps/{app}/keys/{id}": {
|
|
195
|
+
readonly summary: "Revoke a scoped management API key (idempotent)";
|
|
196
|
+
readonly permission: "apikey:revoke";
|
|
197
|
+
readonly params: {
|
|
198
|
+
readonly app: "Application key (oauth_client.metadata.app).";
|
|
199
|
+
};
|
|
200
|
+
readonly notFound: "No key with that id on this app";
|
|
201
|
+
readonly successCode: "200";
|
|
202
|
+
readonly success: z.ZodObject<{
|
|
203
|
+
ok: z.ZodLiteral<true>;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
};
|
|
206
|
+
readonly "get /api/v1/admin-keys": {
|
|
207
|
+
readonly summary: "List IdP-level admin keys (never the hashes)";
|
|
208
|
+
readonly description: "Requires the superadmin token or an admin key. Admin keys are `api_key` rows with no application scope, so they hold every permission on every app.";
|
|
209
|
+
readonly successCode: "200";
|
|
210
|
+
readonly success: z.ZodObject<{
|
|
211
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
212
|
+
id: z.ZodString;
|
|
213
|
+
name: z.ZodString;
|
|
214
|
+
prefix: z.ZodString;
|
|
215
|
+
status: z.ZodEnum<{
|
|
216
|
+
active: "active";
|
|
217
|
+
expired: "expired";
|
|
218
|
+
revoked: "revoked";
|
|
219
|
+
}>;
|
|
220
|
+
createdAt: z.ZodString;
|
|
221
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
222
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
223
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
224
|
+
}, z.core.$strip>>;
|
|
225
|
+
}, z.core.$strip>;
|
|
226
|
+
};
|
|
227
|
+
readonly "post /api/v1/admin-keys": {
|
|
228
|
+
readonly summary: "Mint an IdP-level admin key (plaintext returned once)";
|
|
229
|
+
readonly description: "Requires the superadmin token or an admin key. Mint one per agent: unlike the static ADMIN_API_TOKEN, an admin key has a name, an optional expiry, a revoke switch, and its own `adminkey:<id>` identity in the audit log.";
|
|
230
|
+
readonly input: z.ZodObject<{
|
|
231
|
+
name: z.ZodString;
|
|
232
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
readonly successCode: "201";
|
|
235
|
+
readonly success: z.ZodObject<{
|
|
236
|
+
id: z.ZodString;
|
|
237
|
+
token: z.ZodString;
|
|
238
|
+
prefix: z.ZodString;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
};
|
|
241
|
+
readonly "delete /api/v1/admin-keys/{id}": {
|
|
242
|
+
readonly summary: "Revoke an IdP-level admin key (idempotent)";
|
|
243
|
+
readonly description: "A key may revoke itself — an agent cleaning up after itself is legitimate — after which its next request is simply unauthorized.";
|
|
244
|
+
readonly params: {
|
|
245
|
+
readonly id: "Admin key id.";
|
|
246
|
+
};
|
|
247
|
+
readonly notFound: "No admin key with that id";
|
|
248
|
+
readonly successCode: "200";
|
|
249
|
+
readonly success: z.ZodObject<{
|
|
250
|
+
ok: z.ZodLiteral<true>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
};
|
|
48
253
|
readonly "get /api/v1/users": {
|
|
49
254
|
readonly summary: "List users";
|
|
50
255
|
readonly successCode: "200";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/schemas/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/schemas/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkCvB,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEpE,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAEnF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAA;IAC7B,wEAAwE;IACxE,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACzC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;IACjB,WAAW,EAAE,KAAK,GAAG,KAAK,CAAA;IAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,CAAA;CACnB,CAAA;AAKD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6M0B,CAAA;AAEjD,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAA;AAC1C,MAAM,MAAM,YAAY,GAAG,MAAM,UAAU,CAAA;AAE3C,mEAAmE;AACnE,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,UAAU,IAAI,YAAY,SAAS,MAAM,CAAC,GACrE,CAAC,SAAS,GAAG,CAAC,IAAI,MAAM,CAAC,EAAE,GACzB,CAAC,GACD,KAAK,GACP,KAAK,CAAA;AAET,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,YAAY,GAC/F,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GACvB,KAAK,CAAA;AAET,iFAAiF;AACjF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GAC5F,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,GAC3B,KAAK,CAAA;AAET,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAE7E"}
|
|
@@ -8,14 +8,109 @@
|
|
|
8
8
|
* needs to learn about it.
|
|
9
9
|
*/
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import { ApplicationListSchema, AuditListSchema, CreateUserApiKeyInput, CreateWorkspaceInput, InviteMemberInput, InviteMemberResult, MemberListSchema, OkSchema, UpdateMemberInput, UserApiKeyCreatedSchema, UserApiKeyListSchema, UserApiKeyValidationSchema, UserListSchema, ValidateUserApiKeyInput, WorkspaceCreatedSchema, WorkspaceListSchema, } from "./index.js";
|
|
11
|
+
import { AdminKeyCreatedSchema, AdminKeyListSchema, ApiKeyCreatedSchema, ApiKeyListSchema, ApplicationCreatedSchema, ApplicationListSchema, ApplicationSchema, AppPermissionsSchema, AuditListSchema, ClientSecretSchema, CreateAdminKeyInput, CreateApiKeyInput, CreateApplicationInput, CreateUserApiKeyInput, CreateWorkspaceInput, InviteMemberInput, InviteMemberResult, MemberListSchema, OkSchema, SetAppPermissionsInput, UpdateApplicationInput, UpdateMemberInput, UserApiKeyCreatedSchema, UserApiKeyListSchema, UserApiKeyValidationSchema, UserListSchema, ValidateUserApiKeyInput, WorkspaceCreatedSchema, WorkspaceListSchema, } from "./index.js";
|
|
12
12
|
const APP_PARAM = { app: "Application key (oauth_client.metadata.app)." };
|
|
13
|
+
const CLIENT_PARAM = { clientId: "OAuth client id of the application." };
|
|
13
14
|
export const operations = {
|
|
14
15
|
"get /api/v1/applications": {
|
|
15
16
|
summary: "List registered applications",
|
|
16
17
|
successCode: "200",
|
|
17
18
|
success: ApplicationListSchema,
|
|
18
19
|
},
|
|
20
|
+
"post /api/v1/applications": {
|
|
21
|
+
summary: "Register an application (client secret returned once)",
|
|
22
|
+
description: "Requires the superadmin token. Creating an application is an IdP-level act — there is no app to scope a permission to yet.",
|
|
23
|
+
input: CreateApplicationInput,
|
|
24
|
+
successCode: "201",
|
|
25
|
+
success: ApplicationCreatedSchema,
|
|
26
|
+
},
|
|
27
|
+
"get /api/v1/applications/{clientId}": {
|
|
28
|
+
summary: "Get one application",
|
|
29
|
+
permission: "app:read",
|
|
30
|
+
params: CLIENT_PARAM,
|
|
31
|
+
notFound: "No application with that client id",
|
|
32
|
+
successCode: "200",
|
|
33
|
+
success: ApplicationSchema,
|
|
34
|
+
},
|
|
35
|
+
"patch /api/v1/applications/{clientId}": {
|
|
36
|
+
summary: "Update an application",
|
|
37
|
+
permission: "app:update",
|
|
38
|
+
params: CLIENT_PARAM,
|
|
39
|
+
notFound: "No application with that client id",
|
|
40
|
+
input: UpdateApplicationInput,
|
|
41
|
+
successCode: "200",
|
|
42
|
+
success: ApplicationSchema,
|
|
43
|
+
},
|
|
44
|
+
"delete /api/v1/applications/{clientId}": {
|
|
45
|
+
summary: "Deregister an application",
|
|
46
|
+
permission: "app:delete",
|
|
47
|
+
params: CLIENT_PARAM,
|
|
48
|
+
notFound: "No application with that client id",
|
|
49
|
+
successCode: "200",
|
|
50
|
+
success: OkSchema,
|
|
51
|
+
},
|
|
52
|
+
"post /api/v1/applications/{clientId}/rotate-secret": {
|
|
53
|
+
summary: "Rotate the client secret (returned once; the old one stops working)",
|
|
54
|
+
permission: "app:update",
|
|
55
|
+
params: CLIENT_PARAM,
|
|
56
|
+
notFound: "No application with that client id",
|
|
57
|
+
successCode: "200",
|
|
58
|
+
success: ClientSecretSchema,
|
|
59
|
+
},
|
|
60
|
+
"put /api/v1/apps/{app}/permissions": {
|
|
61
|
+
summary: "Replace the app's product-permission catalog",
|
|
62
|
+
permission: "app:update",
|
|
63
|
+
params: APP_PARAM,
|
|
64
|
+
notFound: "No application with that app key",
|
|
65
|
+
input: SetAppPermissionsInput,
|
|
66
|
+
successCode: "200",
|
|
67
|
+
success: AppPermissionsSchema,
|
|
68
|
+
},
|
|
69
|
+
"get /api/v1/apps/{app}/keys": {
|
|
70
|
+
summary: "List scoped management API keys (never the hashes)",
|
|
71
|
+
permission: "apikey:read",
|
|
72
|
+
params: APP_PARAM,
|
|
73
|
+
successCode: "200",
|
|
74
|
+
success: ApiKeyListSchema,
|
|
75
|
+
},
|
|
76
|
+
"post /api/v1/apps/{app}/keys": {
|
|
77
|
+
summary: "Mint a scoped management API key (plaintext returned once)",
|
|
78
|
+
description: "Requires `apikey:create` on the path app (or the superadmin token). The requested permissions must be a subset of the caller's own, otherwise 403 `permissions_exceed_caller` — without that rule any key holding `apikey:create` could mint itself a more powerful successor.",
|
|
79
|
+
permission: "apikey:create",
|
|
80
|
+
params: APP_PARAM,
|
|
81
|
+
input: CreateApiKeyInput,
|
|
82
|
+
successCode: "201",
|
|
83
|
+
success: ApiKeyCreatedSchema,
|
|
84
|
+
},
|
|
85
|
+
"delete /api/v1/apps/{app}/keys/{id}": {
|
|
86
|
+
summary: "Revoke a scoped management API key (idempotent)",
|
|
87
|
+
permission: "apikey:revoke",
|
|
88
|
+
params: APP_PARAM,
|
|
89
|
+
notFound: "No key with that id on this app",
|
|
90
|
+
successCode: "200",
|
|
91
|
+
success: OkSchema,
|
|
92
|
+
},
|
|
93
|
+
"get /api/v1/admin-keys": {
|
|
94
|
+
summary: "List IdP-level admin keys (never the hashes)",
|
|
95
|
+
description: "Requires the superadmin token or an admin key. Admin keys are `api_key` rows with no application scope, so they hold every permission on every app.",
|
|
96
|
+
successCode: "200",
|
|
97
|
+
success: AdminKeyListSchema,
|
|
98
|
+
},
|
|
99
|
+
"post /api/v1/admin-keys": {
|
|
100
|
+
summary: "Mint an IdP-level admin key (plaintext returned once)",
|
|
101
|
+
description: "Requires the superadmin token or an admin key. Mint one per agent: unlike the static ADMIN_API_TOKEN, an admin key has a name, an optional expiry, a revoke switch, and its own `adminkey:<id>` identity in the audit log.",
|
|
102
|
+
input: CreateAdminKeyInput,
|
|
103
|
+
successCode: "201",
|
|
104
|
+
success: AdminKeyCreatedSchema,
|
|
105
|
+
},
|
|
106
|
+
"delete /api/v1/admin-keys/{id}": {
|
|
107
|
+
summary: "Revoke an IdP-level admin key (idempotent)",
|
|
108
|
+
description: "A key may revoke itself — an agent cleaning up after itself is legitimate — after which its next request is simply unauthorized.",
|
|
109
|
+
params: { id: "Admin key id." },
|
|
110
|
+
notFound: "No admin key with that id",
|
|
111
|
+
successCode: "200",
|
|
112
|
+
success: OkSchema,
|
|
113
|
+
},
|
|
19
114
|
"get /api/v1/users": {
|
|
20
115
|
summary: "List users",
|
|
21
116
|
successCode: "200",
|