@valiron/sdk 1.4.0 → 2.0.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/README.md +5 -154
- package/dist/clients.d.ts +6 -6
- package/dist/clients.js +33 -26
- package/dist/identity.d.ts +6 -0
- package/dist/identity.js +6 -1
- package/dist/identityMiddleware.d.ts +8 -0
- package/dist/identityMiddleware.js +12 -4
- package/dist/index.d.ts +5 -10
- package/dist/index.js +4 -10
- package/dist/middleware.d.ts +18 -9
- package/dist/middleware.js +41 -16
- package/dist/operatorSdk.d.ts +11 -2
- package/dist/operatorSdk.js +13 -7
- package/dist/types.d.ts +14 -4
- package/docs/AGENT-READY-APIS.md +3 -181
- package/docs/API-REFERENCE.md +88 -546
- package/docs/CHAINS.md +3 -3
- package/docs/CRAWLER-PROTECTION.md +376 -0
- package/docs/DASHBOARD.md +39 -23
- package/docs/E2E-MIDDLEWARE-INTEGRATION.md +19 -13
- package/docs/ERRORS.md +27 -19
- package/docs/IDENTITY.md +16 -14
- package/docs/PROVIDER-IDENTITY.md +15 -5
- package/docs/QUICKSTART.md +34 -24
- package/docs/README.md +15 -4
- package/docs/SANDBOX.md +7 -1
- package/docs/SDK-REFERENCE.md +70 -52
- package/docs/SECURITY-UPGRADE-2026-10-31.md +98 -0
- package/docs/TRUST-MODEL.md +14 -11
- package/docs/llms.txt +65 -307
- package/package.json +3 -3
- package/docs/MCP.md +0 -50
package/docs/AGENT-READY-APIS.md
CHANGED
|
@@ -75,7 +75,7 @@ https://api.example.com/v1/weather
|
|
|
75
75
|
## Dashboard Flow
|
|
76
76
|
|
|
77
77
|
1. Open [valiron.co/dashboard](https://www.valiron.co/dashboard).
|
|
78
|
-
2.
|
|
78
|
+
2. Choose **API Scaffolding → Endpoints & testing**.
|
|
79
79
|
3. Click **Make API Agent-Ready**.
|
|
80
80
|
4. Enter the upstream URL, public path, method, price, protocol, network, and payout wallet.
|
|
81
81
|
5. Choose whether Valiron trust checks are required.
|
|
@@ -86,113 +86,7 @@ https://api.example.com/v1/weather
|
|
|
86
86
|
9. Verify that a direct request to your origin is rejected and a request to the
|
|
87
87
|
wrapper is recorded in Valiron call logs.
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
The dashboard calls the same operator API you can call directly.
|
|
92
|
-
|
|
93
|
-
### Register
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
curl -X POST https://valiron-edge-proxy.onrender.com/operator/register \
|
|
97
|
-
-H "content-type: application/json" \
|
|
98
|
-
-d '{
|
|
99
|
-
"email": "you@example.com",
|
|
100
|
-
"password": "a-long-password",
|
|
101
|
-
"name": "Example Operator"
|
|
102
|
-
}'
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Login
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
curl -X POST https://valiron-edge-proxy.onrender.com/operator/login \
|
|
109
|
-
-H "content-type: application/json" \
|
|
110
|
-
-d '{
|
|
111
|
-
"email": "you@example.com",
|
|
112
|
-
"password": "a-long-password"
|
|
113
|
-
}'
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Create A Free Wrapper
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
curl -X POST https://valiron-edge-proxy.onrender.com/operator/endpoints \
|
|
120
|
-
-H "authorization: Bearer $VALIRON_JWT" \
|
|
121
|
-
-H "content-type: application/json" \
|
|
122
|
-
-d '{
|
|
123
|
-
"path": "/weather",
|
|
124
|
-
"method": "GET",
|
|
125
|
-
"pricePerCall": 0,
|
|
126
|
-
"targetUrl": "https://api.example.com",
|
|
127
|
-
"paymentProtocol": "x402",
|
|
128
|
-
"paymentNetwork": "eip155:8453",
|
|
129
|
-
"trustEnabled": false,
|
|
130
|
-
"upstreamAuthType": "hmac",
|
|
131
|
-
"upstreamAuthSecret": "replace-with-a-unique-shared-secret"
|
|
132
|
-
}'
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Create A Paid x402 Wrapper
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
curl -X POST https://valiron-edge-proxy.onrender.com/operator/endpoints \
|
|
139
|
-
-H "authorization: Bearer $VALIRON_JWT" \
|
|
140
|
-
-H "content-type: application/json" \
|
|
141
|
-
-d '{
|
|
142
|
-
"path": "/weather",
|
|
143
|
-
"method": "GET",
|
|
144
|
-
"pricePerCall": 0.001,
|
|
145
|
-
"targetUrl": "https://api.example.com",
|
|
146
|
-
"paymentProtocol": "x402",
|
|
147
|
-
"paymentNetwork": "eip155:8453",
|
|
148
|
-
"payoutAddress": "0xYourPayoutWallet",
|
|
149
|
-
"trustEnabled": false,
|
|
150
|
-
"upstreamAuthType": "hmac",
|
|
151
|
-
"upstreamAuthSecret": "replace-with-a-unique-shared-secret"
|
|
152
|
-
}'
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Create A Paid MPP Wrapper
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
curl -X POST https://valiron-edge-proxy.onrender.com/operator/endpoints \
|
|
159
|
-
-H "authorization: Bearer $VALIRON_JWT" \
|
|
160
|
-
-H "content-type: application/json" \
|
|
161
|
-
-d '{
|
|
162
|
-
"path": "/research",
|
|
163
|
-
"method": "GET",
|
|
164
|
-
"pricePerCall": 0.001,
|
|
165
|
-
"targetUrl": "https://api.example.com",
|
|
166
|
-
"paymentProtocol": "mpp",
|
|
167
|
-
"paymentNetwork": "tempo:4217",
|
|
168
|
-
"payoutAddress": "0xYourPayoutWallet",
|
|
169
|
-
"trustEnabled": false,
|
|
170
|
-
"upstreamAuthType": "hmac",
|
|
171
|
-
"upstreamAuthSecret": "replace-with-a-unique-shared-secret"
|
|
172
|
-
}'
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
For Tempo testnet, use:
|
|
176
|
-
|
|
177
|
-
```json
|
|
178
|
-
{ "paymentNetwork": "tempo:42431" }
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### List Wrappers
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
curl https://valiron-edge-proxy.onrender.com/operator/endpoints \
|
|
185
|
-
-H "authorization: Bearer $VALIRON_JWT"
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Deactivate A Wrapper
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
curl -X DELETE https://valiron-edge-proxy.onrender.com/operator/endpoints/{endpointId} \
|
|
192
|
-
-H "authorization: Bearer $VALIRON_JWT"
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Deactivation is a soft delete. Existing logs remain available.
|
|
89
|
+
Create, list, and deactivate wrappers in the dashboard.
|
|
196
90
|
|
|
197
91
|
## Calling A Wrapper
|
|
198
92
|
|
|
@@ -226,7 +120,7 @@ WWW-Authenticate: Payment ...
|
|
|
226
120
|
|
|
227
121
|
## x402 Paid Client
|
|
228
122
|
|
|
229
|
-
Use an x402-capable client to retry with payment. The
|
|
123
|
+
Use an x402-capable client to retry with payment. The example below uses:
|
|
230
124
|
|
|
231
125
|
- `@x402/fetch`
|
|
232
126
|
- `@x402/core/client`
|
|
@@ -367,12 +261,6 @@ Before production:
|
|
|
367
261
|
5. Send a request through the wrapper and confirm the expected payment/trust
|
|
368
262
|
result and a corresponding Valiron call-log entry.
|
|
369
263
|
|
|
370
|
-
Production requires `VALIRON_SECRET_ENCRYPTION_KEY` to store upstream auth secrets. Use a 32-byte hex key:
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
openssl rand -hex 32
|
|
374
|
-
```
|
|
375
|
-
|
|
376
264
|
## Security Defaults
|
|
377
265
|
|
|
378
266
|
In production, Valiron wrappers:
|
|
@@ -387,72 +275,6 @@ In production, Valiron wrappers:
|
|
|
387
275
|
- Enforce request body size limits.
|
|
388
276
|
- Time out slow upstream calls.
|
|
389
277
|
|
|
390
|
-
Local development can set:
|
|
391
|
-
|
|
392
|
-
```bash
|
|
393
|
-
VALIRON_ALLOW_INSECURE_UPSTREAMS=true
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
Only use this for local testing. Do not enable it in production.
|
|
397
|
-
|
|
398
|
-
## Production Environment Variables
|
|
399
|
-
|
|
400
|
-
Render / edge proxy:
|
|
401
|
-
|
|
402
|
-
| Variable | Required | Purpose |
|
|
403
|
-
|----------|----------|---------|
|
|
404
|
-
| `VALIRON_SECRET_ENCRYPTION_KEY` | Required for upstream auth | AES-256-GCM key for storing upstream secrets. |
|
|
405
|
-
| `X402_RECEIVING_ADDRESS` | Required for paid x402 without per-endpoint payout | Default payout wallet. Per-endpoint `payoutAddress` can also be used. |
|
|
406
|
-
| `X402_FACILITATOR_URL` | Optional | Defaults to `https://facilitator.payai.network`. |
|
|
407
|
-
| `MPP_SECRET_KEY` | Required for MPP | Secret used by `mppx` to sign/verify payment challenges. |
|
|
408
|
-
| `MPP_TEMPO_CURRENCY` | Optional | Override Tempo currency. Defaults come from `mppx`. |
|
|
409
|
-
| `MPP_TEMPO_CHAIN_ID` | Optional | Fallback Tempo chain ID when not set by endpoint. |
|
|
410
|
-
| `MPP_TEMPO_TESTNET` | Optional | Fallback testnet flag when not set by endpoint. |
|
|
411
|
-
| `MPP_TEMPO_WAIT_FOR_CONFIRMATION` | Optional | Defaults to `true`; set `false` only for specific test flows. |
|
|
412
|
-
| `MPP_REALM` | Optional | Defaults to `Valiron`. |
|
|
413
|
-
| `VALIRON_WRAPPER_MAX_BODY_BYTES` | Optional | Request body size limit. |
|
|
414
|
-
| `VALIRON_WRAPPER_UPSTREAM_TIMEOUT_MS` | Optional | Upstream request timeout. |
|
|
415
|
-
|
|
416
|
-
Vercel / website:
|
|
417
|
-
|
|
418
|
-
| Variable | Required | Purpose |
|
|
419
|
-
|----------|----------|---------|
|
|
420
|
-
| `NEXT_PUBLIC_API_URL` | Recommended | Edge proxy base URL used by the dashboard. |
|
|
421
|
-
|
|
422
|
-
## Local Test Example
|
|
423
|
-
|
|
424
|
-
Run the local x402 test server:
|
|
425
|
-
|
|
426
|
-
```bash
|
|
427
|
-
pnpm --filter x402-test-server dev
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
Run the edge proxy with local upstreams allowed:
|
|
431
|
-
|
|
432
|
-
```bash
|
|
433
|
-
VALIRON_ALLOW_INSECURE_UPSTREAMS=true pnpm --filter edge-proxy dev
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
Create a free test wrapper pointing at:
|
|
437
|
-
|
|
438
|
-
```text
|
|
439
|
-
http://localhost:4021
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
with public path:
|
|
443
|
-
|
|
444
|
-
```text
|
|
445
|
-
/health
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
Then call:
|
|
449
|
-
|
|
450
|
-
```bash
|
|
451
|
-
curl -i http://localhost:3005/wrap/{operatorId}/health
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
For paid x402 tests, use the buyer test client with a funded buyer key and the configured facilitator/network.
|
|
455
|
-
|
|
456
278
|
## Current Limits
|
|
457
279
|
|
|
458
280
|
The first wrapper release supports:
|