@1claw/sdk 0.20.1 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -79,14 +79,14 @@ await client.auth.resetPassword({ token: "...", new_password: "..." });
79
79
  | `client.vault` | `create`, `get`, `list`, `delete`, `enableMpc`, `disableMpc` |
80
80
  | `client.secrets` | `set`, `get`, `delete`, `list`, `rotate` |
81
81
  | `client.access` | `grantHuman`, `grantAgent`, `update`, `revoke`, `listGrants` |
82
- | `client.agents` | `create`, `getSelf`, `get`, `list`, `update`, `delete`, `rotateKey`, `submitTransaction`, `signTransaction`, `getTransaction`, `listTransactions`, `simulateTransaction`, `simulateBundle` |
82
+ | `client.agents` | `enroll` (also `AgentsResource.enroll(baseUrl, …)` static), `create`, `getSelf`, `get`, `list`, `update`, `delete`, `rotateKey`, `rotateIdentityKeys`, `submitTransaction`, `signTransaction`, `getTransaction`, `listTransactions`, `simulateTransaction`, `simulateBundle` |
83
83
  | `client.chains` | `list`, `get`, `adminList`, `create`, `update`, `delete` |
84
84
  | `client.sharing` | `create`, `access`, `listOutbound`, `listInbound`, `accept`, `decline`, `revoke` |
85
85
  | `client.approvals` | `request`, `list`, `approve`, `deny`, `check`, `subscribe` |
86
86
  | `client.billing` | `usage`, `history`, `llmTokenBilling`, `subscribeLlmTokenBilling`, `disableLlmTokenBilling` (LLM token billing / Stripe AI Gateway) |
87
87
  | `client.audit` | `query` |
88
88
  | `client.org` | `listMembers`, `getAgentKeysVault`, `updateMemberRole`, `removeMember` |
89
- | `client.auth` | `login`, `signup`, `agentToken`, `apiKeyToken`, `google`, `changePassword`, `logout`, `getMe`, `updateMe`, `deleteMe` |
89
+ | `client.auth` | `login`, `signup`, `agentToken`, `apiKeyToken`, `google`, `changePassword`, `forgotPassword`, `resetPassword`, `exportData`, `exchangeFederatedToken`, `logout`, `getMe`, `updateMe`, `deleteMe` |
90
90
  | `client.apiKeys` | `create`, `list`, `revoke` |
91
91
  | `client.treasury` | `create`, `list`, `get`, `update`, `delete`, `addSigner`, `removeSigner`, `requestAccess`, `listAccessRequests`, `approveAccess`, `denyAccess` |
92
92
  | `client.x402` | `getPaymentRequirement`, `pay`, `verifyReceipt`, `withPayment` |
@@ -225,6 +225,29 @@ Key properties:
225
225
  - **Every transaction is audit-logged** with full calldata
226
226
  - **Revocable instantly** — set `intents_api_enabled: false` to cut off access
227
227
 
