@cauthyhq/spec 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/cauthy.d.ts +524 -2
  2. package/package.json +1 -1
package/cauthy.d.ts CHANGED
@@ -1610,6 +1610,26 @@ export interface paths {
1610
1610
  patch?: never;
1611
1611
  trace?: never;
1612
1612
  };
1613
+ "/v1/connect/self": {
1614
+ parameters: {
1615
+ query?: never;
1616
+ header?: never;
1617
+ path?: never;
1618
+ cookie?: never;
1619
+ };
1620
+ /**
1621
+ * Who the calling application is (CAUTHY_KEY)
1622
+ * @description Asked by an application with its own token (the `client_credentials` token it gets with its `CAUTHY_KEY` assertion, the same token it sends as `X-Cauthy-System-Token`): its workspace, its system, its client and the client people sign in through, the origins of its registered return addresses (development first), the return path, the key it last proved itself with, and its contract when a link of the contracts graph names it. `X-Tenant-Key` is optional with a system's token. Cacheable for five minutes (`Cache-Control: private, max-age=300`) and revalidated with its `ETag` (`If-None-Match` answers 304). Nothing in it is secret.
1623
+ */
1624
+ get: operations["getConnectSelf"];
1625
+ put?: never;
1626
+ post?: never;
1627
+ delete?: never;
1628
+ options?: never;
1629
+ head?: never;
1630
+ patch?: never;
1631
+ trace?: never;
1632
+ };
1613
1633
  "/v1/pact/status": {
1614
1634
  parameters: {
1615
1635
  query?: never;
@@ -1690,6 +1710,70 @@ export interface paths {
1690
1710
  patch: operations["updateOAuthClient"];
1691
1711
  trace?: never;
1692
1712
  };
1713
+ "/v1/oauth/clients/{client_id}/keys": {
1714
+ parameters: {
1715
+ query?: never;
1716
+ header?: never;
1717
+ path?: never;
1718
+ cookie?: never;
1719
+ };
1720
+ /**
1721
+ * List a client's keys (CAUTHY_KEY)
1722
+ * @description The public keys the client authenticates with (`private_key_jwt`, `EdDSA`), newest first: the current one, the previous one of a rotation until it retires, and the revoked ones. Never more than each key's `kid`. Requires `oauth_clients:manage`.
1723
+ */
1724
+ get: operations["listOAuthClientKeys"];
1725
+ put?: never;
1726
+ /**
1727
+ * Register a client's key (a new key, or a rotation)
1728
+ * @description Registers the public half of a `CAUTHY_KEY` made in the browser as the client's current key; from then on the client may authenticate with it, and needs no secret. Every key that was active keeps working for `keep_previous` (24 hours by default, 7 days, or `none`: refused at once). Cauthy computes the `kid` (RFC 7638) and refuses a key another client of the workspace holds. Audited as `client.key.added`. Requires `oauth_clients:manage`.
1729
+ */
1730
+ post: operations["addOAuthClientKey"];
1731
+ delete?: never;
1732
+ options?: never;
1733
+ head?: never;
1734
+ patch?: never;
1735
+ trace?: never;
1736
+ };
1737
+ "/v1/oauth/clients/{client_id}/keys/{kid}": {
1738
+ parameters: {
1739
+ query?: never;
1740
+ header?: never;
1741
+ path?: never;
1742
+ cookie?: never;
1743
+ };
1744
+ get?: never;
1745
+ put?: never;
1746
+ post?: never;
1747
+ /**
1748
+ * Revoke a client's key
1749
+ * @description The key is refused from now on. Revoking the last active key is allowed: `active_keys` 0 says the application can no longer sign in until it gets a new key. Audited as `client.key.revoked`. Requires `oauth_clients:manage`.
1750
+ */
1751
+ delete: operations["revokeOAuthClientKey"];
1752
+ options?: never;
1753
+ head?: never;
1754
+ patch?: never;
1755
+ trace?: never;
1756
+ };
1757
+ "/v1/oauth/clients/{client_id}/secret": {
1758
+ parameters: {
1759
+ query?: never;
1760
+ header?: never;
1761
+ path?: never;
1762
+ cookie?: never;
1763
+ };
1764
+ get?: never;
1765
+ put?: never;
1766
+ post?: never;
1767
+ /**
1768
+ * Remove a client's secret
1769
+ * @description Removes the secret (and a rotation's previous one) of a client that has an active key: the last step of moving an application from its variables to `CAUTHY_KEY`. Audited as `client.secret.removed`. Requires `oauth_clients:manage`.
1770
+ */
1771
+ delete: operations["removeOAuthClientSecret"];
1772
+ options?: never;
1773
+ head?: never;
1774
+ patch?: never;
1775
+ trace?: never;
1776
+ };
1693
1777
  "/v1/oauth/clients/{client_id}/theme": {
1694
1778
  parameters: {
1695
1779
  query?: never;
@@ -1841,7 +1925,7 @@ export interface paths {
1841
1925
  put?: never;
1842
1926
  /**
1843
1927
  * Token endpoint
1844
- * @description Grants: `authorization_code` (with `code_verifier` for PKCE), `refresh_token` (rotating: the answer carries the next refresh token), `client_credentials` (service clients; with a secret or a `private_key_jwt` assertion), and token exchange (`urn:ietf:params:oauth:grant-type:token-exchange`, RFC 8693) for a workspace server's client. Client authentication: `client_secret_post`, `client_secret_basic`, `private_key_jwt`, or none for public clients and AI agents. The workspace is the client's own; X-Tenant-Key is optional.
1928
+ * @description Grants: `authorization_code` (with `code_verifier` for PKCE), `refresh_token` (rotating: the answer carries the next refresh token), `client_credentials` (service clients; with a secret or a `private_key_jwt` assertion), and token exchange (`urn:ietf:params:oauth:grant-type:token-exchange`, RFC 8693) for a workspace server's client. Client authentication: `client_secret_post`, `client_secret_basic`, `private_key_jwt`, or none for public clients and AI agents. `private_key_jwt` takes RS256 (keys the client publishes at its `jwks_uri`) or EdDSA (a key registered on the client: CAUTHY_KEY). A client with a registered key and no secret is confidential: every grant it uses, and `/v1/oauth/revoke`, need its assertion. The workspace is the client's own; X-Tenant-Key is optional.
1845
1929
  *
1846
1930
  * Every error comes as RFC 6749 §5.2 `{error, error_description}` with `Cache-Control: no-store`, never in Cauthy's error envelope. An `invalid_client` for a client that sent HTTP Basic carries `WWW-Authenticate: Basic`.
1847
1931
  */
@@ -2657,6 +2741,92 @@ export interface components {
2657
2741
  audit_retention_days?: number;
2658
2742
  consent_purposes?: components["schemas"]["WorkspaceConsentPurpose"][];
2659
2743
  };
2744
+ /** @description A client's registered key (CAUTHY_KEY). Only its kid is ever shown. */
2745
+ ClientKey: {
2746
+ /** @description RFC 7638 thumbprint of the public key. */
2747
+ kid: string;
2748
+ /** Format: date-time */
2749
+ created_at: string;
2750
+ /**
2751
+ * Format: date-time
2752
+ * @description The previous key of a rotation is accepted until then.
2753
+ */
2754
+ retires_at?: string | null;
2755
+ /** Format: date-time */
2756
+ revoked_at?: string | null;
2757
+ /** Format: date-time */
2758
+ last_used_at?: string | null;
2759
+ /** @description The key the application should sign with. */
2760
+ current: boolean;
2761
+ };
2762
+ AddClientKeyRequest: {
2763
+ /** @description The public half of the new `CAUTHY_KEY`, as an object or as a JSON string. */
2764
+ public_jwk: components["schemas"]["PublicJWK"] | string;
2765
+ /**
2766
+ * @description How long the keys it replaces keep working. Default `24h`.
2767
+ * @enum {string}
2768
+ */
2769
+ keep_previous?: "24h" | "7d" | "none";
2770
+ };
2771
+ AddClientKeyResponse: {
2772
+ kid?: string;
2773
+ /** Format: date-time */
2774
+ created_at?: string;
2775
+ /** @description The keys that were active before, as they stand now. */
2776
+ previous?: {
2777
+ kid?: string;
2778
+ /** Format: date-time */
2779
+ retires_at?: string | null;
2780
+ /** Format: date-time */
2781
+ revoked_at?: string | null;
2782
+ }[];
2783
+ };
2784
+ /** @description An Ed25519 public key (RFC 8037). `kid`, `alg` and `use` are ignored: Cauthy computes the `kid` itself (RFC 7638 thumbprint). A private member (`d`…) or any other member is refused. */
2785
+ PublicJWK: {
2786
+ /** @enum {string} */
2787
+ kty: "OKP";
2788
+ /** @enum {string} */
2789
+ crv: "Ed25519";
2790
+ /** @description The 32-byte public key, base64url without padding. */
2791
+ x: string;
2792
+ };
2793
+ /** @description Who an application is, as Cauthy holds it (CAUTHY_KEY). */
2794
+ ConnectSelf: {
2795
+ /** @description The issuer of the tokens the application verifies. */
2796
+ issuer: string;
2797
+ /** @description The audience of those tokens. */
2798
+ audience: string;
2799
+ tenant: {
2800
+ /** Format: uuid */
2801
+ id?: string;
2802
+ slug?: string;
2803
+ };
2804
+ system: string;
2805
+ /** @description The client the key authenticates. */
2806
+ client_id: string;
2807
+ /** @description The client people sign in through (`pact.<link>` with a contract; else `client_id`). */
2808
+ sign_in_client_id: string;
2809
+ /** @description The origins of the sign-in client's return addresses, in registration order. */
2810
+ app_urls: string[];
2811
+ /** @description The path of its first return address; `/api/auth/callback` by default. */
2812
+ callback_path: string;
2813
+ /** @description The key the application last signed an assertion with. */
2814
+ key?: {
2815
+ kid?: string;
2816
+ /** Format: date-time */
2817
+ retires_at?: string | null;
2818
+ } | null;
2819
+ /** @description The application's contract, when a link of the contracts graph names it. */
2820
+ contract?: {
2821
+ link?: string;
2822
+ /** @enum {string} */
2823
+ system_proof?: "off" | "auto" | "required";
2824
+ require_verified_email?: boolean;
2825
+ in_step?: boolean;
2826
+ /** Format: date-time */
2827
+ checked_at?: string | null;
2828
+ } | null;
2829
+ };
2660
2830
  /** @description How one contracted system stands against its contract, checked now. */
2661
2831
  PactStatus: {
2662
2832
  system: string;
@@ -2677,6 +2847,17 @@ export interface components {
2677
2847
  * @description When the daily reconciliation last checked this system; null before the first.
2678
2848
  */
2679
2849
  reconciled_at: string | null;
2850
+ keys?: components["schemas"]["PactKeys"];
2851
+ };
2852
+ /** @description The CAUTHY_KEY of the system's service client: the kids registered on it and the EdDSA kids published at its jwks_url (the key set last read). Absent while the client has no registered key (RS256 keys only). A kid on one side only is also a `key` item of `missing` or `outside`. */
2853
+ PactKeys: {
2854
+ registered?: string[];
2855
+ published?: string[];
2856
+ /** @description Registered, not published, so the application is not deployed with the key. */
2857
+ missing?: string[];
2858
+ /** @description Published, not registered. */
2859
+ outside?: string[];
2860
+ matches?: boolean;
2680
2861
  };
2681
2862
  PactContract: {
2682
2863
  clients: components["schemas"]["PactContractClient"][];
@@ -2729,7 +2910,7 @@ export interface components {
2729
2910
  };
2730
2911
  /** @description One difference between the contract and what Cauthy holds. */
2731
2912
  PactItem: {
2732
- /** @description What differs: client, redirect_uri, grant_type, role, organization, require_system_proof, system_proof, system_proof_required_at, require_verified_email, persistent_sessions or jwks_url. */
2913
+ /** @description What differs: client, redirect_uri, grant_type, role, organization, require_system_proof, system_proof, system_proof_required_at, require_verified_email, persistent_sessions, jwks_url or key. */
2733
2914
  kind: string;
2734
2915
  /** @description The client it is on, when it is on one. */
2735
2916
  client_id?: string;
@@ -8478,6 +8659,71 @@ export interface operations {
8478
8659
  401: components["responses"]["Unauthorized"];
8479
8660
  };
8480
8661
  };
8662
+ getConnectSelf: {
8663
+ parameters: {
8664
+ query?: never;
8665
+ header?: {
8666
+ /** @description Optional with a system's own token, which names its workspace. */
8667
+ "X-Tenant-Key"?: string;
8668
+ /** @description The `ETag` of the last answer. */
8669
+ "If-None-Match"?: string;
8670
+ };
8671
+ path?: never;
8672
+ cookie?: never;
8673
+ };
8674
+ requestBody?: never;
8675
+ responses: {
8676
+ /** @description Who the application is. */
8677
+ 200: {
8678
+ headers: {
8679
+ /** @description Strong validator of the answer. */
8680
+ ETag?: string;
8681
+ /** @description `private, max-age=300`. */
8682
+ "Cache-Control"?: string;
8683
+ [name: string]: unknown;
8684
+ };
8685
+ content: {
8686
+ "application/json": {
8687
+ data: components["schemas"]["ConnectSelf"];
8688
+ };
8689
+ };
8690
+ };
8691
+ /** @description Unchanged since the `ETag` sent in `If-None-Match`. */
8692
+ 304: {
8693
+ headers: {
8694
+ [name: string]: unknown;
8695
+ };
8696
+ content?: never;
8697
+ };
8698
+ /** @description `unauthorized`: no token, or an invalid one. */
8699
+ 401: {
8700
+ headers: {
8701
+ [name: string]: unknown;
8702
+ };
8703
+ content: {
8704
+ "application/json": components["schemas"]["ApiError"];
8705
+ };
8706
+ };
8707
+ /** @description `not_a_system_token`: a person's token; `outside_system_scope`. */
8708
+ 403: {
8709
+ headers: {
8710
+ [name: string]: unknown;
8711
+ };
8712
+ content: {
8713
+ "application/json": components["schemas"]["ApiError"];
8714
+ };
8715
+ };
8716
+ /** @description `client_inactive`: the application's client is gone or turned off. */
8717
+ 410: {
8718
+ headers: {
8719
+ [name: string]: unknown;
8720
+ };
8721
+ content: {
8722
+ "application/json": components["schemas"]["ApiError"];
8723
+ };
8724
+ };
8725
+ };
8726
+ };
8481
8727
  getPactStatus: {
8482
8728
  parameters: {
8483
8729
  query?: {
@@ -8752,6 +8998,278 @@ export interface operations {
8752
8998
  };
8753
8999
  };
8754
9000
  };
9001
+ listOAuthClientKeys: {
9002
+ parameters: {
9003
+ query?: never;
9004
+ header: {
9005
+ /** @description Tenant slug. Identifies the data isolation context. */
9006
+ "X-Tenant-Key": components["parameters"]["TenantKey"];
9007
+ };
9008
+ path: {
9009
+ /** @description The client's id. */
9010
+ client_id: string;
9011
+ };
9012
+ cookie?: never;
9013
+ };
9014
+ requestBody?: never;
9015
+ responses: {
9016
+ /** @description The client's keys. */
9017
+ 200: {
9018
+ headers: {
9019
+ [name: string]: unknown;
9020
+ };
9021
+ content: {
9022
+ "application/json": {
9023
+ data: components["schemas"]["ClientKey"][];
9024
+ };
9025
+ };
9026
+ };
9027
+ /** @description `unauthorized`: missing or invalid token. */
9028
+ 401: {
9029
+ headers: {
9030
+ [name: string]: unknown;
9031
+ };
9032
+ content: {
9033
+ "application/json": components["schemas"]["ApiError"];
9034
+ };
9035
+ };
9036
+ /** @description `forbidden`: lacks `oauth_clients:manage`. */
9037
+ 403: {
9038
+ headers: {
9039
+ [name: string]: unknown;
9040
+ };
9041
+ content: {
9042
+ "application/json": components["schemas"]["ApiError"];
9043
+ };
9044
+ };
9045
+ /** @description No such client. */
9046
+ 404: {
9047
+ headers: {
9048
+ [name: string]: unknown;
9049
+ };
9050
+ content: {
9051
+ "application/json": components["schemas"]["ApiError"];
9052
+ };
9053
+ };
9054
+ /** @description `from_contract`: a contract's sign-in client; keys go on its service client. */
9055
+ 409: {
9056
+ headers: {
9057
+ [name: string]: unknown;
9058
+ };
9059
+ content: {
9060
+ "application/json": components["schemas"]["ApiError"];
9061
+ };
9062
+ };
9063
+ };
9064
+ };
9065
+ addOAuthClientKey: {
9066
+ parameters: {
9067
+ query?: never;
9068
+ header: {
9069
+ /** @description Tenant slug. Identifies the data isolation context. */
9070
+ "X-Tenant-Key": components["parameters"]["TenantKey"];
9071
+ };
9072
+ path: {
9073
+ /** @description The client's id. */
9074
+ client_id: string;
9075
+ };
9076
+ cookie?: never;
9077
+ };
9078
+ requestBody: {
9079
+ content: {
9080
+ "application/json": components["schemas"]["AddClientKeyRequest"];
9081
+ };
9082
+ };
9083
+ responses: {
9084
+ /** @description The key, and the keys it replaced as they stand now. */
9085
+ 201: {
9086
+ headers: {
9087
+ [name: string]: unknown;
9088
+ };
9089
+ content: {
9090
+ "application/json": {
9091
+ data: components["schemas"]["AddClientKeyResponse"];
9092
+ };
9093
+ };
9094
+ };
9095
+ /** @description `bad_request`; `invalid_public_key` (not an Ed25519 public key, or it holds a private member); `invalid_keep_previous`. */
9096
+ 400: {
9097
+ headers: {
9098
+ [name: string]: unknown;
9099
+ };
9100
+ content: {
9101
+ "application/json": components["schemas"]["ApiError"];
9102
+ };
9103
+ };
9104
+ /** @description `unauthorized`: missing or invalid token. */
9105
+ 401: {
9106
+ headers: {
9107
+ [name: string]: unknown;
9108
+ };
9109
+ content: {
9110
+ "application/json": components["schemas"]["ApiError"];
9111
+ };
9112
+ };
9113
+ /** @description `forbidden`: lacks `oauth_clients:manage`. */
9114
+ 403: {
9115
+ headers: {
9116
+ [name: string]: unknown;
9117
+ };
9118
+ content: {
9119
+ "application/json": components["schemas"]["ApiError"];
9120
+ };
9121
+ };
9122
+ /** @description No such client. */
9123
+ 404: {
9124
+ headers: {
9125
+ [name: string]: unknown;
9126
+ };
9127
+ content: {
9128
+ "application/json": components["schemas"]["ApiError"];
9129
+ };
9130
+ };
9131
+ /** @description `key_in_use` (the key is already an application's of the workspace); `from_contract` (a contract's sign-in client). */
9132
+ 409: {
9133
+ headers: {
9134
+ [name: string]: unknown;
9135
+ };
9136
+ content: {
9137
+ "application/json": components["schemas"]["ApiError"];
9138
+ };
9139
+ };
9140
+ };
9141
+ };
9142
+ revokeOAuthClientKey: {
9143
+ parameters: {
9144
+ query?: never;
9145
+ header: {
9146
+ /** @description Tenant slug. Identifies the data isolation context. */
9147
+ "X-Tenant-Key": components["parameters"]["TenantKey"];
9148
+ };
9149
+ path: {
9150
+ /** @description The client's id. */
9151
+ client_id: string;
9152
+ /** @description The key's `kid`. */
9153
+ kid: string;
9154
+ };
9155
+ cookie?: never;
9156
+ };
9157
+ requestBody?: never;
9158
+ responses: {
9159
+ /** @description The key revoked, and how many stay active. */
9160
+ 200: {
9161
+ headers: {
9162
+ [name: string]: unknown;
9163
+ };
9164
+ content: {
9165
+ "application/json": {
9166
+ data: {
9167
+ kid?: string;
9168
+ /** Format: date-time */
9169
+ revoked_at?: string;
9170
+ active_keys?: number;
9171
+ };
9172
+ };
9173
+ };
9174
+ };
9175
+ /** @description `unauthorized`: missing or invalid token. */
9176
+ 401: {
9177
+ headers: {
9178
+ [name: string]: unknown;
9179
+ };
9180
+ content: {
9181
+ "application/json": components["schemas"]["ApiError"];
9182
+ };
9183
+ };
9184
+ /** @description `forbidden`: lacks `oauth_clients:manage`. */
9185
+ 403: {
9186
+ headers: {
9187
+ [name: string]: unknown;
9188
+ };
9189
+ content: {
9190
+ "application/json": components["schemas"]["ApiError"];
9191
+ };
9192
+ };
9193
+ /** @description `key_not_found` (no such key, or already revoked); no such client. */
9194
+ 404: {
9195
+ headers: {
9196
+ [name: string]: unknown;
9197
+ };
9198
+ content: {
9199
+ "application/json": components["schemas"]["ApiError"];
9200
+ };
9201
+ };
9202
+ /** @description `from_contract`: a contract's sign-in client. */
9203
+ 409: {
9204
+ headers: {
9205
+ [name: string]: unknown;
9206
+ };
9207
+ content: {
9208
+ "application/json": components["schemas"]["ApiError"];
9209
+ };
9210
+ };
9211
+ };
9212
+ };
9213
+ removeOAuthClientSecret: {
9214
+ parameters: {
9215
+ query?: never;
9216
+ header: {
9217
+ /** @description Tenant slug. Identifies the data isolation context. */
9218
+ "X-Tenant-Key": components["parameters"]["TenantKey"];
9219
+ };
9220
+ path: {
9221
+ /** @description The client's id. */
9222
+ client_id: string;
9223
+ };
9224
+ cookie?: never;
9225
+ };
9226
+ requestBody?: never;
9227
+ responses: {
9228
+ /** @description The secret is gone; the client authenticates only with its keys. */
9229
+ 204: {
9230
+ headers: {
9231
+ [name: string]: unknown;
9232
+ };
9233
+ content?: never;
9234
+ };
9235
+ /** @description `unauthorized`: missing or invalid token. */
9236
+ 401: {
9237
+ headers: {
9238
+ [name: string]: unknown;
9239
+ };
9240
+ content: {
9241
+ "application/json": components["schemas"]["ApiError"];
9242
+ };
9243
+ };
9244
+ /** @description `forbidden`: lacks `oauth_clients:manage`. */
9245
+ 403: {
9246
+ headers: {
9247
+ [name: string]: unknown;
9248
+ };
9249
+ content: {
9250
+ "application/json": components["schemas"]["ApiError"];
9251
+ };
9252
+ };
9253
+ /** @description No such client. */
9254
+ 404: {
9255
+ headers: {
9256
+ [name: string]: unknown;
9257
+ };
9258
+ content: {
9259
+ "application/json": components["schemas"]["ApiError"];
9260
+ };
9261
+ };
9262
+ /** @description `no_key`: register a key first, since removing the secret would lock the application out; `from_contract`. */
9263
+ 409: {
9264
+ headers: {
9265
+ [name: string]: unknown;
9266
+ };
9267
+ content: {
9268
+ "application/json": components["schemas"]["ApiError"];
9269
+ };
9270
+ };
9271
+ };
9272
+ };
8755
9273
  getOAuthClientTheme: {
8756
9274
  parameters: {
8757
9275
  query?: never;
@@ -9097,6 +9615,10 @@ export interface operations {
9097
9615
  client_id?: string;
9098
9616
  /** @description The client's secret, for a confidential client. May come in HTTP Basic instead. */
9099
9617
  client_secret?: string;
9618
+ /** @description `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` for private_key_jwt (RFC 7523): how a client with a registered key (CAUTHY_KEY) authenticates here. */
9619
+ client_assertion_type?: string;
9620
+ /** @description The signed JWT that authenticates the client (`aud` is the token endpoint). */
9621
+ client_assertion?: string;
9100
9622
  };
9101
9623
  };
9102
9624
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cauthyhq/spec",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript types of Cauthy's public API and of the auth-bff protocol, generated from cauthy-sdk-spec.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Vennet Developers",