@atlasauth/backend 0.14.1 → 0.15.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/CHANGELOG.md +23 -0
- package/dist/access-control.d.ts +53 -0
- package/dist/access-control.js +46 -0
- package/dist/access-control.js.map +1 -0
- package/dist/algs.d.ts +7 -0
- package/dist/algs.js +11 -0
- package/dist/algs.js.map +1 -0
- package/dist/client/api-keys.d.ts +49 -4
- package/dist/client/api-keys.js +6 -2
- package/dist/client/api-keys.js.map +1 -1
- package/dist/client/app-roles.d.ts +76 -0
- package/dist/client/app-roles.js +39 -0
- package/dist/client/app-roles.js.map +1 -0
- package/dist/client/email-templates.d.ts +1 -1
- package/dist/client/email-templates.js.map +1 -1
- package/dist/client/index.d.ts +49 -3
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/instance-security.d.ts +34 -0
- package/dist/client/instance-security.js +8 -0
- package/dist/client/instance-security.js.map +1 -1
- package/dist/client/notifications.d.ts +1 -1
- package/dist/client/notifications.js.map +1 -1
- package/dist/client/oauth-clients.d.ts +57 -2
- package/dist/client/oauth-clients.js +13 -0
- package/dist/client/oauth-clients.js.map +1 -1
- package/dist/client/referrals.d.ts +1 -1
- package/dist/client/resource-servers.d.ts +12 -3
- package/dist/client/resource-servers.js.map +1 -1
- package/dist/client/scim-tokens.d.ts +18 -0
- package/dist/client/scim-tokens.js +4 -0
- package/dist/client/scim-tokens.js.map +1 -1
- package/dist/client/sso-connections.d.ts +22 -0
- package/dist/client/sso-connections.js.map +1 -1
- package/dist/client/users.d.ts +40 -4
- package/dist/client/users.js +8 -3
- package/dist/client/users.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/logout-token.d.ts +1 -1
- package/dist/logout-token.js +3 -2
- package/dist/logout-token.js.map +1 -1
- package/dist/oauth-resource.d.ts +145 -0
- package/dist/oauth-resource.js +294 -0
- package/dist/oauth-resource.js.map +1 -0
- package/dist/oidc.d.ts +1 -1
- package/dist/oidc.js +5 -3
- package/dist/oidc.js.map +1 -1
- package/dist/referral-test-calls.d.ts +7 -7
- package/dist/referral-test-calls.js +2 -2
- package/dist/testing.d.ts +6 -4
- package/dist/testing.js +7 -6
- package/dist/testing.js.map +1 -1
- package/dist/verify.d.ts +11 -0
- package/dist/verify.js +15 -1
- package/dist/verify.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlasauth/backend changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.0 — 2026-10-23
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `createAccessTokenVerifier` / `verifyAccessToken`: verify Atlas-issued OAuth access tokens in your own API or MCP server — signature against the instance JWKS, issuer, expiry, access-token type, audience (RFC 8707), required scopes (scope + permissions) and DPoP sender constraint (RFC 9449, with a replay store). Failures return the status and the RFC 6750 / RFC 9728 `WWW-Authenticate` challenge (`resource_metadata`, `insufficient_scope`).
|
|
8
|
+
- `protectedResourceMetadata` / `protectedResourceMetadataPath`: build and locate your API's RFC 9728 protected-resource metadata document.
|
|
9
|
+
- `buildWwwAuthenticate`, `memoryDpopReplayStore`.
|
|
10
|
+
- `createTestIssuer({ alg: 'ES256' })`: an ES256 test key, like an instance switched to ES256.
|
|
11
|
+
- Backend API client: `instanceSecurity.listSigningKeys()` / `rotateSigningKey({ alg, grace_period_seconds, emergency })`; `oauthClients.initialAccessTokens.list()` / `create()` / `revoke()` (RFC 7591 §3); OAuth client fields `subject_type`, `sector_identifier_uri`, `client_secret_expires_at`, `disabled`, `require_pkce` and `secret_expires_in_seconds` on create / rotate; resource server `publish_resource_metadata` and a typed `signing_alg`.
|
|
12
|
+
- `users.list({ external_id })`: find a user by the id it had in the system it was migrated from.
|
|
13
|
+
- User search: `users.list()` takes `query`, `email_address`, `username`, `phone_number`, `banned`, `email_verified`, `organization_id`, `created_after` / `created_before`, `order_by`, `offset` and `include_total_count` (the page then carries `total_count`).
|
|
14
|
+
- Timed bans: `users.ban(id, { reason, note, expires_in_seconds, expires_at })`; `User.ban_expires_at`.
|
|
15
|
+
- App roles (instance-wide, no active organization needed): `appRoles.list()` / `create()` / `get()` / `update()` / `delete()` / `listUsers()` / `getForUser()` / `setForUser()` / `removeFromUser()`; `SessionClaims.app_roles` / `app_permissions` with `hasAppRole()` / `hasAppPermission()`.
|
|
16
|
+
- `createAccessControl(statements)`: typed resource/action statements for app roles — `permission()`, `permissions()`, `allPermissions()`, `role()` (a definition ready for `appRoles.create`), and `can()` / `canAny()` against session claims.
|
|
17
|
+
- API key controls: create / update bodies take `enabled`, `rate_limit` (`ApiKeyRateLimit`), `remaining`, and create also `prefix` and `expires_in_seconds`; `apiKeys.verify(secret, { required_scopes })` and a coded refusal of a live key (`insufficient_scope`, `rate_limited`, `usage_exhausted`, with `missing_scopes`, `retry_after_ms`, `remaining`).
|
|
18
|
+
- SCIM tokens: `scopes` and `role_mappings` on create, and `scimTokens.update()`.
|
|
19
|
+
- SSO connections: `attribute_mapping` (`SsoAttributeMapping`) and `oidc_scopes`; `domain_warnings` on the connection.
|
|
20
|
+
- Email template keys `email_changed`, `verification_link`, `password_reset_link`; notification `email_changed`.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Every verifier (`AtlasBackend.verify`, the OIDC relying-party helpers, `verifyLogoutToken`, `createAccessTokenVerifier`) accepts ES256 as well as RS256, since an Atlas instance — or a single API — can now sign with ES256. Verification stays pinned to those two algorithms; `none`, HMAC and anything else are refused.
|
|
25
|
+
|
|
3
26
|
## 0.14.1
|
|
4
27
|
|
|
5
28
|
### Added
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SessionClaims } from './verify';
|
|
2
|
+
/**
|
|
3
|
+
* Typed access-control definitions for app-level roles.
|
|
4
|
+
*
|
|
5
|
+
* Declare your resources and their actions once; the result gives you
|
|
6
|
+
* type-checked permission keys (`tickets:read`), role definitions you can send
|
|
7
|
+
* to `atlas.appRoles.create`, and checks against a verified session's
|
|
8
|
+
* `app_permissions` claim — so a typo in a permission is a compile error, not a
|
|
9
|
+
* silent deny.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const ac = createAccessControl({
|
|
13
|
+
* tickets: ['read', 'write', 'close'],
|
|
14
|
+
* billing: ['read', 'refund'],
|
|
15
|
+
* } as const);
|
|
16
|
+
*
|
|
17
|
+
* const support = ac.role('support', 'Support agent', { tickets: ['read', 'write'] });
|
|
18
|
+
* await atlas.appRoles.create(support); // { key, name, permissions: [...] }
|
|
19
|
+
*
|
|
20
|
+
* if (!ac.can(claims, { tickets: ['close'] })) return forbidden();
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export type AccessStatements = Readonly<Record<string, readonly string[]>>;
|
|
24
|
+
/** Every `resource:action` key a statement set allows. */
|
|
25
|
+
export type PermissionOf<S extends AccessStatements> = {
|
|
26
|
+
[R in keyof S & string]: `${R}:${S[R][number]}`;
|
|
27
|
+
}[keyof S & string];
|
|
28
|
+
/** A partial grant: some actions on some resources. */
|
|
29
|
+
export type AccessGrant<S extends AccessStatements> = {
|
|
30
|
+
[R in keyof S]?: ReadonlyArray<S[R][number]>;
|
|
31
|
+
};
|
|
32
|
+
export interface AppRoleDefinition<S extends AccessStatements> {
|
|
33
|
+
key: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
permissions: Array<PermissionOf<S>>;
|
|
37
|
+
}
|
|
38
|
+
export interface AccessControl<S extends AccessStatements> {
|
|
39
|
+
readonly statements: S;
|
|
40
|
+
/** One typed permission key. */
|
|
41
|
+
permission<R extends keyof S & string>(resource: R, action: S[R][number]): PermissionOf<S>;
|
|
42
|
+
/** Flatten a grant into sorted permission keys. */
|
|
43
|
+
permissions(grant: AccessGrant<S>): Array<PermissionOf<S>>;
|
|
44
|
+
/** Every permission the statements define. */
|
|
45
|
+
allPermissions(): Array<PermissionOf<S>>;
|
|
46
|
+
/** An app role definition (the body `appRoles.create` takes). */
|
|
47
|
+
role(key: string, name: string, grant: AccessGrant<S>, description?: string): AppRoleDefinition<S>;
|
|
48
|
+
/** Whether the verified claims hold EVERY permission in the grant (from `app_permissions`). */
|
|
49
|
+
can(claims: SessionClaims | null | undefined, grant: AccessGrant<S>): boolean;
|
|
50
|
+
/** Whether the verified claims hold AT LEAST ONE permission in the grant. */
|
|
51
|
+
canAny(claims: SessionClaims | null | undefined, grant: AccessGrant<S>): boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare function createAccessControl<const S extends AccessStatements>(statements: S): AccessControl<S>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAccessControl = createAccessControl;
|
|
4
|
+
const authz_1 = require("@atlasauth/authz");
|
|
5
|
+
function createAccessControl(statements) {
|
|
6
|
+
for (const [resource, actions] of Object.entries(statements)) {
|
|
7
|
+
if (!/^[a-z][a-z0-9_]{0,63}$/.test(resource) || resource === 'org') {
|
|
8
|
+
throw new Error(`Invalid resource "${resource}": lowercase letters, digits and _, not "org".`);
|
|
9
|
+
}
|
|
10
|
+
for (const action of actions) {
|
|
11
|
+
if (!/^[a-z*][a-z0-9_*]{0,63}$/.test(action))
|
|
12
|
+
throw new Error(`Invalid action "${action}" on "${resource}".`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const permissions = (grant) => {
|
|
16
|
+
const out = new Set();
|
|
17
|
+
for (const [resource, actions] of Object.entries(grant)) {
|
|
18
|
+
const allowed = statements[resource];
|
|
19
|
+
if (!allowed)
|
|
20
|
+
throw new Error(`Unknown resource "${resource}".`);
|
|
21
|
+
for (const action of actions ?? []) {
|
|
22
|
+
if (!allowed.includes(action))
|
|
23
|
+
throw new Error(`Unknown action "${action}" on "${resource}".`);
|
|
24
|
+
out.add(`${resource}:${action}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return [...out].sort();
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
statements,
|
|
31
|
+
permission: (resource, action) => `${resource}:${String(action)}`,
|
|
32
|
+
permissions,
|
|
33
|
+
allPermissions: () => Object.entries(statements)
|
|
34
|
+
.flatMap(([r, actions]) => actions.map((a) => `${r}:${a}`))
|
|
35
|
+
.sort(),
|
|
36
|
+
role: (key, name, grant, description) => ({
|
|
37
|
+
key,
|
|
38
|
+
name,
|
|
39
|
+
...(description !== undefined ? { description } : {}),
|
|
40
|
+
permissions: permissions(grant),
|
|
41
|
+
}),
|
|
42
|
+
can: (claims, grant) => (0, authz_1.hasFromClaims)(claims, { allAppPermissions: permissions(grant) }),
|
|
43
|
+
canAny: (claims, grant) => (0, authz_1.hasFromClaims)(claims, { anyAppPermission: permissions(grant) }),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=access-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-control.js","sourceRoot":"","sources":["../src/access-control.ts"],"names":[],"mappings":";;AAyDA,kDAwCC;AAjGD,4CAAiD;AAyDjD,SAAgB,mBAAmB,CAAmC,UAAa;IACjF,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,gDAAgD,CAAC,CAAC;QACjG,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,SAAS,Q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WAAW,EAAE,EAAE,CAAC,CAAC;YACxC,GAAG;YACH,IAAI;YACJ,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC;SAChC,CAAC;QACF,GAAG,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,MAAM,EAAE,EAAE,iBAAiB,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACxF,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,MAAM,EAAE,EAAE,gBAAgB,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;KAC3F,CAAC;AACJ,CAAC"}
|
package/dist/algs.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JWS algorithms Atlas signs tokens with. An instance key is RS256 (the
|
|
3
|
+
* default) or ES256; APIs may be set to either. Verification is pinned to this
|
|
4
|
+
* list — `none` and HMAC never verify — and the token's `kid` selects exactly
|
|
5
|
+
* one published key, whose type fixes which of the two applies.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ATLAS_SIGNING_ALGS: string[];
|
package/dist/algs.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ATLAS_SIGNING_ALGS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The JWS algorithms Atlas signs tokens with. An instance key is RS256 (the
|
|
6
|
+
* default) or ES256; APIs may be set to either. Verification is pinned to this
|
|
7
|
+
* list — `none` and HMAC never verify — and the token's `kid` selects exactly
|
|
8
|
+
* one published key, whose type fixes which of the two applies.
|
|
9
|
+
*/
|
|
10
|
+
exports.ATLAS_SIGNING_ALGS = ['RS256', 'ES256'];
|
|
11
|
+
//# sourceMappingURL=algs.js.map
|
package/dist/algs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algs.js","sourceRoot":"","sources":["../src/algs.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACU,QAAA,kBAAkB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -20,11 +20,31 @@ export interface ApiKey {
|
|
|
20
20
|
limits?: ApiKeyLimit[] | null;
|
|
21
21
|
/** Each cap with its current-window usage (empty when the key has no caps). */
|
|
22
22
|
usage?: ApiKeyLimitState[];
|
|
23
|
+
/** A disabled key fails verify until re-enabled (it is not revoked). */
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
/** Per-key verify rate limit, or null. */
|
|
26
|
+
rate_limit?: ApiKeyRateLimit | null;
|
|
27
|
+
/** Uses left (each successful verify spends one); null = unlimited. */
|
|
28
|
+
remaining?: number | null;
|
|
23
29
|
last_used_at: number | null;
|
|
24
30
|
expires_at: number | null;
|
|
25
31
|
revoked_at: number | null;
|
|
26
32
|
created_at: number;
|
|
27
33
|
}
|
|
34
|
+
/** At most `max` successful verifies per `window_seconds`. */
|
|
35
|
+
export interface ApiKeyRateLimit {
|
|
36
|
+
max: number;
|
|
37
|
+
window_seconds: number;
|
|
38
|
+
}
|
|
39
|
+
/** Controls shared by create and update. */
|
|
40
|
+
export interface ApiKeyControls {
|
|
41
|
+
/** Default true. A disabled key fails verify and cannot mint tokens. */
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
/** Per-key verify rate limit; null removes it. */
|
|
44
|
+
rate_limit?: ApiKeyRateLimit | null;
|
|
45
|
+
/** Uses left; null = unlimited. */
|
|
46
|
+
remaining?: number | null;
|
|
47
|
+
}
|
|
28
48
|
/** The window a spend cap counts over. `request` caps a single debit; `day`/`month` are UTC calendar windows; `total` never resets. */
|
|
29
49
|
export type ApiKeyLimitPeriod = 'request' | 'day' | 'month' | 'total';
|
|
30
50
|
/** A per-key spend cap, metered with {@link apiKeysResource} `recordUsage`. */
|
|
@@ -103,17 +123,21 @@ export interface ApiKeyWithSecret extends ApiKey {
|
|
|
103
123
|
secret: string;
|
|
104
124
|
note: string;
|
|
105
125
|
}
|
|
106
|
-
export interface CreateApiKeyBody {
|
|
126
|
+
export interface CreateApiKeyBody extends ApiKeyControls {
|
|
107
127
|
subject_type: ApiKeySubjectType;
|
|
108
128
|
subject_id: string;
|
|
109
129
|
name?: string;
|
|
110
130
|
claims?: Record<string, unknown>;
|
|
111
|
-
/** Epoch ms; null (
|
|
131
|
+
/** Epoch ms; null never expires (omitted: the instance default lifetime, if any). */
|
|
112
132
|
expires_at?: number | null;
|
|
133
|
+
/** Relative expiry; mutually exclusive with `expires_at`. */
|
|
134
|
+
expires_in_seconds?: number;
|
|
135
|
+
/** Custom secret prefix (e.g. `acme` gives `acme_<id>_<secret>`). */
|
|
136
|
+
prefix?: string;
|
|
113
137
|
/** Per-key spend caps, metered with `recordUsage`. */
|
|
114
138
|
limits?: ApiKeyLimit[] | null;
|
|
115
139
|
}
|
|
116
|
-
export interface UpdateApiKeyBody {
|
|
140
|
+
export interface UpdateApiKeyBody extends ApiKeyControls {
|
|
117
141
|
name?: string | null;
|
|
118
142
|
claims?: Record<string, unknown>;
|
|
119
143
|
expires_at?: number | null;
|
|
@@ -128,6 +152,19 @@ export interface UpdateApiKeyBody {
|
|
|
128
152
|
export type ApiKeyVerification = {
|
|
129
153
|
object: 'api_key_verification';
|
|
130
154
|
valid: false;
|
|
155
|
+
} | {
|
|
156
|
+
/**
|
|
157
|
+
* A live key refused by its own policy: `insufficient_scope` (see
|
|
158
|
+
* `missing_scopes`), `rate_limited` (retry after `retry_after_ms`) or
|
|
159
|
+
* `usage_exhausted` (no uses left).
|
|
160
|
+
*/
|
|
161
|
+
object: 'api_key_verification';
|
|
162
|
+
valid: false;
|
|
163
|
+
code: 'insufficient_scope' | 'rate_limited' | 'usage_exhausted';
|
|
164
|
+
id: string;
|
|
165
|
+
missing_scopes?: string[];
|
|
166
|
+
retry_after_ms?: number;
|
|
167
|
+
remaining?: number;
|
|
131
168
|
} | {
|
|
132
169
|
object: 'api_key_verification';
|
|
133
170
|
valid: true;
|
|
@@ -144,6 +181,8 @@ export type ApiKeyVerification = {
|
|
|
144
181
|
usage?: ApiKeyLimitState[];
|
|
145
182
|
last_used_at: number | null;
|
|
146
183
|
expires_at?: number | null;
|
|
184
|
+
/** Uses left after this verify (null = unlimited). */
|
|
185
|
+
remaining?: number | null;
|
|
147
186
|
};
|
|
148
187
|
/**
|
|
149
188
|
* §P1-8 a short-lived, offline-verifiable access JWT minted from a long-lived
|
|
@@ -193,7 +232,13 @@ export declare function apiKeysResource(request: RequestFn): {
|
|
|
193
232
|
/** Mint a key. The secret is returned once, here. */
|
|
194
233
|
create(body: CreateApiKeyBody, idempotencyKey?: string): Promise<ApiKeyWithSecret>;
|
|
195
234
|
/** Check a presented secret. Rate-limited — it is an online credential check. */
|
|
196
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Verify a presented key. `required_scopes`: every one must be on the key,
|
|
237
|
+
* else `{ valid: false, code: 'insufficient_scope' }`.
|
|
238
|
+
*/
|
|
239
|
+
verify(secret: string, options?: {
|
|
240
|
+
required_scopes?: string[];
|
|
241
|
+
}): Promise<ApiKeyVerification>;
|
|
197
242
|
get(id: string): Promise<ApiKey>;
|
|
198
243
|
update(id: string, body: UpdateApiKeyBody): Promise<ApiKey>;
|
|
199
244
|
/** Revoke a key. It stays queryable but never authenticates again. */
|
package/dist/client/api-keys.js
CHANGED
|
@@ -13,8 +13,12 @@ function apiKeysResource(request) {
|
|
|
13
13
|
return request({ method: 'POST', path: '/v1/api_keys', body, idempotencyKey });
|
|
14
14
|
},
|
|
15
15
|
/** Check a presented secret. Rate-limited — it is an online credential check. */
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Verify a presented key. `required_scopes`: every one must be on the key,
|
|
18
|
+
* else `{ valid: false, code: 'insufficient_scope' }`.
|
|
19
|
+
*/
|
|
20
|
+
verify(secret, options = {}) {
|
|
21
|
+
return request({ method: 'POST', path: '/v1/api_keys/verify', body: { secret, ...options } });
|
|
18
22
|
},
|
|
19
23
|
get(id) {
|
|
20
24
|
return request({ method: 'GET', path: `/v1/api_keys/${(0, request_1.enc)(id)}` });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/client/api-keys.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/client/api-keys.ts"],"names":[],"mappings":";;AAqPA,0CA6DC;AAlTD,uCAAgD;AAqPhD,SAAgB,eAAe,CAAC,OAAkB;IAChD,OAAO;QACL,0CAA0C;QAC1C,IAAI,CAAC,KAGJ;YACC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,qDAAqD;QACrD,MAAM,CAAC,IAAsB,EAAE,cAAuB;YACpD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACjF,CAAC;QACD,iFAAiF;QACjF;;;WAGG;QACH,MAAM,CAAC,MAAc,EAAE,UAA0C,EAAE;YACjE,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,CAAC;QAChG,CAAC;QACD,GAAG,CAAC,EAAU;YACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,CAAC,EAAU,EAAE,IAAsB;YACvC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,sEAAsE;QACtE,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACxE,CAAC;QACD;;;;;;;WAOG;QACH,WAAW,CAAC,EAAU,EAAE,IAA2B;YACjD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,iFAAiF;QACjF,QAAQ,CAAC,EAAU;YACjB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,CAAC;QACD;;;WAGG;QACH,SAAS,CAAC,IAAyB;YACjC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,CAAC;QACD;;;WAGG;QACH,WAAW,CAAC,QAAiC,EAAE;YAC7C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;QACvF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type RequestFn } from './request';
|
|
2
|
+
import type { ListPage } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* App-level (instance-wide) user roles: roles that are not tied to an
|
|
5
|
+
* organization, each granting permission keys like `tickets:read`. A user's
|
|
6
|
+
* role keys and the union of their permissions travel on the session token as
|
|
7
|
+
* `app_roles` / `app_permissions`; check them offline with
|
|
8
|
+
* `has(claims, { appPermission: 'tickets:read' })` or `hasAppPermission`.
|
|
9
|
+
*/
|
|
10
|
+
export interface AppRole {
|
|
11
|
+
object: 'app_role';
|
|
12
|
+
id: string;
|
|
13
|
+
key: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
permissions: string[];
|
|
17
|
+
/** On list and create only. */
|
|
18
|
+
users_count?: number;
|
|
19
|
+
created_at: number;
|
|
20
|
+
updated_at: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CreateAppRoleBody {
|
|
23
|
+
/** 2-64 lowercase letters, digits, _ or -, starting with a letter. */
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description?: string | null;
|
|
27
|
+
/** `resource:action` keys (the `org:` namespace is reserved for organizations). */
|
|
28
|
+
permissions?: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface UpdateAppRoleBody {
|
|
31
|
+
name?: string;
|
|
32
|
+
description?: string | null;
|
|
33
|
+
permissions?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface UserAppRoles {
|
|
36
|
+
object: 'user_app_roles';
|
|
37
|
+
user_id: string;
|
|
38
|
+
roles: AppRole[];
|
|
39
|
+
role_keys: string[];
|
|
40
|
+
permissions: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Change a user's app roles: `roles` replaces the set; `add`/`remove` change it
|
|
44
|
+
* (role keys or ids). Send one form, not both.
|
|
45
|
+
*/
|
|
46
|
+
export type SetUserAppRolesBody = {
|
|
47
|
+
roles: string[];
|
|
48
|
+
} | {
|
|
49
|
+
add?: string[];
|
|
50
|
+
remove?: string[];
|
|
51
|
+
};
|
|
52
|
+
export declare function appRolesResource(request: RequestFn): {
|
|
53
|
+
list(): Promise<ListPage<AppRole>>;
|
|
54
|
+
create(body: CreateAppRoleBody): Promise<AppRole>;
|
|
55
|
+
/** By id or key. */
|
|
56
|
+
get(idOrKey: string): Promise<AppRole>;
|
|
57
|
+
update(idOrKey: string, body: UpdateAppRoleBody): Promise<AppRole>;
|
|
58
|
+
delete(idOrKey: string): Promise<{
|
|
59
|
+
object: "app_role";
|
|
60
|
+
id: string;
|
|
61
|
+
deleted: true;
|
|
62
|
+
}>;
|
|
63
|
+
/** The users holding a role. */
|
|
64
|
+
listUsers(idOrKey: string, query?: {
|
|
65
|
+
limit?: number;
|
|
66
|
+
offset?: number;
|
|
67
|
+
}): Promise<ListPage<{
|
|
68
|
+
object: "user_app_role";
|
|
69
|
+
user_id: string;
|
|
70
|
+
role: string;
|
|
71
|
+
}>>;
|
|
72
|
+
/** A user's app roles and effective permissions. */
|
|
73
|
+
getForUser(userId: string): Promise<UserAppRoles>;
|
|
74
|
+
setForUser(userId: string, body: SetUserAppRolesBody): Promise<UserAppRoles>;
|
|
75
|
+
removeFromUser(userId: string, idOrKey: string): Promise<UserAppRoles>;
|
|
76
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appRolesResource = appRolesResource;
|
|
4
|
+
const request_1 = require("./request");
|
|
5
|
+
function appRolesResource(request) {
|
|
6
|
+
return {
|
|
7
|
+
list() {
|
|
8
|
+
return request({ method: 'GET', path: '/v1/app_roles' });
|
|
9
|
+
},
|
|
10
|
+
create(body) {
|
|
11
|
+
return request({ method: 'POST', path: '/v1/app_roles', body });
|
|
12
|
+
},
|
|
13
|
+
/** By id or key. */
|
|
14
|
+
get(idOrKey) {
|
|
15
|
+
return request({ method: 'GET', path: `/v1/app_roles/${(0, request_1.enc)(idOrKey)}` });
|
|
16
|
+
},
|
|
17
|
+
update(idOrKey, body) {
|
|
18
|
+
return request({ method: 'PATCH', path: `/v1/app_roles/${(0, request_1.enc)(idOrKey)}`, body });
|
|
19
|
+
},
|
|
20
|
+
delete(idOrKey) {
|
|
21
|
+
return request({ method: 'DELETE', path: `/v1/app_roles/${(0, request_1.enc)(idOrKey)}` });
|
|
22
|
+
},
|
|
23
|
+
/** The users holding a role. */
|
|
24
|
+
listUsers(idOrKey, query = {}) {
|
|
25
|
+
return request({ method: 'GET', path: `/v1/app_roles/${(0, request_1.enc)(idOrKey)}/users`, query });
|
|
26
|
+
},
|
|
27
|
+
/** A user's app roles and effective permissions. */
|
|
28
|
+
getForUser(userId) {
|
|
29
|
+
return request({ method: 'GET', path: `/v1/users/${(0, request_1.enc)(userId)}/app_roles` });
|
|
30
|
+
},
|
|
31
|
+
setForUser(userId, body) {
|
|
32
|
+
return request({ method: 'POST', path: `/v1/users/${(0, request_1.enc)(userId)}/app_roles`, body });
|
|
33
|
+
},
|
|
34
|
+
removeFromUser(userId, idOrKey) {
|
|
35
|
+
return request({ method: 'DELETE', path: `/v1/users/${(0, request_1.enc)(userId)}/app_roles/${(0, request_1.enc)(idOrKey)}` });
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=app-roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-roles.js","sourceRoot":"","sources":["../../src/client/app-roles.ts"],"names":[],"mappings":";;AAoDA,4CAoCC;AAxFD,uCAAgD;AAoDhD,SAAgB,gBAAgB,CAAC,OAAkB;IACjD,OAAO;QACL,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,MAAM,CAAC,IAAuB;YAC5B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,oBAAoB;QACpB,GAAG,CAAC,OAAe;YACjB,OAAO,OAAO,CAAC,EAAE,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,CAAC;QACnG,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type RequestFn } from './request';
|
|
2
2
|
import type { ListPage } from './types';
|
|
3
3
|
/** The transactional email a template drives. */
|
|
4
|
-
export type EmailTemplateName = 'verification_code' | 'magic_link' | 'password_reset' | 'password_changed' | 'account_exists_notice' | 'organization_invitation' | 'new_device_sign_in' | 'session_revoked_token_reuse' | 'account_locked' | 'account_secured' | 'team_member_added' | 'team_role_changed';
|
|
4
|
+
export type EmailTemplateName = 'verification_code' | 'magic_link' | 'password_reset' | 'password_changed' | 'account_exists_notice' | 'organization_invitation' | 'new_device_sign_in' | 'session_revoked_token_reuse' | 'account_locked' | 'account_secured' | 'team_member_added' | 'team_role_changed' | 'email_changed' | 'verification_link' | 'password_reset_link';
|
|
5
5
|
/** The customizable body of a template: a subject line and a text body. */
|
|
6
6
|
export interface EmailTemplateBody {
|
|
7
7
|
subject?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-templates.js","sourceRoot":"","sources":["../../src/client/email-templates.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"email-templates.js","sourceRoot":"","sources":["../../src/client/email-templates.ts"],"names":[],"mappings":";;AA4DA,wDAkBC;AA9ED,uCAAgD;AA4DhD,SAAgB,sBAAsB,CAAC,OAAkB;IACvD,OAAO;QACL,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,2EAA2E;QAC3E,OAAO,CAAC,IAAY,EAAE,OAA0B,EAAE;YAChD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,2DAA2D;QAC3D,MAAM,CAAC,IAAY,EAAE,IAAuB;YAC1C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,8BAA8B;QAC9B,MAAM,CAAC,IAAY;YACjB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACjF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -12,13 +12,20 @@ import type { RequestFn } from './request';
|
|
|
12
12
|
export declare function createAtlasClient(config: AtlasClientConfig): AtlasClient;
|
|
13
13
|
declare function buildNamespaces(request: RequestFn): {
|
|
14
14
|
users: {
|
|
15
|
-
list(params?: import("./users").ListUsersParams): Promise<import("./types").CursorPage<import("./users").User
|
|
15
|
+
list(params?: import("./users").ListUsersParams): Promise<import("./types").CursorPage<import("./users").User> & {
|
|
16
|
+
total_count?: number;
|
|
17
|
+
}>;
|
|
16
18
|
get(id: string): Promise<import("./users").User>;
|
|
17
19
|
create(body: import("./users").CreateUserBody, idempotencyKey?: string): Promise<import("./users").User>;
|
|
18
20
|
update(id: string, body: import("./users").UpdateUserBody): Promise<import("./users").User>;
|
|
19
21
|
setExternalId(id: string, externalId: string | null): Promise<import("./users").User>;
|
|
20
22
|
replaceMetadata(id: string, body: import("./users").ReplaceUserMetadataBody): Promise<import("./users").User>;
|
|
21
|
-
ban(id: string
|
|
23
|
+
ban(id: string, body?: {
|
|
24
|
+
reason?: string;
|
|
25
|
+
note?: string;
|
|
26
|
+
expires_in_seconds?: number;
|
|
27
|
+
expires_at?: number;
|
|
28
|
+
}): Promise<import("./users").User>;
|
|
22
29
|
unban(id: string): Promise<import("./users").User>;
|
|
23
30
|
lock(id: string, body?: {
|
|
24
31
|
duration_in_seconds?: number;
|
|
@@ -354,6 +361,14 @@ declare function buildNamespaces(request: RequestFn): {
|
|
|
354
361
|
}>;
|
|
355
362
|
listBackchannelDeliveries(id: string, query?: import("./oauth-clients").BackchannelDeliveriesQuery): Promise<import("./oauth-clients").BackchannelLogoutDeliveryPage>;
|
|
356
363
|
testBackchannelLogout(id: string): Promise<import("./oauth-clients").BackchannelLogoutTest>;
|
|
364
|
+
initialAccessTokens: {
|
|
365
|
+
list(): Promise<import("./types").ListPage<import("./oauth-clients").OAuthInitialAccessToken>>;
|
|
366
|
+
create(body?: import("./oauth-clients").CreateInitialAccessTokenBody): Promise<import("./oauth-clients").OAuthInitialAccessToken & {
|
|
367
|
+
token: string;
|
|
368
|
+
note: string;
|
|
369
|
+
}>;
|
|
370
|
+
revoke(id: string): Promise<import("./oauth-clients").OAuthInitialAccessToken>;
|
|
371
|
+
};
|
|
357
372
|
grants: {
|
|
358
373
|
list(clientId: string): Promise<import("./types").ListPage<import("./oauth-clients").ClientGrant>>;
|
|
359
374
|
create(clientId: string, body: {
|
|
@@ -393,6 +408,7 @@ declare function buildNamespaces(request: RequestFn): {
|
|
|
393
408
|
scimTokens: {
|
|
394
409
|
list(): Promise<import("./types").ListPage<import("./scim-tokens").ScimToken>>;
|
|
395
410
|
create(body: import("./scim-tokens").CreateScimTokenBody, idempotencyKey?: string): Promise<import("./scim-tokens").ScimTokenWithSecret>;
|
|
411
|
+
update(id: string, body: import("./scim-tokens").UpdateScimTokenBody): Promise<import("./scim-tokens").ScimToken>;
|
|
396
412
|
revoke(id: string): Promise<{
|
|
397
413
|
object: "scim_token";
|
|
398
414
|
id: string;
|
|
@@ -530,7 +546,9 @@ declare function buildNamespaces(request: RequestFn): {
|
|
|
530
546
|
subject_id?: string;
|
|
531
547
|
}): Promise<import("./types").ListPage<import("./api-keys").ApiKey>>;
|
|
532
548
|
create(body: import("./api-keys").CreateApiKeyBody, idempotencyKey?: string): Promise<import("./api-keys").ApiKeyWithSecret>;
|
|
533
|
-
verify(secret: string
|
|
549
|
+
verify(secret: string, options?: {
|
|
550
|
+
required_scopes?: string[];
|
|
551
|
+
}): Promise<import("./api-keys").ApiKeyVerification>;
|
|
534
552
|
get(id: string): Promise<import("./api-keys").ApiKey>;
|
|
535
553
|
update(id: string, body: import("./api-keys").UpdateApiKeyBody): Promise<import("./api-keys").ApiKey>;
|
|
536
554
|
delete(id: string): Promise<{
|
|
@@ -543,6 +561,28 @@ declare function buildNamespaces(request: RequestFn): {
|
|
|
543
561
|
mintToken(body: import("./api-keys").MintApiKeyTokenBody): Promise<import("./api-keys").ApiKeyToken>;
|
|
544
562
|
listRevoked(query?: import("./api-keys").ListRevokedApiKeysQuery): Promise<import("./types").CursorPage<import("./api-keys").RevokedApiKeyRef>>;
|
|
545
563
|
};
|
|
564
|
+
appRoles: {
|
|
565
|
+
list(): Promise<import("./types").ListPage<import("./app-roles").AppRole>>;
|
|
566
|
+
create(body: import("./app-roles").CreateAppRoleBody): Promise<import("./app-roles").AppRole>;
|
|
567
|
+
get(idOrKey: string): Promise<import("./app-roles").AppRole>;
|
|
568
|
+
update(idOrKey: string, body: import("./app-roles").UpdateAppRoleBody): Promise<import("./app-roles").AppRole>;
|
|
569
|
+
delete(idOrKey: string): Promise<{
|
|
570
|
+
object: "app_role";
|
|
571
|
+
id: string;
|
|
572
|
+
deleted: true;
|
|
573
|
+
}>;
|
|
574
|
+
listUsers(idOrKey: string, query?: {
|
|
575
|
+
limit?: number;
|
|
576
|
+
offset?: number;
|
|
577
|
+
}): Promise<import("./types").ListPage<{
|
|
578
|
+
object: "user_app_role";
|
|
579
|
+
user_id: string;
|
|
580
|
+
role: string;
|
|
581
|
+
}>>;
|
|
582
|
+
getForUser(userId: string): Promise<import("./app-roles").UserAppRoles>;
|
|
583
|
+
setForUser(userId: string, body: import("./app-roles").SetUserAppRolesBody): Promise<import("./app-roles").UserAppRoles>;
|
|
584
|
+
removeFromUser(userId: string, idOrKey: string): Promise<import("./app-roles").UserAppRoles>;
|
|
585
|
+
};
|
|
546
586
|
machines: {
|
|
547
587
|
list(query?: import("./machines").ListMachinesQuery): Promise<import("./machines").MachineListPage>;
|
|
548
588
|
create(body: import("./machines").CreateMachineBody, idempotencyKey?: string): Promise<import("./machines").MachineWithSecret>;
|
|
@@ -931,6 +971,11 @@ declare function buildNamespaces(request: RequestFn): {
|
|
|
931
971
|
};
|
|
932
972
|
};
|
|
933
973
|
instanceSecurity: {
|
|
974
|
+
listSigningKeys(): Promise<{
|
|
975
|
+
object: "list";
|
|
976
|
+
data: import("./instance-security").SigningKey[];
|
|
977
|
+
}>;
|
|
978
|
+
rotateSigningKey(body?: import("./instance-security").RotateSigningKeyBody): Promise<import("./instance-security").SigningKeyRotation>;
|
|
934
979
|
get(): Promise<import("./instance-security").InstanceSecurity>;
|
|
935
980
|
update(body: import("./instance-security").UpdateInstanceSecurityBody): Promise<import("./instance-security").InstanceSecurityResult>;
|
|
936
981
|
setCaptchaSecret(body: {
|
|
@@ -1307,6 +1352,7 @@ export * from './users';
|
|
|
1307
1352
|
export * from './sessions';
|
|
1308
1353
|
export * from './organizations';
|
|
1309
1354
|
export * from './roles';
|
|
1355
|
+
export * from './app-roles';
|
|
1310
1356
|
export * from './oauth-clients';
|
|
1311
1357
|
export * from './resource-servers';
|
|
1312
1358
|
export * from './sso-connections';
|
package/dist/client/index.js
CHANGED
|
@@ -36,6 +36,7 @@ const sign_in_tokens_1 = require("./sign-in-tokens");
|
|
|
36
36
|
const audit_logs_1 = require("./audit-logs");
|
|
37
37
|
const jwt_templates_1 = require("./jwt-templates");
|
|
38
38
|
const api_keys_1 = require("./api-keys");
|
|
39
|
+
const app_roles_1 = require("./app-roles");
|
|
39
40
|
const machines_1 = require("./machines");
|
|
40
41
|
const oauth_providers_1 = require("./oauth-providers");
|
|
41
42
|
const sso_onboarding_1 = require("./sso-onboarding");
|
|
@@ -124,6 +125,8 @@ function buildNamespaces(request) {
|
|
|
124
125
|
auditLogs: (0, audit_logs_1.auditLogsResource)(request),
|
|
125
126
|
jwtTemplates: (0, jwt_templates_1.jwtTemplatesResource)(request),
|
|
126
127
|
apiKeys: (0, api_keys_1.apiKeysResource)(request),
|
|
128
|
+
// App-level (instance-wide) user roles and permissions.
|
|
129
|
+
appRoles: (0, app_roles_1.appRolesResource)(request),
|
|
127
130
|
// §9.3 / §P1-7 named machine identities + device registry + enrolment tokens.
|
|
128
131
|
machines: (0, machines_1.machinesResource)(request),
|
|
129
132
|
oauthProviders: (0, oauth_providers_1.oauthProvidersResource)(request),
|
|
@@ -203,6 +206,7 @@ __exportStar(require("./users"), exports);
|
|
|
203
206
|
__exportStar(require("./sessions"), exports);
|
|
204
207
|
__exportStar(require("./organizations"), exports);
|
|
205
208
|
__exportStar(require("./roles"), exports);
|
|
209
|
+
__exportStar(require("./app-roles"), exports);
|
|
206
210
|
__exportStar(require("./oauth-clients"), exports);
|
|
207
211
|
__exportStar(require("./resource-servers"), exports);
|
|
208
212
|
__exportStar(require("./sso-connections"), exports);
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA+EA,8CAQC;AAvFD,uCAA6F;AAC7F,mCAAwC;AACxC,yCAA8C;AAC9C,mDAAwD;AACxD,mCAA6D;AAC7D,mDAAuD;AACvD,yDAA6D;AAC7D,uDAA2D;AAC3D,+CAAmD;AACnD,uCAA4C;AAC5C,yCAA8C;AAC9C,iDAAsE;AACtE,2DAA+D;AAC/D,iDAAqD;AACrD,+CAAoD;AACpD,yCAA8C;AAC9C,qDAAwD;AACxD,6CAAiD;AACjD,mDAAuD;AACvD,yCAA6C;AAC7C,2CAA+C;AAC/C,yCAA8C;AAC9C,uDAA2D;AAC3D,qDAAyD;AACzD,2DAA+D;AAC/D,+BAAo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export interface CreateProxySecretBody {
|
|
|
63
63
|
export interface InstanceSecurityResult extends InstanceSecurity {
|
|
64
64
|
warning?: string;
|
|
65
65
|
}
|
|
66
|
+
/** One published instance signing key (`GET /v1/instance/signing_keys`). */
|
|
67
|
+
export interface SigningKey {
|
|
68
|
+
object: 'signing_key';
|
|
69
|
+
kid: string;
|
|
70
|
+
alg: 'RS256' | 'ES256' | string;
|
|
71
|
+
status: 'current' | 'previous';
|
|
72
|
+
/** `main` signs every token; `secondary` signs access tokens for APIs set to the other algorithm. */
|
|
73
|
+
role: 'main' | 'secondary';
|
|
74
|
+
/** When a previous key leaves the JWKS (epoch ms); null for a current key. */
|
|
75
|
+
retires_at: number | null;
|
|
76
|
+
}
|
|
77
|
+
export interface RotateSigningKeyBody {
|
|
78
|
+
/** How long the previous key stays published (default 86400, at most 2592000). */
|
|
79
|
+
grace_period_seconds?: number;
|
|
80
|
+
/** Publish only the new key now (suspected compromise). */
|
|
81
|
+
emergency?: boolean;
|
|
82
|
+
/** The new main key's algorithm; omit to keep the current one. */
|
|
83
|
+
alg?: 'RS256' | 'ES256';
|
|
84
|
+
}
|
|
85
|
+
export interface SigningKeyRotation {
|
|
86
|
+
object: 'signing_key_rotation';
|
|
87
|
+
kid: string;
|
|
88
|
+
alg: 'RS256' | 'ES256';
|
|
89
|
+
previous_kid: string | null;
|
|
90
|
+
previous_retires_at: number | null;
|
|
91
|
+
emergency: boolean;
|
|
92
|
+
}
|
|
66
93
|
export declare function instanceSecurityResource(request: RequestFn): {
|
|
94
|
+
/** The published token-signing keys, newest first. */
|
|
95
|
+
listSigningKeys(): Promise<{
|
|
96
|
+
object: "list";
|
|
97
|
+
data: SigningKey[];
|
|
98
|
+
}>;
|
|
99
|
+
/** Rotate the signing key (optionally switching between RS256 and ES256). */
|
|
100
|
+
rotateSigningKey(body?: RotateSigningKeyBody): Promise<SigningKeyRotation>;
|
|
67
101
|
get(): Promise<InstanceSecurity>;
|
|
68
102
|
update(body: UpdateInstanceSecurityBody): Promise<InstanceSecurityResult>;
|
|
69
103
|
/** Store the captcha provider secret. Refused while the provider is `none`. */
|