228
+ ## OIDC Federation (Anthropic WIF, GCP STS, AWS STS)
229
+
230
+ `https://api.1claw.xyz` is a fully OpenID Connect–compliant issuer. External relying parties — Anthropic Workload Identity Federation, GCP STS, AWS STS, Stytch, etc. — can validate 1claw-issued JWTs by fetching:
231
+
232
+ - `GET https://api.1claw.xyz/.well-known/openid-configuration`
233
+ - `GET https://api.1claw.xyz/.well-known/jwks.json`
234
+
235
+ The SDK exposes one method to mint a federation token:
236
+
237
+ ```typescript
238
+ const tokenRes = await client.auth.exchangeFederatedToken({
239
+ audience: "https://api.anthropic.com",
240
+ // subjectToken? — defaults to the client's current login or apiKey
241
+ // scope? — optional space-separated subset of agent's scopes
242
+ });
243
+
244
+ const oidcJwt = tokenRes.data?.access_token; // RS256-signed; ~15 min default TTL, hard cap 1h
245
+ ```
246
+
247
+ The acting agent must have `federation_enabled: true` and the `audience` must be on its `federation_audiences` allowlist (set via dashboard or `client.agents.update`). Every active KMS key version is published in JWKS, so verifiers reject unknown `kid`s automatically when 1claw rotates keys.
248
+
249
+ End-to-end Anthropic WIF demo: [`examples/anthropic-wif`](https://github.com/1clawAI/1claw-examples/tree/main/anthropic-wif).
250
+
228
251
  ## Customer-Managed Encryption Keys (CMEK)
229
252
 
230
253
  For enterprises that require cryptographic proof that 1claw cannot access their secrets unilaterally, the SDK provides client-side CMEK utilities. Keys are generated and managed entirely on your side — only the SHA-256 fingerprint is stored on the server.
@@ -98,6 +98,12 @@ export interface paths {
98
98
  * @description Returns the Ed25519 public key used to sign JWTs.
99
99
  * Use this to verify tokens independently (e.g. in a TEE proxy or
100
100
  * gateway). No authentication required.
101
+ *
102
+ * For OIDC-compliant relying parties (Anthropic Workload Identity
103
+ * Federation, etc.) prefer the JWKS endpoint at
104
+ * `/.well-known/jwks.json` together with the discovery document
105
+ * at `/.well-known/openid-configuration` — those advertise both
106
+ * Ed25519 and RS256 keys keyed by `kid` and survive key rotation.
101
107
  */
102
108
  get: operations["getJwtPublicKey"];
103
109
  put?: never;
@@ -108,6 +114,90 @@ export interface paths {
108
114
  patch?: never;
109
115
  trace?: never;
110
116
  };
117
+ "/v1/auth/federated-token": {
118
+ parameters: {
119
+ query?: never;
120
+ header?: never;
121
+ path?: never;
122
+ cookie?: never;
123
+ };
124
+ get?: never;
125
+ put?: never;
126
+ /**
127
+ * Exchange a 1claw token for an OIDC federation token (RFC 8693)
128
+ * @description Mints a short-lived RS256-signed JWT targeted at an external
129
+ * relying party (e.g. Anthropic Workload Identity Federation).
130
+ * The relying party validates the token via this issuer's JWKS
131
+ * URL (`/.well-known/jwks.json`) and exchanges it for its own
132
+ * short-lived service credentials.
133
+ *
134
+ * Requirements:
135
+ * - The agent that owns the `subject_token` must have
136
+ * `federation_enabled = true` and the requested `audience`
137
+ * must appear in `federation_audiences`.
138
+ * - The `subject_token` must be a valid 1claw agent JWT or
139
+ * `ocv_` API key.
140
+ * - Optional `scope` narrows the agent's existing scopes — it
141
+ * cannot escalate.
142
+ *
143
+ * Returns 503 when `ONECLAW_JWT_RS256_SIGNING_KEY_ID` is not
144
+ * configured on the server.
145
+ */
146
+ post: operations["exchangeFederatedToken"];
147
+ delete?: never;
148
+ options?: never;
149
+ head?: never;
150
+ patch?: never;
151
+ trace?: never;
152
+ };
153
+ "/.well-known/openid-configuration": {
154
+ parameters: {
155
+ query?: never;
156
+ header?: never;
157
+ path?: never;
158
+ cookie?: never;
159
+ };
160
+ /**
161
+ * OIDC discovery document
162
+ * @description Standard OpenID Connect discovery document advertising the
163
+ * issuer URL, JWKS URL, supported algorithms (`EdDSA`, `RS256`),
164
+ * and the RFC 8693 token-exchange endpoint. External IdPs
165
+ * (Anthropic WIF, Okta, Auth0, etc.) read this URL to learn
166
+ * where 1claw publishes its JWKS.
167
+ */
168
+ get: operations["openidConfiguration"];
169
+ put?: never;
170
+ post?: never;
171
+ delete?: never;
172
+ options?: never;
173
+ head?: never;
174
+ patch?: never;
175
+ trace?: never;
176
+ };
177
+ "/.well-known/jwks.json": {
178
+ parameters: {
179
+ query?: never;
180
+ header?: never;
181
+ path?: never;
182
+ cookie?: never;
183
+ };
184
+ /**
185
+ * JSON Web Key Set
186
+ * @description Public keys for every active version of every JWT signing
187
+ * key (Ed25519 + RSA-2048). Each entry includes a `kid` so
188
+ * consumers can validate tokens issued before the most recent
189
+ * key rotation. Cached for 5 minutes via `Cache-Control` and
190
+ * CORS-permissive for browser-based IdP consoles.
191
+ */
192
+ get: operations["jwks"];
193
+ put?: never;
194
+ post?: never;
195
+ delete?: never;
196
+ options?: never;
197
+ head?: never;
198
+ patch?: never;
199
+ trace?: never;
200
+ };
111
201
  "/v1/auth/signup": {
112
202
  parameters: {
113
203
  query?: never;
@@ -2042,6 +2132,38 @@ export interface components {
2042
2132
  UserApiKeyTokenRequest: {
2043
2133
  api_key: string;
2044
2134
  };
2135
+ /**
2136
+ * @description RFC 8693 token-exchange request body. `subject_token_type`
2137
+ * accepts the standard JWT URI or 1claw's API-key URI:
2138
+ * - `urn:ietf:params:oauth:token-type:jwt`
2139
+ * - `urn:1claw:params:oauth:token-type:api-key`
2140
+ */
2141
+ TokenExchangeRequest: {
2142
+ /** @enum {string} */
2143
+ grant_type: "urn:ietf:params:oauth:grant-type:token-exchange";
2144
+ /** @description 1claw JWT or `ocv_` API key authorising the exchange. */
2145
+ subject_token: string;
2146
+ /** @enum {string} */
2147
+ subject_token_type: "urn:ietf:params:oauth:token-type:jwt" | "urn:1claw:params:oauth:token-type:api-key";
2148
+ /**
2149
+ * Format: uri
2150
+ * @description Required `aud` claim for the issued federation token (must be in agent's allowlist).
2151
+ * @example https://api.anthropic.com
2152
+ */
2153
+ audience: string;
2154
+ /** @description Optional space-separated subset of the agent's existing scopes. */
2155
+ scope?: string;
2156
+ /** @description Optional. Defaults to `urn:ietf:params:oauth:token-type:jwt`. */
2157
+ requested_token_type?: string;
2158
+ };
2159
+ TokenExchangeResponse: {
2160
+ /** @description RS256-signed federation JWT. */
2161
+ access_token: string;
2162
+ issued_token_type: string;
2163
+ token_type: string;
2164
+ expires_in: number;
2165
+ scope?: string;
2166
+ };
2045
2167
  SignupRequest: {
2046
2168
  /** Format: email */
2047
2169
  email: string;
@@ -2440,6 +2562,24 @@ export interface components {
2440
2562
  /** @description Enable/disable Shroud LLM Proxy */
2441
2563
  shroud_enabled?: boolean;
2442
2564
  shroud_config?: components["schemas"]["ShroudConfig"];
2565
+ /**
2566
+ * @description Enable OIDC federation (RFC 8693 token-exchange) for this agent.
2567
+ * When true, the agent may call POST /v1/auth/federated-token to mint
2568
+ * federation tokens for the audiences listed in `federation_audiences`.
2569
+ */
2570
+ federation_enabled?: boolean;
2571
+ /**
2572
+ * @description Allowlist of `aud` values the federation token-exchange may issue
2573
+ * tokens for (e.g. `["https://api.anthropic.com"]`). Empty array
2574
+ * blocks all federation requests (zero-trust default).
2575
+ */
2576
+ federation_audiences?: string[];
2577
+ /**
2578
+ * @description Per-agent TTL override for federation tokens (seconds). NULL falls
2579
+ * back to the global default (`ONECLAW_JWT_FEDERATED_TOKEN_EXPIRY_SECS`).
2580
+ * Hard-capped at 3600 seconds.
2581
+ */
2582
+ federated_token_ttl_seconds?: number | null;
2443
2583
  };
2444
2584
  AgentResponse: {
2445
2585
  /** Format: uuid */
@@ -2472,6 +2612,15 @@ export interface components {
2472
2612
  /** @description Whether this agent routes LLM traffic through the Shroud TEE proxy */
2473
2613
  shroud_enabled: boolean;
2474
2614
  shroud_config?: components["schemas"]["ShroudConfig"];
2615
+ /**
2616
+ * @description Whether this agent may mint OIDC federation tokens via
2617
+ * POST /v1/auth/federated-token. False by default.
2618
+ */
2619
+ federation_enabled?: boolean;
2620
+ /** @description Allowlist of audience URIs the agent may federate to. */
2621
+ federation_audiences?: string[];
2622
+ /** @description Per-agent TTL override for federation tokens (60..=3600). */
2623
+ federated_token_ttl_seconds?: number | null;
2475
2624
  /** Format: date-time */
2476
2625
  created_at: string;
2477
2626
  /** Format: date-time */
@@ -3450,6 +3599,18 @@ export interface components {
3450
3599
  had_pii_detected?: boolean;
3451
3600
  injection_score?: number;
3452
3601
  policy_violations?: string[];
3602
+ /** @description Response-side prompt-injection score (0.0–1.0). */
3603
+ response_injection_score?: number;
3604
+ /** @description Response-side context-injection score (0.0–1.0). */
3605
+ response_context_injection_score?: number;
3606
+ /** @description Category tags emitted by the response-side filters (e.g. `markdown_image_exfil`, `data_uri_blob`, `echoed_instruction`). */
3607
+ response_injection_categories?: string[];
3608
+ /** @description URLs emitted by the model that were flagged as potential exfil / callback targets. */
3609
+ external_urls_flagged?: string[];
3610
+ /** @description Number of code fences in the response that were not expected for the agent's allowed task set. */
3611
+ unexpected_code_blocks?: number;
3612
+ /** @description True when Shroud rewrote or blocked response content before returning it to the agent. */
3613
+ content_filtered?: boolean;
3453
3614
  metadata?: Record<string, never>;
3454
3615
  /** Format: date-time */
3455
3616
  timestamp?: string;
@@ -3472,6 +3633,16 @@ export interface components {
3472
3633
  injection_score: number;
3473
3634
  policy_violations?: string[];
3474
3635
  metadata?: Record<string, never>;
3636
+ /** @default 0 */
3637
+ response_injection_score: number;
3638
+ /** @default 0 */
3639
+ response_context_injection_score: number;
3640
+ response_injection_categories?: string[];
3641
+ external_urls_flagged?: string[];
3642
+ /** @default 0 */
3643
+ unexpected_code_blocks: number;
3644
+ /** @default false */
3645
+ content_filtered: boolean;
3475
3646
  };
3476
3647
  ShroudThreatSummary: {
3477
3648
  /** Format: int64 */
@@ -3727,6 +3898,83 @@ export interface operations {
3727
3898
  };
3728
3899
  };
3729
3900
  };
3901
+ exchangeFederatedToken: {
3902
+ parameters: {
3903
+ query?: never;
3904
+ header?: never;
3905
+ path?: never;
3906
+ cookie?: never;
3907
+ };
3908
+ requestBody: {
3909
+ content: {
3910
+ "application/json": components["schemas"]["TokenExchangeRequest"];
3911
+ "application/x-www-form-urlencoded": components["schemas"]["TokenExchangeRequest"];
3912
+ };
3913
+ };
3914
+ responses: {
3915
+ /** @description Federation token issued */
3916
+ 200: {
3917
+ headers: {
3918
+ [name: string]: unknown;
3919
+ };
3920
+ content: {
3921
+ "application/json": components["schemas"]["TokenExchangeResponse"];
3922
+ };
3923
+ };
3924
+ 400: components["responses"]["BadRequest"];
3925
+ 401: components["responses"]["Unauthorized"];
3926
+ 403: components["responses"]["Forbidden"];
3927
+ /** @description RS256 signing key not configured */
3928
+ 503: {
3929
+ headers: {
3930
+ [name: string]: unknown;
3931
+ };
3932
+ content?: never;
3933
+ };
3934
+ };
3935
+ };
3936
+ openidConfiguration: {
3937
+ parameters: {
3938
+ query?: never;
3939
+ header?: never;
3940
+ path?: never;
3941
+ cookie?: never;
3942
+ };
3943
+ requestBody?: never;
3944
+ responses: {
3945
+ /** @description Discovery document */
3946
+ 200: {
3947
+ headers: {
3948
+ [name: string]: unknown;
3949
+ };
3950
+ content: {
3951
+ "application/json": Record<string, never>;
3952
+ };
3953
+ };
3954
+ };
3955
+ };
3956
+ jwks: {
3957
+ parameters: {
3958
+ query?: never;
3959
+ header?: never;
3960
+ path?: never;
3961
+ cookie?: never;
3962
+ };
3963
+ requestBody?: never;
3964
+ responses: {
3965
+ /** @description JWK Set */
3966
+ 200: {
3967
+ headers: {
3968
+ [name: string]: unknown;
3969
+ };
3970
+ content: {
3971
+ "application/jwk-set+json": {
3972
+ keys?: Record<string, never>[];
3973
+ };
3974
+ };
3975
+ };
3976
+ };
3977
+ };
3730
3978
  signup: {
3731
3979
  parameters: {
3732
3980
  query?: never;