@willyim/idp 0.2.0 → 0.3.1
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 +27 -0
- package/dist/src/api.d.ts +1 -1
- package/dist/src/api.d.ts.map +1 -1
- 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 +5 -4
- 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 +1112 -16
- package/package.json +1 -1
|
@@ -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 an admin key. 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 an admin key). 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 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 an admin key. Mint one per agent: an admin key has a name, an optional expiry, a revoke switch, and its own `adminkey:<id>` identity in the audit log, so every superadmin action is attributable.",
|
|
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",
|