@canopy-io/node 0.18.2 → 0.20.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 +12 -0
- package/README.md +8 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +356 -16
- package/dist/index.d.ts +356 -16
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1511,7 +1511,7 @@ interface paths {
|
|
|
1511
1511
|
post: operations["ApiOrganizationsController_createOrganization"];
|
|
1512
1512
|
/**
|
|
1513
1513
|
* Delete every organization
|
|
1514
|
-
* @description Deletes every live organization in the Environment the way the single delete does: memberships and every assignment beneath each organization are removed, pending invitations bound to the organization or its tree are revoked, and each organization is soft-deleted with its subtree. Member identities are untouched. This is the step before switching the container off. Responds `204 No Content`, requires the `hierarchy.manage` permission, and emits `organization.deleted_all` with the counts.
|
|
1514
|
+
* @description Deletes every live organization in the Environment the way the single delete does: memberships and every assignment beneath each organization are removed, pending invitations bound to the organization or its tree are revoked, and each organization is soft-deleted with its subtree. Member identities are untouched. This is the step before switching the container off, so unlike the other organization routes it does not require the organizations plan feature: an account that has moved to a plan without it can still empty the container and switch it off. Responds `204 No Content`, requires the `hierarchy.manage` permission, and emits `organization.deleted_all` with the counts.
|
|
1515
1515
|
*/
|
|
1516
1516
|
delete: operations["ApiOrganizationsController_deleteAllOrganizations"];
|
|
1517
1517
|
options?: never;
|
|
@@ -2995,6 +2995,30 @@ interface paths {
|
|
|
2995
2995
|
patch: operations["ApiBrandingController_updateBranding"];
|
|
2996
2996
|
trace?: never;
|
|
2997
2997
|
};
|
|
2998
|
+
"/api/v1/token-claims": {
|
|
2999
|
+
parameters: {
|
|
3000
|
+
query?: never;
|
|
3001
|
+
header?: never;
|
|
3002
|
+
path?: never;
|
|
3003
|
+
cookie?: never;
|
|
3004
|
+
};
|
|
3005
|
+
/**
|
|
3006
|
+
* Get an Environment's custom token claims
|
|
3007
|
+
* @description Returns the custom claims the Environment adds to its identity tokens: for each, the claim's name, the stored fact it is read from (`source`) and the tokens it goes on (`access`, `id`), in the order they are added, with the Environment's `version` to send back as `If-Match`. An empty list means no custom claims.
|
|
3008
|
+
*/
|
|
3009
|
+
get: operations["ApiTokenClaimsController_getTokenClaims"];
|
|
3010
|
+
/**
|
|
3011
|
+
* Replace an Environment's custom token claims
|
|
3012
|
+
* @description Replaces the custom claims the Environment adds to its identity tokens with the list sent; an empty list removes them all. Each entry names the claim, its `source` (`identity.metadata.<path>`, `organization.metadata.<path>`, or a built-in identity or organization field) and the tokens it goes on. At most 20 entries. Every access token minted after the save carries them, Hosted Login and the Direct API alike, and the ID token those marked `id`; a session picks the change up at its next refresh. A value missing for the person is left out of the token. Send the Environment's `version` in `If-Match` to refuse a stale save: a mismatch answers `409 version_mismatch`, and without the header the check is skipped. Emits `environment.token_claims_updated` with the list before and after.
|
|
3013
|
+
*/
|
|
3014
|
+
put: operations["ApiTokenClaimsController_replaceTokenClaims"];
|
|
3015
|
+
post?: never;
|
|
3016
|
+
delete?: never;
|
|
3017
|
+
options?: never;
|
|
3018
|
+
head?: never;
|
|
3019
|
+
patch?: never;
|
|
3020
|
+
trace?: never;
|
|
3021
|
+
};
|
|
2998
3022
|
"/api/v1/webhooks": {
|
|
2999
3023
|
parameters: {
|
|
3000
3024
|
query?: never;
|
|
@@ -3102,7 +3126,7 @@ interface paths {
|
|
|
3102
3126
|
put?: never;
|
|
3103
3127
|
/**
|
|
3104
3128
|
* Register a new OAuth client
|
|
3105
|
-
* @description Registers a new
|
|
3129
|
+
* @description Registers a new OAuth client in the current Environment with the given `name`, `redirect_uris`, and optional `scopes` (defaulting to `openid profile email`), each one of `openid`, `profile`, `email`, `org` and `permissions`; any other value is refused with `400` (`oauth.client_scope_unknown`). `client_type` is `confidential` (when omitted: a backend holds the secret) or `public` (a single-page or mobile app that cannot keep one: no secret is minted, `client_secret` in the response is null, the client authenticates at the token endpoint with `client_id` alone, and it may also register a private-use scheme redirect such as `com.example.app:/callback` or a loopback address whose port is ignored). The type is fixed at registration. A machine client is always confidential (`400 oauth.machine_client_public_invalid`). With `client_kind: machine` it registers a machine client instead: a principal of its own that holds roles (see the assignments routes) and obtains tokens for itself, with an optional `organization_node_id` (the one organization it acts in), optional `allowed_audiences` and the `permissions` scope, the `client_credentials` grant only and no redirect URIs; it counts toward the plan's machine-credential allowance (`409 plan_limit_exceeded`). Generates the `client_id` and a `client_secret` that is bcrypt-hashed at rest; the raw secret is returned in this response only and is never retrievable again. Responds `201 Created`.
|
|
3106
3130
|
*/
|
|
3107
3131
|
post: operations["ApiOAuthClientsController_create"];
|
|
3108
3132
|
delete?: never;
|
|
@@ -3170,7 +3194,7 @@ interface paths {
|
|
|
3170
3194
|
put?: never;
|
|
3171
3195
|
/**
|
|
3172
3196
|
* Rotate an OAuth client's secret
|
|
3173
|
-
* @description Rotates the OAuth client's `client_secret`, generating and hashing a new secret. The replaced secret keeps working for 24 hours (`previous_secret_expires_at` says until when) so the systems using it can move over; send `expire_previous: "now"` to stop it at once, for a secret that has leaked. Rotating again inside the overlap replaces the secret still in its overlap. The new raw secret is returned in this response only and cannot be retrieved again. Returns `404` when the client is not found in the current Environment.
|
|
3197
|
+
* @description Rotates the OAuth client's `client_secret`, generating and hashing a new secret. The replaced secret keeps working for 24 hours (`previous_secret_expires_at` says until when) so the systems using it can move over; send `expire_previous: "now"` to stop it at once, for a secret that has leaked. Rotating again inside the overlap replaces the secret still in its overlap. The new raw secret is returned in this response only and cannot be retrieved again. Returns `404` when the client is not found in the current Environment, and `409` (`oauth.client_public_has_no_secret`) for a public client, which has no secret.
|
|
3174
3198
|
*/
|
|
3175
3199
|
post: operations["ApiOAuthClientsController_rotateSecret"];
|
|
3176
3200
|
delete?: never;
|
|
@@ -5660,6 +5684,56 @@ interface components {
|
|
|
5660
5684
|
/** @description Absolute https URL of the customer's privacy policy, linked as "Privacy" in the hosted pages' footer. Null hides it. */
|
|
5661
5685
|
privacy_url?: string | null;
|
|
5662
5686
|
};
|
|
5687
|
+
TokenClaimEntryResponseDto: {
|
|
5688
|
+
/**
|
|
5689
|
+
* @description The claim's name on the token: letters, digits, `_`, `-`, `.`, `:` and `/`, at most 64 characters. A name the JWT or OpenID Connect standards define, or one Canopy sets (`type`, the `*_id` and `*_slug` claims, `permissions`, anything starting `org_` or `mcp_`), is refused.
|
|
5690
|
+
* @example plan
|
|
5691
|
+
*/
|
|
5692
|
+
claim: string;
|
|
5693
|
+
/**
|
|
5694
|
+
* @description Where the value comes from: `identity.metadata.<path>` or `organization.metadata.<path>` (dotted keys, at most 5), or one of `identity.email`, `identity.email_verified`, `identity.first_name`, `identity.last_name`, `identity.external_id`, `organization.name`, `organization.slug`, `organization.external_id`. An `organization.*` source reads the organization the session acts in.
|
|
5695
|
+
* @example identity.metadata.plan
|
|
5696
|
+
*/
|
|
5697
|
+
source: string;
|
|
5698
|
+
/**
|
|
5699
|
+
* @description The tokens the claim goes on: `access`, `id`, or both. The ID token is issued by Hosted Login only.
|
|
5700
|
+
* @example [
|
|
5701
|
+
* "access",
|
|
5702
|
+
* "id"
|
|
5703
|
+
* ]
|
|
5704
|
+
*/
|
|
5705
|
+
tokens: ("access" | "id")[];
|
|
5706
|
+
};
|
|
5707
|
+
TokenClaimsResponseDto: {
|
|
5708
|
+
/** @description The Environment's version. Send it as `If-Match` on the next `PUT` to refuse a stale save; any change to the Environment advances it. */
|
|
5709
|
+
version: number;
|
|
5710
|
+
/** @description The mapping, in the order claims are added to a token. Empty when the Environment adds none. */
|
|
5711
|
+
claims: components["schemas"]["TokenClaimEntryResponseDto"][];
|
|
5712
|
+
};
|
|
5713
|
+
TokenClaimEntryDto: {
|
|
5714
|
+
/**
|
|
5715
|
+
* @description The claim's name on the token: letters, digits, `_`, `-`, `.`, `:` and `/`, at most 64 characters. A name the JWT or OpenID Connect standards define, or one Canopy sets (`type`, the `*_id` and `*_slug` claims, `permissions`, anything starting `org_` or `mcp_`), is refused.
|
|
5716
|
+
* @example plan
|
|
5717
|
+
*/
|
|
5718
|
+
claim: string;
|
|
5719
|
+
/**
|
|
5720
|
+
* @description Where the value comes from: `identity.metadata.<path>` or `organization.metadata.<path>` (dotted keys, at most 5), or one of `identity.email`, `identity.email_verified`, `identity.first_name`, `identity.last_name`, `identity.external_id`, `organization.name`, `organization.slug`, `organization.external_id`. An `organization.*` source reads the organization the session acts in.
|
|
5721
|
+
* @example identity.metadata.plan
|
|
5722
|
+
*/
|
|
5723
|
+
source: string;
|
|
5724
|
+
/**
|
|
5725
|
+
* @description The tokens the claim goes on: `access`, `id`, or both. The ID token is issued by Hosted Login only.
|
|
5726
|
+
* @example [
|
|
5727
|
+
* "access",
|
|
5728
|
+
* "id"
|
|
5729
|
+
* ]
|
|
5730
|
+
*/
|
|
5731
|
+
tokens: ("access" | "id")[];
|
|
5732
|
+
};
|
|
5733
|
+
ReplaceTokenClaimsDto: {
|
|
5734
|
+
/** @description The whole mapping, in the order claims are added to a token, at most 20 entries. An empty list removes every custom claim. */
|
|
5735
|
+
claims: components["schemas"]["TokenClaimEntryDto"][];
|
|
5736
|
+
};
|
|
5663
5737
|
WebhookCreatedResponseDto: {
|
|
5664
5738
|
id: string;
|
|
5665
5739
|
/** @enum {string} */
|
|
@@ -5744,6 +5818,16 @@ interface components {
|
|
|
5744
5818
|
* @enum {string}
|
|
5745
5819
|
*/
|
|
5746
5820
|
client_kind: "web" | "machine";
|
|
5821
|
+
/**
|
|
5822
|
+
* @description `confidential`: a backend holds its secret. `public`: a single-page or mobile app with no secret, authenticating with `client_id` alone. Fixed at registration.
|
|
5823
|
+
* @enum {string}
|
|
5824
|
+
*/
|
|
5825
|
+
client_type: "confidential" | "public";
|
|
5826
|
+
/**
|
|
5827
|
+
* @description How the client authenticates at the token and revocation endpoints, as discovery names it: `client_secret_basic` (or `client_secret_post`, accepted alike) for a confidential client, `none` for a public one.
|
|
5828
|
+
* @enum {string}
|
|
5829
|
+
*/
|
|
5830
|
+
token_endpoint_auth_method: "client_secret_basic" | "none";
|
|
5747
5831
|
/** @description The organization a machine client acts in: its tokens name it and its roles sit inside it. Null for a client that acts across the Environment, and for a web client. */
|
|
5748
5832
|
organization_node_id?: string | null;
|
|
5749
5833
|
/** @description That organization's name; null when the client has none. */
|
|
@@ -5790,8 +5874,8 @@ interface components {
|
|
|
5790
5874
|
* @example https://auth.yourapp.com
|
|
5791
5875
|
*/
|
|
5792
5876
|
issuer: string;
|
|
5793
|
-
/** @description Client secret — shown only once */
|
|
5794
|
-
client_secret: string;
|
|
5877
|
+
/** @description Client secret — shown only once. Null for a public client, which has none. */
|
|
5878
|
+
client_secret: string | null;
|
|
5795
5879
|
};
|
|
5796
5880
|
CreateOAuthClientDto: {
|
|
5797
5881
|
name: string;
|
|
@@ -5800,6 +5884,11 @@ interface components {
|
|
|
5800
5884
|
* @enum {string}
|
|
5801
5885
|
*/
|
|
5802
5886
|
client_kind?: "web" | "machine";
|
|
5887
|
+
/**
|
|
5888
|
+
* @description `confidential` (when omitted): a backend holds the client secret and presents it at the token endpoint. `public`: a single-page or mobile app that cannot keep a secret, so none is minted; it authenticates with `client_id` alone (`none`) and PKCE, and may register a private-use scheme or loopback redirect. Fixed at registration. A machine client is always confidential.
|
|
5889
|
+
* @enum {string}
|
|
5890
|
+
*/
|
|
5891
|
+
client_type?: "confidential" | "public";
|
|
5803
5892
|
/** @description Machine clients only: the organization the client acts in. Its tokens name it and it may hold roles only inside it. Omitted, the client acts across the Environment. */
|
|
5804
5893
|
organization_node_id?: string;
|
|
5805
5894
|
/**
|
|
@@ -5830,6 +5919,16 @@ interface components {
|
|
|
5830
5919
|
* @enum {string}
|
|
5831
5920
|
*/
|
|
5832
5921
|
client_kind: "web" | "machine";
|
|
5922
|
+
/**
|
|
5923
|
+
* @description `confidential`: a backend holds its secret. `public`: a single-page or mobile app with no secret, authenticating with `client_id` alone. Fixed at registration.
|
|
5924
|
+
* @enum {string}
|
|
5925
|
+
*/
|
|
5926
|
+
client_type: "confidential" | "public";
|
|
5927
|
+
/**
|
|
5928
|
+
* @description How the client authenticates at the token and revocation endpoints, as discovery names it: `client_secret_basic` (or `client_secret_post`, accepted alike) for a confidential client, `none` for a public one.
|
|
5929
|
+
* @enum {string}
|
|
5930
|
+
*/
|
|
5931
|
+
token_endpoint_auth_method: "client_secret_basic" | "none";
|
|
5833
5932
|
/** @description The organization a machine client acts in: its tokens name it and its roles sit inside it. Null for a client that acts across the Environment, and for a web client. */
|
|
5834
5933
|
organization_node_id?: string | null;
|
|
5835
5934
|
/** @description That organization's name; null when the client has none. */
|
|
@@ -5928,7 +6027,7 @@ interface components {
|
|
|
5928
6027
|
*/
|
|
5929
6028
|
access_mode: "scoped" | "full_access";
|
|
5930
6029
|
/** @description Permission scopes this key is authorized for, each one the platform offers (`GET .../api-keys/scopes`). Required and must be non-empty when `access_mode` is `scoped`. Must be omitted when `access_mode` is `full_access`. */
|
|
5931
|
-
scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "audit.view" | "branding.view" | "branding.manage")[];
|
|
6030
|
+
scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "audit.view" | "branding.view" | "branding.manage" | "token_claims.view" | "token_claims.manage")[];
|
|
5932
6031
|
/** @description Expiration date (ISO 8601). Omit for no expiration. */
|
|
5933
6032
|
expires_at?: string;
|
|
5934
6033
|
};
|
|
@@ -6443,6 +6542,11 @@ interface components {
|
|
|
6443
6542
|
metadata: {
|
|
6444
6543
|
/** @description The client's `client_id`. */
|
|
6445
6544
|
client_id: string;
|
|
6545
|
+
/**
|
|
6546
|
+
* @description `confidential` when a backend holds its secret, `public` when it is a single-page or mobile app with none.
|
|
6547
|
+
* @enum {string}
|
|
6548
|
+
*/
|
|
6549
|
+
client_type: "confidential" | "public";
|
|
6446
6550
|
/** @description Whether the client is enabled. A disabled client obtains no new tokens. */
|
|
6447
6551
|
is_active: boolean;
|
|
6448
6552
|
};
|
|
@@ -16130,7 +16234,7 @@ interface operations {
|
|
|
16130
16234
|
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
16131
16235
|
};
|
|
16132
16236
|
};
|
|
16133
|
-
/** @description
|
|
16237
|
+
/** @description The caller may not manage this organization, or an organization administrator signed in as an identity sets `metadata` or `external_id`, which only the developer's backend or a Console administrator sets (`organization.developer_field`). Also a caller without the permissions the route needs */
|
|
16134
16238
|
403: {
|
|
16135
16239
|
headers: {
|
|
16136
16240
|
[name: string]: unknown;
|
|
@@ -16141,10 +16245,10 @@ interface operations {
|
|
|
16141
16245
|
* "error": {
|
|
16142
16246
|
* "statusCode": 403,
|
|
16143
16247
|
* "code": null,
|
|
16144
|
-
* "message": "
|
|
16248
|
+
* "message": "The caller may not manage this organization, or an organization administrator signed in as an identity sets `metadata` or `external_id`, which only the developer's backend or a Console administrator sets (`organization.developer_field`). Also a caller without the permissions the route needs",
|
|
16145
16249
|
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
16146
|
-
* "path": "/api/v1/organizations",
|
|
16147
|
-
* "method": "
|
|
16250
|
+
* "path": "/api/v1/organizations/{id}",
|
|
16251
|
+
* "method": "PATCH"
|
|
16148
16252
|
* }
|
|
16149
16253
|
* }
|
|
16150
16254
|
*/
|
|
@@ -27725,6 +27829,204 @@ interface operations {
|
|
|
27725
27829
|
};
|
|
27726
27830
|
};
|
|
27727
27831
|
};
|
|
27832
|
+
ApiTokenClaimsController_getTokenClaims: {
|
|
27833
|
+
parameters: {
|
|
27834
|
+
query?: never;
|
|
27835
|
+
header?: never;
|
|
27836
|
+
path?: never;
|
|
27837
|
+
cookie?: never;
|
|
27838
|
+
};
|
|
27839
|
+
requestBody?: never;
|
|
27840
|
+
responses: {
|
|
27841
|
+
/** @description The custom claims mapping */
|
|
27842
|
+
200: {
|
|
27843
|
+
headers: {
|
|
27844
|
+
[name: string]: unknown;
|
|
27845
|
+
};
|
|
27846
|
+
content: {
|
|
27847
|
+
"application/json": {
|
|
27848
|
+
data: components["schemas"]["TokenClaimsResponseDto"];
|
|
27849
|
+
};
|
|
27850
|
+
};
|
|
27851
|
+
};
|
|
27852
|
+
/** @description The request sent both an `X-API-Key` and an `Authorization` header; send one */
|
|
27853
|
+
400: {
|
|
27854
|
+
headers: {
|
|
27855
|
+
[name: string]: unknown;
|
|
27856
|
+
};
|
|
27857
|
+
content: {
|
|
27858
|
+
/**
|
|
27859
|
+
* @example {
|
|
27860
|
+
* "error": {
|
|
27861
|
+
* "statusCode": 400,
|
|
27862
|
+
* "code": null,
|
|
27863
|
+
* "message": "The request sent both an `X-API-Key` and an `Authorization` header; send one",
|
|
27864
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
27865
|
+
* "path": "/api/v1/token-claims",
|
|
27866
|
+
* "method": "GET"
|
|
27867
|
+
* }
|
|
27868
|
+
* }
|
|
27869
|
+
*/
|
|
27870
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
27871
|
+
};
|
|
27872
|
+
};
|
|
27873
|
+
/** @description Invalid or expired token */
|
|
27874
|
+
401: {
|
|
27875
|
+
headers: {
|
|
27876
|
+
[name: string]: unknown;
|
|
27877
|
+
};
|
|
27878
|
+
content: {
|
|
27879
|
+
/**
|
|
27880
|
+
* @example {
|
|
27881
|
+
* "error": {
|
|
27882
|
+
* "statusCode": 401,
|
|
27883
|
+
* "code": null,
|
|
27884
|
+
* "message": "Invalid or expired token",
|
|
27885
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
27886
|
+
* "path": "/api/v1/token-claims",
|
|
27887
|
+
* "method": "GET"
|
|
27888
|
+
* }
|
|
27889
|
+
* }
|
|
27890
|
+
*/
|
|
27891
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
27892
|
+
};
|
|
27893
|
+
};
|
|
27894
|
+
/** @description The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment */
|
|
27895
|
+
403: {
|
|
27896
|
+
headers: {
|
|
27897
|
+
[name: string]: unknown;
|
|
27898
|
+
};
|
|
27899
|
+
content: {
|
|
27900
|
+
/**
|
|
27901
|
+
* @example {
|
|
27902
|
+
* "error": {
|
|
27903
|
+
* "statusCode": 403,
|
|
27904
|
+
* "code": null,
|
|
27905
|
+
* "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
|
|
27906
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
27907
|
+
* "path": "/api/v1/token-claims",
|
|
27908
|
+
* "method": "GET"
|
|
27909
|
+
* }
|
|
27910
|
+
* }
|
|
27911
|
+
*/
|
|
27912
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
27913
|
+
};
|
|
27914
|
+
};
|
|
27915
|
+
};
|
|
27916
|
+
};
|
|
27917
|
+
ApiTokenClaimsController_replaceTokenClaims: {
|
|
27918
|
+
parameters: {
|
|
27919
|
+
query?: never;
|
|
27920
|
+
header?: {
|
|
27921
|
+
/** @description Optimistic-lock version of the resource. Send the `version` field returned on read; the server rejects with 409 if the row has changed since. */
|
|
27922
|
+
"If-Match"?: string;
|
|
27923
|
+
};
|
|
27924
|
+
path?: never;
|
|
27925
|
+
cookie?: never;
|
|
27926
|
+
};
|
|
27927
|
+
requestBody: {
|
|
27928
|
+
content: {
|
|
27929
|
+
"application/json": components["schemas"]["ReplaceTokenClaimsDto"];
|
|
27930
|
+
};
|
|
27931
|
+
};
|
|
27932
|
+
responses: {
|
|
27933
|
+
/** @description The custom claims mapping, as saved */
|
|
27934
|
+
200: {
|
|
27935
|
+
headers: {
|
|
27936
|
+
[name: string]: unknown;
|
|
27937
|
+
};
|
|
27938
|
+
content: {
|
|
27939
|
+
"application/json": {
|
|
27940
|
+
data: components["schemas"]["TokenClaimsResponseDto"];
|
|
27941
|
+
};
|
|
27942
|
+
};
|
|
27943
|
+
};
|
|
27944
|
+
/** @description The request failed validation, or an entry is refused: a name the JWT or OpenID Connect standards or Canopy already set (`token_claims.reserved_name`), a source outside the allowed fields (`token_claims.source_invalid`), or a name twice on the same token (`token_claims.duplicate_name`), with `error.data` naming the entry's `index` and its `field`; or the request sent both an `X-API-Key` and an `Authorization` header */
|
|
27945
|
+
400: {
|
|
27946
|
+
headers: {
|
|
27947
|
+
[name: string]: unknown;
|
|
27948
|
+
};
|
|
27949
|
+
content: {
|
|
27950
|
+
/**
|
|
27951
|
+
* @example {
|
|
27952
|
+
* "error": {
|
|
27953
|
+
* "statusCode": 400,
|
|
27954
|
+
* "code": null,
|
|
27955
|
+
* "message": "The request failed validation, or an entry is refused: a name the JWT or OpenID Connect standards or Canopy already set (`token_claims.reserved_name`), a source outside the allowed fields (`token_claims.source_invalid`), or a name twice on the same token (`token_claims.duplicate_name`), with `error.data` naming the entry's `index` and its `field`; or the request sent both an `X-API-Key` and an `Authorization` header",
|
|
27956
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
27957
|
+
* "path": "/api/v1/token-claims",
|
|
27958
|
+
* "method": "PUT"
|
|
27959
|
+
* }
|
|
27960
|
+
* }
|
|
27961
|
+
*/
|
|
27962
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
27963
|
+
};
|
|
27964
|
+
};
|
|
27965
|
+
/** @description Invalid or expired token */
|
|
27966
|
+
401: {
|
|
27967
|
+
headers: {
|
|
27968
|
+
[name: string]: unknown;
|
|
27969
|
+
};
|
|
27970
|
+
content: {
|
|
27971
|
+
/**
|
|
27972
|
+
* @example {
|
|
27973
|
+
* "error": {
|
|
27974
|
+
* "statusCode": 401,
|
|
27975
|
+
* "code": null,
|
|
27976
|
+
* "message": "Invalid or expired token",
|
|
27977
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
27978
|
+
* "path": "/api/v1/token-claims",
|
|
27979
|
+
* "method": "GET"
|
|
27980
|
+
* }
|
|
27981
|
+
* }
|
|
27982
|
+
*/
|
|
27983
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
27984
|
+
};
|
|
27985
|
+
};
|
|
27986
|
+
/** @description The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment */
|
|
27987
|
+
403: {
|
|
27988
|
+
headers: {
|
|
27989
|
+
[name: string]: unknown;
|
|
27990
|
+
};
|
|
27991
|
+
content: {
|
|
27992
|
+
/**
|
|
27993
|
+
* @example {
|
|
27994
|
+
* "error": {
|
|
27995
|
+
* "statusCode": 403,
|
|
27996
|
+
* "code": null,
|
|
27997
|
+
* "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
|
|
27998
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
27999
|
+
* "path": "/api/v1/token-claims",
|
|
28000
|
+
* "method": "GET"
|
|
28001
|
+
* }
|
|
28002
|
+
* }
|
|
28003
|
+
*/
|
|
28004
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
28005
|
+
};
|
|
28006
|
+
};
|
|
28007
|
+
/** @description The Environment changed since the version named in `If-Match` was read (`version_mismatch`); the current mapping is in `error.data.current` */
|
|
28008
|
+
409: {
|
|
28009
|
+
headers: {
|
|
28010
|
+
[name: string]: unknown;
|
|
28011
|
+
};
|
|
28012
|
+
content: {
|
|
28013
|
+
/**
|
|
28014
|
+
* @example {
|
|
28015
|
+
* "error": {
|
|
28016
|
+
* "statusCode": 409,
|
|
28017
|
+
* "code": null,
|
|
28018
|
+
* "message": "The Environment changed since the version named in `If-Match` was read (`version_mismatch`); the current mapping is in `error.data.current`",
|
|
28019
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
28020
|
+
* "path": "/api/v1/token-claims",
|
|
28021
|
+
* "method": "PUT"
|
|
28022
|
+
* }
|
|
28023
|
+
* }
|
|
28024
|
+
*/
|
|
28025
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
28026
|
+
};
|
|
28027
|
+
};
|
|
28028
|
+
};
|
|
28029
|
+
};
|
|
27728
28030
|
ApiWebhooksController_list: {
|
|
27729
28031
|
parameters: {
|
|
27730
28032
|
query?: {
|
|
@@ -28563,7 +28865,7 @@ interface operations {
|
|
|
28563
28865
|
};
|
|
28564
28866
|
};
|
|
28565
28867
|
};
|
|
28566
|
-
/** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`)
|
|
28868
|
+
/** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`), takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`) or is asked to be public (`oauth.machine_client_public_invalid`), a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`), or a confidential client registers a private-use scheme redirect (`oauth.redirect_uri_not_allowed_for_client`); or the request sent both an `X-API-Key` and an `Authorization` header */
|
|
28567
28869
|
400: {
|
|
28568
28870
|
headers: {
|
|
28569
28871
|
[name: string]: unknown;
|
|
@@ -28574,7 +28876,7 @@ interface operations {
|
|
|
28574
28876
|
* "error": {
|
|
28575
28877
|
* "statusCode": 400,
|
|
28576
28878
|
* "code": null,
|
|
28577
|
-
* "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`)
|
|
28879
|
+
* "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`), takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`) or is asked to be public (`oauth.machine_client_public_invalid`), a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`), or a confidential client registers a private-use scheme redirect (`oauth.redirect_uri_not_allowed_for_client`); or the request sent both an `X-API-Key` and an `Authorization` header",
|
|
28578
28880
|
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
28579
28881
|
* "path": "/api/v1/oauth-clients",
|
|
28580
28882
|
* "method": "POST"
|
|
@@ -29001,7 +29303,7 @@ interface operations {
|
|
|
29001
29303
|
};
|
|
29002
29304
|
};
|
|
29003
29305
|
};
|
|
29004
|
-
/** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`)
|
|
29306
|
+
/** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`), takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`) or is asked to be public (`oauth.machine_client_public_invalid`), a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`), or a confidential client registers a private-use scheme redirect (`oauth.redirect_uri_not_allowed_for_client`); or the request sent both an `X-API-Key` and an `Authorization` header */
|
|
29005
29307
|
400: {
|
|
29006
29308
|
headers: {
|
|
29007
29309
|
[name: string]: unknown;
|
|
@@ -29012,7 +29314,7 @@ interface operations {
|
|
|
29012
29314
|
* "error": {
|
|
29013
29315
|
* "statusCode": 400,
|
|
29014
29316
|
* "code": null,
|
|
29015
|
-
* "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`)
|
|
29317
|
+
* "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`), takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`) or is asked to be public (`oauth.machine_client_public_invalid`), a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`), or a confidential client registers a private-use scheme redirect (`oauth.redirect_uri_not_allowed_for_client`); or the request sent both an `X-API-Key` and an `Authorization` header",
|
|
29016
29318
|
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
29017
29319
|
* "path": "/api/v1/oauth-clients/{id}",
|
|
29018
29320
|
* "method": "PATCH"
|
|
@@ -29218,6 +29520,27 @@ interface operations {
|
|
|
29218
29520
|
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
29219
29521
|
};
|
|
29220
29522
|
};
|
|
29523
|
+
/** @description The client is public and has no secret to rotate (`oauth.client_public_has_no_secret`) */
|
|
29524
|
+
409: {
|
|
29525
|
+
headers: {
|
|
29526
|
+
[name: string]: unknown;
|
|
29527
|
+
};
|
|
29528
|
+
content: {
|
|
29529
|
+
/**
|
|
29530
|
+
* @example {
|
|
29531
|
+
* "error": {
|
|
29532
|
+
* "statusCode": 409,
|
|
29533
|
+
* "code": null,
|
|
29534
|
+
* "message": "The client is public and has no secret to rotate (`oauth.client_public_has_no_secret`)",
|
|
29535
|
+
* "timestamp": "2026-04-20T12:00:00.000Z",
|
|
29536
|
+
* "path": "/api/v1/oauth-clients/{id}/rotate-secret",
|
|
29537
|
+
* "method": "POST"
|
|
29538
|
+
* }
|
|
29539
|
+
* }
|
|
29540
|
+
*/
|
|
29541
|
+
"application/json": components["schemas"]["ErrorResponseDto"];
|
|
29542
|
+
};
|
|
29543
|
+
};
|
|
29221
29544
|
};
|
|
29222
29545
|
};
|
|
29223
29546
|
ApiOAuthClientsController_listAssignments: {
|
|
@@ -31683,7 +32006,10 @@ interface TokenVerifierOptions {
|
|
|
31683
32006
|
* The claims Canopy puts in an access token.
|
|
31684
32007
|
*
|
|
31685
32008
|
* Named claims are the ones the API guarantees; the index signature keeps
|
|
31686
|
-
* anything added later reachable without a version bump.
|
|
32009
|
+
* anything added later reachable without a version bump. The Environment's
|
|
32010
|
+
* custom claims (a `plan` copied from the identity's metadata, say) arrive
|
|
32011
|
+
* through it too; name them to {@link TokenVerifier.verify} to read them
|
|
32012
|
+
* typed.
|
|
31687
32013
|
*/
|
|
31688
32014
|
interface CanopyTokenClaims {
|
|
31689
32015
|
/**
|
|
@@ -31755,6 +32081,14 @@ interface CanopyTokenClaims {
|
|
|
31755
32081
|
* the session is inside an organization.
|
|
31756
32082
|
*/
|
|
31757
32083
|
org_scope?: "all";
|
|
32084
|
+
/**
|
|
32085
|
+
* True when the Environment's custom claims did not all fit on this token:
|
|
32086
|
+
* they are added in the mapping's order within a size limit, and the ones
|
|
32087
|
+
* past it are left out. A missing custom claim is then "unknown", not
|
|
32088
|
+
* "not set"; read it from the API (the identity's or organization's
|
|
32089
|
+
* metadata) instead of treating the token as complete.
|
|
32090
|
+
*/
|
|
32091
|
+
custom_claims_overflow?: boolean;
|
|
31758
32092
|
[claim: string]: unknown;
|
|
31759
32093
|
}
|
|
31760
32094
|
/** What one call to {@link TokenVerifier.verify} may widen. */
|
|
@@ -31835,8 +32169,14 @@ declare class TokenVerifier {
|
|
|
31835
32169
|
*
|
|
31836
32170
|
* Order matters: the signature is checked before any claim is believed, so
|
|
31837
32171
|
* nothing downstream ever reads an unverified payload.
|
|
32172
|
+
*
|
|
32173
|
+
* `TCustom` names the Environment's custom claims, so they read typed off
|
|
32174
|
+
* the result: `verify<{ plan?: "free" | "pro" }>(token)`. It is a
|
|
32175
|
+
* declaration, not a check: a custom claim is absent when its value is not
|
|
32176
|
+
* stored, or when it did not fit (`custom_claims_overflow`), so keep each
|
|
32177
|
+
* one optional.
|
|
31838
32178
|
*/
|
|
31839
|
-
verify(token: string, options?: VerifyCallOptions): Promise<CanopyTokenClaims>;
|
|
32179
|
+
verify<TCustom extends object = object>(token: string, options?: VerifyCallOptions): Promise<CanopyTokenClaims & TCustom>;
|
|
31840
32180
|
/** Everything checked after the signature is known good. */
|
|
31841
32181
|
private assertClaims;
|
|
31842
32182
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2317,6 +2317,12 @@ var TokenVerifier = class {
|
|
|
2317
2317
|
*
|
|
2318
2318
|
* Order matters: the signature is checked before any claim is believed, so
|
|
2319
2319
|
* nothing downstream ever reads an unverified payload.
|
|
2320
|
+
*
|
|
2321
|
+
* `TCustom` names the Environment's custom claims, so they read typed off
|
|
2322
|
+
* the result: `verify<{ plan?: "free" | "pro" }>(token)`. It is a
|
|
2323
|
+
* declaration, not a check: a custom claim is absent when its value is not
|
|
2324
|
+
* stored, or when it did not fit (`custom_claims_overflow`), so keep each
|
|
2325
|
+
* one optional.
|
|
2320
2326
|
*/
|
|
2321
2327
|
async verify(token, options = {}) {
|
|
2322
2328
|
const parts = token.split(".");
|