@1claw/sdk 0.59.5 → 0.59.7
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 +24 -22
- package/dist/generated/api-types.d.ts +50 -6
- package/dist/generated/api-types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @1claw/sdk (v0.59.4)
|
|
2
2
|
|
|
3
|
+
> ⭐ **Star [1clawAI/agent-templates](https://github.com/1clawAI/agent-templates)** — ready-to-run agent templates wired to 1Claw. It is our single starred repo.
|
|
4
|
+
|
|
3
5
|
TypeScript/JavaScript client for the 1Claw Vault API.
|
|
4
6
|
|
|
5
7
|
This is the official SDK for Node.js, Next.js, and browser apps that call 1Claw over HTTP. It covers vaults, secrets, agents, policies, treasury, Intents API signing, execution bindings, platform apps, billing, and x402 payments. Types are generated from the OpenAPI spec, so request shapes stay in sync with the API.
|
|
@@ -20,7 +22,7 @@ npm install @1claw/sdk
|
|
|
20
22
|
import { createClient } from "@1claw/sdk";
|
|
21
23
|
|
|
22
24
|
const client = createClient({
|
|
23
|
-
baseUrl: "https://api.1claw.
|
|
25
|
+
baseUrl: "https://api.1claw.co",
|
|
24
26
|
apiKey: "ocv_...", // auto-exchanges for a JWT
|
|
25
27
|
});
|
|
26
28
|
|
|
@@ -38,7 +40,7 @@ const secret = await client.secrets.get("vault-id", "OPENAI_KEY");
|
|
|
38
40
|
console.log(secret.data?.value);
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
**API contract:** This SDK is built from the **OpenAPI 3.1** spec. The canonical spec is published as [@1claw/openapi-spec](https://www.npmjs.com/package/@1claw/openapi-spec) (YAML/JSON). Types are generated with `npm run generate` (`openapi-typescript ../openapi-spec/openapi.yaml`). Run `generate` after spec changes, then `npm run build`. Shapes such as `LlmTokenBillingStatus` (including optional `credit_balance` and `billing_cycle_usage.metered_lines`) come from the generated `api-types.ts`. For a full endpoint list, see the [API reference](https://docs.1claw.
|
|
43
|
+
**API contract:** This SDK is built from the **OpenAPI 3.1** spec. The canonical spec is published as [@1claw/openapi-spec](https://www.npmjs.com/package/@1claw/openapi-spec) (YAML/JSON). Types are generated with `npm run generate` (`openapi-typescript ../openapi-spec/openapi.yaml`). Run `generate` after spec changes, then `npm run build`. Shapes such as `LlmTokenBillingStatus` (including optional `credit_balance` and `billing_cycle_usage.metered_lines`) come from the generated `api-types.ts`. For a full endpoint list, see the [API reference](https://docs.1claw.co/docs/reference/api-reference) or the spec.
|
|
42
44
|
|
|
43
45
|
## Authentication
|
|
44
46
|
|
|
@@ -49,20 +51,20 @@ The SDK supports three authentication modes:
|
|
|
49
51
|
```typescript
|
|
50
52
|
// 1. User API key (auto-authenticates)
|
|
51
53
|
const client = createClient({
|
|
52
|
-
baseUrl: "https://api.1claw.
|
|
54
|
+
baseUrl: "https://api.1claw.co",
|
|
53
55
|
apiKey: "ocv_...",
|
|
54
56
|
});
|
|
55
57
|
|
|
56
58
|
// 2. Agent with API key (auto-authenticates as agent)
|
|
57
59
|
const agent = createClient({
|
|
58
|
-
baseUrl: "https://api.1claw.
|
|
60
|
+
baseUrl: "https://api.1claw.co",
|
|
59
61
|
apiKey: "ocv_...",
|
|
60
62
|
agentId: "agent-uuid",
|
|
61
63
|
});
|
|
62
64
|
|
|
63
65
|
// 3. Pre-authenticated JWT
|
|
64
66
|
const authed = createClient({
|
|
65
|
-
baseUrl: "https://api.1claw.
|
|
67
|
+
baseUrl: "https://api.1claw.co",
|
|
66
68
|
token: "eyJ...",
|
|
67
69
|
});
|
|
68
70
|
|
|
@@ -396,7 +398,7 @@ await client.agents.submitTransaction(agentId, {
|
|
|
396
398
|
});
|
|
397
399
|
```
|
|
398
400
|
|
|
399
|
-
See the [Intents API guide](https://docs.1claw.
|
|
401
|
+
See the [Intents API guide](https://docs.1claw.co/docs/guides/intents-api#non-evm-transaction-signing) for full field reference.
|
|
400
402
|
|
|
401
403
|
Key properties:
|
|
402
404
|
|
|
@@ -418,13 +420,13 @@ await client.agents.update(agentId, {
|
|
|
418
420
|
```
|
|
419
421
|
|
|
420
422
|
When `intents_require_tee` is true:
|
|
421
|
-
- Transaction submit/sign requests to `api.1claw.
|
|
422
|
-
- Agents must route through `shroud.1claw.
|
|
423
|
+
- Transaction submit/sign requests to `api.1claw.co` are rejected (403)
|
|
424
|
+
- Agents must route through `shroud.1claw.co` where signing happens inside TEE memory
|
|
423
425
|
|
|
424
426
|
When `execution_require_tee` is true:
|
|
425
|
-
- Execute requests to `api.1claw.
|
|
427
|
+
- Execute requests to `api.1claw.co` are rejected (403)
|
|
426
428
|
- All direct secret reads by the agent are blocked — forces use of Execution Intent bindings
|
|
427
|
-
- Agents must route through `shroud.1claw.
|
|
429
|
+
- Agents must route through `shroud.1claw.co`
|
|
428
430
|
|
|
429
431
|
Both require `intents_api_enabled` / `execution_intents_enabled` to be on first.
|
|
430
432
|
|
|
@@ -498,7 +500,7 @@ import { generatePKCE, buildAuthorizeUrl, createClient } from "@1claw/sdk";
|
|
|
498
500
|
const pkce = await generatePKCE();
|
|
499
501
|
|
|
500
502
|
// 2. Build the authorize URL
|
|
501
|
-
const authUrl = buildAuthorizeUrl("https://1claw.
|
|
503
|
+
const authUrl = buildAuthorizeUrl("https://1claw.co", {
|
|
502
504
|
clientId: "your-platform-app-slug",
|
|
503
505
|
redirectUri: "https://yourapp.com/callback",
|
|
504
506
|
scopes: ["openid", "profile", "email"],
|
|
@@ -507,7 +509,7 @@ const authUrl = buildAuthorizeUrl("https://1claw.xyz", {
|
|
|
507
509
|
});
|
|
508
510
|
|
|
509
511
|
// 3. After redirect, exchange the code for tokens
|
|
510
|
-
const client = createClient({ baseUrl: "https://api.1claw.
|
|
512
|
+
const client = createClient({ baseUrl: "https://api.1claw.co" });
|
|
511
513
|
const tokens = await client.auth.exchangeOAuthCode({
|
|
512
514
|
code: "authorization-code-from-callback",
|
|
513
515
|
client_id: "your-platform-app-slug",
|
|
@@ -527,10 +529,10 @@ await client.auth.revokeConsent("platform-app-id");
|
|
|
527
529
|
|
|
528
530
|
## OIDC Federation (Anthropic WIF, GCP STS, AWS STS)
|
|
529
531
|
|
|
530
|
-
`https://api.1claw.
|
|
532
|
+
`https://api.1claw.co` 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:
|
|
531
533
|
|
|
532
|
-
- `GET https://api.1claw.
|
|
533
|
-
- `GET https://api.1claw.
|
|
534
|
+
- `GET https://api.1claw.co/.well-known/openid-configuration`
|
|
535
|
+
- `GET https://api.1claw.co/.well-known/jwks.json`
|
|
534
536
|
|
|
535
537
|
The SDK exposes one method to mint a federation token:
|
|
536
538
|
|
|
@@ -618,7 +620,7 @@ When using agent credentials (`agentId` + `apiKey`), the SDK automatically refre
|
|
|
618
620
|
|
|
619
621
|
```typescript
|
|
620
622
|
const client = createClient({
|
|
621
|
-
baseUrl: "https://api.1claw.
|
|
623
|
+
baseUrl: "https://api.1claw.co",
|
|
622
624
|
apiKey: "ocv_...",
|
|
623
625
|
agentId: "agent-uuid",
|
|
624
626
|
});
|
|
@@ -631,7 +633,7 @@ Enable [DPoP (RFC 9449)](https://datatracker.ietf.org/doc/html/rfc9449) to bind
|
|
|
631
633
|
|
|
632
634
|
```typescript
|
|
633
635
|
const client = createClient({
|
|
634
|
-
baseUrl: "https://api.1claw.
|
|
636
|
+
baseUrl: "https://api.1claw.co",
|
|
635
637
|
apiKey: "ocv_...",
|
|
636
638
|
agentId: "agent-uuid",
|
|
637
639
|
dpop: true, // Generates ephemeral P-256 keypair, attaches DPoP proofs
|
|
@@ -646,7 +648,7 @@ import { DPoPManager } from "@1claw/sdk";
|
|
|
646
648
|
const dpop = new DPoPManager();
|
|
647
649
|
await dpop.init();
|
|
648
650
|
|
|
649
|
-
const proof = await dpop.generateProof("POST", "https://api.1claw.
|
|
651
|
+
const proof = await dpop.generateProof("POST", "https://api.1claw.co/v1/auth/agent-token");
|
|
650
652
|
const thumbprint = dpop.getThumbprint(); // JWK SHA-256 thumbprint (base64url)
|
|
651
653
|
```
|
|
652
654
|
|
|
@@ -699,7 +701,7 @@ const signer: X402Signer = {
|
|
|
699
701
|
};
|
|
700
702
|
|
|
701
703
|
const client = createClient({
|
|
702
|
-
baseUrl: "https://api.1claw.
|
|
704
|
+
baseUrl: "https://api.1claw.co",
|
|
703
705
|
apiKey: "ocv_...",
|
|
704
706
|
x402Signer: signer,
|
|
705
707
|
maxAutoPayUsd: 0.01, // auto-pay up to $0.01 per request
|
|
@@ -751,7 +753,7 @@ import { createClient } from "@1claw/sdk";
|
|
|
751
753
|
import type { CryptoProvider, AuditSink, PolicyEngine } from "@1claw/sdk";
|
|
752
754
|
|
|
753
755
|
const client = createClient({
|
|
754
|
-
baseUrl: "https://api.1claw.
|
|
756
|
+
baseUrl: "https://api.1claw.co",
|
|
755
757
|
apiKey: "ocv_...",
|
|
756
758
|
plugins: {
|
|
757
759
|
cryptoProvider: myAwsKmsProvider,
|
|
@@ -864,7 +866,7 @@ When making LLM requests to Shroud, specify the model in one of two ways:
|
|
|
864
866
|
|
|
865
867
|
**Option 1: Header**
|
|
866
868
|
```typescript
|
|
867
|
-
const res = await fetch("https://shroud.1claw.
|
|
869
|
+
const res = await fetch("https://shroud.1claw.co/v1/chat/completions", {
|
|
868
870
|
method: "POST",
|
|
869
871
|
headers: {
|
|
870
872
|
"X-Shroud-Agent-Key": `${agentId}:${agentApiKey}`,
|
|
@@ -888,7 +890,7 @@ body: JSON.stringify({
|
|
|
888
890
|
|
|
889
891
|
Shroud enforces the agent's `allowed_models` and `denied_models` restrictions automatically — requests using unauthorized models return **403 Forbidden**.
|
|
890
892
|
|
|
891
|
-
See the [Shroud Security Guide](https://docs.1claw.
|
|
893
|
+
See the [Shroud Security Guide](https://docs.1claw.co/docs/guides/shroud) for full configuration options.
|
|
892
894
|
|
|
893
895
|
## v0.48 — Cedar/OPA Enforcement v2
|
|
894
896
|
|
|
@@ -2391,7 +2391,15 @@ export interface paths {
|
|
|
2391
2391
|
put?: never;
|
|
2392
2392
|
/**
|
|
2393
2393
|
* Provision MCP onboarding bundle
|
|
2394
|
-
* @description Creates welcome vault + sample secret, MCP agent, and
|
|
2394
|
+
* @description Creates welcome vault + sample secret, MCP agent, and a policy on the
|
|
2395
|
+
* vault. Returns one-time API key and stdio MCP config.
|
|
2396
|
+
*
|
|
2397
|
+
* The grant is `**` only when the welcome vault is newly created. If an
|
|
2398
|
+
* org already has a vault named `default`, it is reused and the agent is
|
|
2399
|
+
* granted `examples/**` instead — enough to read the sample it is asked to
|
|
2400
|
+
* verify with, without exposing secrets already kept there.
|
|
2401
|
+
*
|
|
2402
|
+
* Subject to `agent.create` control-plane consensus; see `approval_id`.
|
|
2395
2403
|
*/
|
|
2396
2404
|
post: operations["provisionOnboarding"];
|
|
2397
2405
|
delete?: never;
|
|
@@ -5963,9 +5971,12 @@ export interface paths {
|
|
|
5963
5971
|
put?: never;
|
|
5964
5972
|
/**
|
|
5965
5973
|
* Verify email OTP and get JWT
|
|
5966
|
-
* @description Verifies the 6-digit code sent to the user's email.
|
|
5967
|
-
*
|
|
5968
|
-
* for
|
|
5974
|
+
* @description Verifies the 6-digit code sent to the user's email. Optionally
|
|
5975
|
+
* auto-provisions treasury wallets for the specified chains. Returns a JWT
|
|
5976
|
+
* for subsequent API calls.
|
|
5977
|
+
*
|
|
5978
|
+
* An unrecognized address is rejected unless the request carries
|
|
5979
|
+
* `platform_app_id` or sets `allow_signup`.
|
|
5969
5980
|
*/
|
|
5970
5981
|
post: operations["verifyEmailOtp"];
|
|
5971
5982
|
delete?: never;
|
|
@@ -9840,8 +9851,15 @@ export interface components {
|
|
|
9840
9851
|
transactions: components["schemas"]["SimulateTransactionRequest"][];
|
|
9841
9852
|
};
|
|
9842
9853
|
CreateSigningKeyRequest: {
|
|
9843
|
-
/**
|
|
9844
|
-
|
|
9854
|
+
/**
|
|
9855
|
+
* @description `midnight` is Preprod-only and requires the midnight-signer
|
|
9856
|
+
* sidecar. Note it can be provisioned but not rotated or
|
|
9857
|
+
* imported: derivation happens in the sidecar, so there is no
|
|
9858
|
+
* local keygen and no raw private key to import. Both of
|
|
9859
|
+
* those endpoints refuse it before consuming an approval.
|
|
9860
|
+
* @enum {string}
|
|
9861
|
+
*/
|
|
9862
|
+
chain: "ethereum" | "bitcoin" | "solana" | "xrp" | "cardano" | "tron" | "midnight";
|
|
9845
9863
|
};
|
|
9846
9864
|
SigningKeyResponse: {
|
|
9847
9865
|
/** Format: uuid */
|
|
@@ -10266,6 +10284,14 @@ export interface components {
|
|
|
10266
10284
|
OnboardingProvisionRequest: {
|
|
10267
10285
|
agent_name?: string;
|
|
10268
10286
|
client?: string;
|
|
10287
|
+
/**
|
|
10288
|
+
* Format: uuid
|
|
10289
|
+
* @description Approval satisfying an `agent.create` control-plane consensus policy,
|
|
10290
|
+
* if the org has one. Same field and meaning as on `POST /v1/agents`:
|
|
10291
|
+
* the first call returns 202 with the approval to collect, and the
|
|
10292
|
+
* retry passes its id here.
|
|
10293
|
+
*/
|
|
10294
|
+
approval_id?: string;
|
|
10269
10295
|
};
|
|
10270
10296
|
OnboardingProvisionResponse: {
|
|
10271
10297
|
/** Format: uuid */
|
|
@@ -14694,6 +14720,14 @@ export interface operations {
|
|
|
14694
14720
|
require_passkey_for_vaults?: boolean;
|
|
14695
14721
|
require_passkey_for_mfa?: boolean;
|
|
14696
14722
|
passkey_count?: number;
|
|
14723
|
+
/**
|
|
14724
|
+
* @description True while this account carries a passkey requirement
|
|
14725
|
+
* that the 1claw.xyz → 1claw.co move cleared on its
|
|
14726
|
+
* behalf. The two flags above read false, but that was
|
|
14727
|
+
* not the user's choice: registering a passkey on the
|
|
14728
|
+
* canonical domain restores them.
|
|
14729
|
+
*/
|
|
14730
|
+
passkey_requirements_downgraded?: boolean;
|
|
14697
14731
|
};
|
|
14698
14732
|
};
|
|
14699
14733
|
};
|
|
@@ -21701,6 +21735,16 @@ export interface operations {
|
|
|
21701
21735
|
platform_app_id?: string;
|
|
21702
21736
|
/** @description Chains to auto-generate wallets for (e.g. ["ethereum", "base"]) */
|
|
21703
21737
|
auto_provision_chains?: string[];
|
|
21738
|
+
/**
|
|
21739
|
+
* @description Opt in to creating an account when the address is not
|
|
21740
|
+
* recognized. Without it an unknown address is rejected
|
|
21741
|
+
* rather than silently given a new user and org — a valid
|
|
21742
|
+
* code proves control of an inbox, not consent to sign up.
|
|
21743
|
+
* Not required when `platform_app_id` is present: creating
|
|
21744
|
+
* the end user on first login is the embedded-wallet flow.
|
|
21745
|
+
* @default false
|
|
21746
|
+
*/
|
|
21747
|
+
allow_signup?: boolean;
|
|
21704
21748
|
};
|
|
21705
21749
|
};
|
|
21706
21750
|
};
|