@valiron/sdk 1.4.0 → 2.1.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 +11 -148
- package/bin/valiron-card.mjs +211 -0
- package/dist/card.d.ts +565 -0
- package/dist/card.js +722 -0
- package/dist/clients.d.ts +6 -6
- package/dist/clients.js +33 -26
- package/dist/edge.d.ts +87 -0
- package/dist/edge.js +164 -0
- package/dist/edgeGate.d.ts +146 -0
- package/dist/edgeGate.js +230 -0
- package/dist/edgeGateVerify.d.ts +146 -0
- package/dist/edgeGateVerify.js +243 -0
- 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 +20 -9
- package/dist/middleware.js +47 -19
- 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 +94 -546
- package/docs/CHAINS.md +3 -3
- package/docs/CLOUDFLARE-GATE-MIDDLEWARE.md +196 -0
- package/docs/CRAWLER-PROTECTION.md +545 -0
- package/docs/DASHBOARD.md +55 -23
- package/docs/E2E-MIDDLEWARE-INTEGRATION.md +19 -13
- package/docs/ERRORS.md +29 -19
- package/docs/IDENTITY.md +16 -14
- package/docs/PROVIDER-IDENTITY.md +15 -5
- package/docs/QUICKSTART.md +40 -24
- package/docs/README.md +21 -4
- package/docs/SANDBOX.md +7 -1
- package/docs/SDK-REFERENCE.md +115 -52
- package/docs/SECURITY-UPGRADE-2026-10-31.md +98 -0
- package/docs/TRUST-MODEL.md +14 -11
- package/docs/llms.txt +70 -302
- package/examples/cloudflare-gate-worker/README.md +198 -0
- package/examples/cloudflare-gate-worker/package.json +20 -0
- package/examples/cloudflare-gate-worker/worker.ts +309 -0
- package/examples/cloudflare-gate-worker/wrangler.toml +46 -0
- package/examples/cloudflare-worker/package.json +8 -0
- package/examples/cloudflare-worker/worker.ts +495 -0
- package/examples/cloudflare-worker/wrangler.toml +57 -0
- package/package.json +35 -5
- package/docs/MCP.md +0 -50
package/docs/SDK-REFERENCE.md
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
# SDK Reference
|
|
2
2
|
|
|
3
|
+
> **Request verification:** Examples using `verifyAgentRequest` assume an application-owned verifier imported from your own module, not an SDK export. It must verify a fresh signature against the claimed identity, bind method, full URL and body, and atomically reject replayed nonces. See the [request-proof upgrade guide](https://www.valiron.co/docs/agents/SECURITY-UPGRADE-2026-10-31.md). Missing or invalid proofs return 401 before profile-cache lookup.
|
|
4
|
+
|
|
5
|
+
See the [security upgrade guide](SECURITY-UPGRADE-2026-10-31.md) before upgrading existing integrations: trust gates require request-bound identity verification, and enrollment and signed-request contracts have changed.
|
|
6
|
+
|
|
7
|
+
Social Graph (Icebreaker) is a Pro feature. Bot protection is included with Free. All other capabilities are included with Free: 10,000 agent requests/month and 10,000 bot protection requests/month, 3 registered endpoints, and 5 sandbox runs/day. Pro includes 100,000 requests per product/month. Enterprise: email founders@valiron.co. Operator authentication and tenant isolation apply on every plan.
|
|
8
|
+
|
|
3
9
|
Package: `@valiron/sdk`
|
|
4
10
|
|
|
11
|
+
Crawler source checks and shared work admission belong to the separate `@valiron/crawler-protection` integration package. `createCrawlerGateway()`, `createCrawlerWorkServer()`, `createCrawlerRuntime()`, `CrawlerGuard`, `RedisAdmission`, `createNodeCrawlerMiddleware()` and `createNuxtCrawlerMiddleware()` are exports of that package, not `@valiron/sdk`. The gateway fronts HTTP origins independently of their application language. The private work API is database-independent but requires operation integration and confirmed settlement. A Python client is included; SQLite and MariaDB are tested, while other drivers/stacks require validation. Install it with `npm install @valiron/crawler-protection`. See [controlled crawler access](./CRAWLER-PROTECTION.md) for its integration and recovery contracts.
|
|
12
|
+
|
|
13
|
+
Crawler SDK 0.3.0+ requires a Free/Pro/Enterprise operator API key and account-bound activation via `activateCrawlerProtection()` before constructing its runtime. Activation uses a short-lived local lease, refreshed in the background. Each protected HTTP request requires hosted monthly quota admission; database operations are not counted again. See the crawler guide for revocation, outage and recovery behavior.
|
|
14
|
+
|
|
15
|
+
For the current crawler integration, install `@valiron/crawler-protection@^0.6.0`. It adds official Anthropic and Google agent/Notebook feeds alongside OpenAI support, and `crawlerAccessDefault` / `unverifiedAccess` configuration. These are customer-runtime controls, not hosted policy-deployment APIs. See [selected AI services and upgrade steps](./CRAWLER-PROTECTION.md#allow-selected-ai-services); source verification does not grant unlimited access or authorize account actions.
|
|
16
|
+
|
|
5
17
|
## Installation
|
|
6
18
|
|
|
7
19
|
```bash
|
|
@@ -22,12 +34,13 @@ const valiron = new ValironSDK(config?: ValironConfig);
|
|
|
22
34
|
|
|
23
35
|
| Field | Type | Default | Description |
|
|
24
36
|
|-------|------|---------|-------------|
|
|
25
|
-
| `apiKey` | string | — | Operator API key.
|
|
37
|
+
| `apiKey` | string | — | Operator API key. Required for profile/status reads, trust gates, and sandbox runs; Pro is required only for Social Graph (Icebreaker); other capabilities are Free within usage limits |
|
|
26
38
|
| `endpoint` | string | `https://valiron-edge-proxy.onrender.com` | API base URL |
|
|
27
39
|
| `chain` | SupportedChain | `"ethereum"` | Default blockchain network |
|
|
28
40
|
| `timeout` | number | method-aware | Request timeout in milliseconds. Defaults are 10s generally, 15s for `gate()`/`proxy()`, and 30s for sandbox triggers. If set, this value overrides all method-aware defaults. |
|
|
29
41
|
| `debug` | boolean | `false` | Enable debug logging |
|
|
30
|
-
| `telemetry` | TelemetryConfig | — | Optional telemetry configuration |
|
|
42
|
+
| `telemetry` | TelemetryConfig | — | Optional SDK diagnostic telemetry configuration |
|
|
43
|
+
| `signRequest` | `(request: { method: "POST"; url: string; body: string; chain?: SupportedChain }) => Promise<Record<string, string>>` | — | Fresh owner-proof headers for each POST; required by hosted gate/proxy and human enrollment flows. Keys remain in your signer. |
|
|
31
44
|
|
|
32
45
|
### SupportedChain
|
|
33
46
|
|
|
@@ -77,7 +90,7 @@ if (route === "prod") {
|
|
|
77
90
|
|
|
78
91
|
**Solana example**:
|
|
79
92
|
```typescript
|
|
80
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
93
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
81
94
|
|
|
82
95
|
// By asset pubkey
|
|
83
96
|
const route = await valiron.checkAgent("DFkntsJ9aTCHkK88m6WZVQEvLdLNi4X1LVUgRMqetFPM");
|
|
@@ -107,7 +120,6 @@ interface AgentProfile {
|
|
|
107
120
|
onchainReputation: OnchainReputation;
|
|
108
121
|
routing: {
|
|
109
122
|
finalRoute: RouteDecision;
|
|
110
|
-
meetsThreshold: boolean;
|
|
111
123
|
};
|
|
112
124
|
chain: ChainContext;
|
|
113
125
|
timestamp: string;
|
|
@@ -118,13 +130,12 @@ interface AgentProfile {
|
|
|
118
130
|
```typescript
|
|
119
131
|
const profile = await valiron.getAgentProfile("25459");
|
|
120
132
|
console.log(profile.routing.finalRoute); // "prod"
|
|
121
|
-
console.log(profile.routing.meetsThreshold); // true
|
|
122
133
|
console.log(profile.onchainReputation.averageScore); // 92.5
|
|
123
134
|
```
|
|
124
135
|
|
|
125
136
|
**Solana example**:
|
|
126
137
|
```typescript
|
|
127
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
138
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
128
139
|
const profile = await valiron.getAgentProfile("1226"); // sequential ID works
|
|
129
140
|
|
|
130
141
|
console.log(profile.identity.name); // "NoahScout_Bot.noah"
|
|
@@ -152,7 +163,7 @@ console.log(profile.routing.finalRoute);
|
|
|
152
163
|
|
|
153
164
|
**Solana example**:
|
|
154
165
|
```typescript
|
|
155
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
166
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
156
167
|
const profile = await valiron.getWalletProfile("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9");
|
|
157
168
|
```
|
|
158
169
|
|
|
@@ -160,7 +171,7 @@ const profile = await valiron.getWalletProfile("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwi
|
|
|
160
171
|
|
|
161
172
|
### getWalletRisk(wallet, options?)
|
|
162
173
|
|
|
163
|
-
Return an explainable wallet-history assessment. This is
|
|
174
|
+
Return an explainable wallet-history assessment. This is included with Free and requires an operator API key.
|
|
164
175
|
|
|
165
176
|
```typescript
|
|
166
177
|
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
@@ -185,7 +196,7 @@ Supported history networks are Ethereum, Base, Arbitrum, Optimism, Polygon, and
|
|
|
185
196
|
|
|
186
197
|
Lightweight wallet → agentId resolution without the full trust profile. Useful when you only need to know which agent owns a wallet (e.g. after extracting a wallet from an x402 payment header).
|
|
187
198
|
|
|
188
|
-
|
|
199
|
+
Wallet resolution returns the associated agent ID when available.
|
|
189
200
|
|
|
190
201
|
Signature: `resolveWallet(wallet: string, options?: { chain?: SupportedChain }): Promise<WalletResolution>`
|
|
191
202
|
|
|
@@ -212,9 +223,10 @@ if (resolution.agentId) {
|
|
|
212
223
|
|
|
213
224
|
**Solana example**:
|
|
214
225
|
```typescript
|
|
215
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
226
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
216
227
|
const resolution = await valiron.resolveWallet("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9");
|
|
217
|
-
//
|
|
228
|
+
// Solana matches return source "solana_registry"; no match returns "none".
|
|
229
|
+
// The SDK 1.4 ResolutionSource type does not yet include "solana_registry".
|
|
218
230
|
```
|
|
219
231
|
|
|
220
232
|
---
|
|
@@ -292,7 +304,7 @@ console.log(result.valironScore); // 85
|
|
|
292
304
|
|
|
293
305
|
### gate(agentId, options?)
|
|
294
306
|
|
|
295
|
-
|
|
307
|
+
Low-level hosted gate combining on-chain reputation and sandbox tests. The HTTP endpoint requires an operator API key plus a fresh registry-owner signature bound to this request. Configure `signRequest` with the [wallet-request v2 contract](./SECURITY-UPGRADE-2026-10-31.md#hosted-wrappers-gates-and-proxy). An API key, a claimed address, or a prior agent session alone is insufficient. Local middleware instead calls your `verifyRequest` verifier before authenticated profile reads.
|
|
296
308
|
|
|
297
309
|
```typescript
|
|
298
310
|
const result = await valiron.gate(agentId: string, options?: {
|
|
@@ -351,9 +363,7 @@ interface AgentSnapshotSummary {
|
|
|
351
363
|
agentId: string;
|
|
352
364
|
snapshotHash: string; // deterministic SHA-256 hash of behavioral evaluation (opaque)
|
|
353
365
|
previousHash: string; // hash from prior evaluation, or "0x0" for first
|
|
354
|
-
encryptedDataUri: string | null; // IPFS CID of encrypted snapshot data, if available
|
|
355
366
|
timestamp: string | null; // ISO 8601 timestamp of evaluation
|
|
356
|
-
interactionCount: number; // total interactions in the evaluation window
|
|
357
367
|
}
|
|
358
368
|
```
|
|
359
369
|
|
|
@@ -362,7 +372,6 @@ interface AgentSnapshotSummary {
|
|
|
362
372
|
const snapshot = await valiron.getAgentSnapshot("25459");
|
|
363
373
|
console.log(snapshot.snapshotHash); // "0x3a7f..."
|
|
364
374
|
console.log(snapshot.previousHash); // "0x0" (genesis) or "0x8b2c..."
|
|
365
|
-
console.log(snapshot.interactionCount); // 15
|
|
366
375
|
```
|
|
367
376
|
|
|
368
377
|
**Notes**:
|
|
@@ -374,7 +383,7 @@ console.log(snapshot.interactionCount); // 15
|
|
|
374
383
|
|
|
375
384
|
### verifyAgentIdentity(proof, policy?)
|
|
376
385
|
|
|
377
|
-
Verifies
|
|
386
|
+
Verifies a provider proof v2 bound to audience, method, full URL and the exact raw-body digest, loads Valiron reputation,
|
|
378
387
|
and returns the requested policy decision.
|
|
379
388
|
|
|
380
389
|
```typescript
|
|
@@ -401,7 +410,7 @@ types, signing helpers, identity statuses, and policy semantics.
|
|
|
401
410
|
|
|
402
411
|
Express-compatible middleware factory. Automatically gates requests based on agent trust.
|
|
403
412
|
|
|
404
|
-
Uses
|
|
413
|
+
Uses `getAgentProfile()` with your server-side operator API key. The middleware requires your `verifyRequest(request, identifier)` callback to prove control of this exact request before any profile or cache lookup. Missing or invalid proofs return `AGENT_OWNERSHIP_REQUIRED` (401).
|
|
405
414
|
|
|
406
415
|
**Express 4 safe**: The returned middleware wraps the async handler with `Promise.resolve(handler(...)).catch(next)` so async rejections are properly forwarded to Express's error handler. This prevents race conditions when chained with other async middleware (e.g. x402's `paymentMiddleware`).
|
|
407
416
|
|
|
@@ -410,6 +419,7 @@ import { ValironSDK, createValironGate } from "@valiron/sdk";
|
|
|
410
419
|
|
|
411
420
|
const gate = createValironGate(config: {
|
|
412
421
|
sdk: ValironSDK;
|
|
422
|
+
verifyRequest: (request: Request, identifier: string) => Promise<boolean>; // required for authorization
|
|
413
423
|
minScore?: number; // default: 65
|
|
414
424
|
trustSignals?: Array<"8004" | "sandbox" | "world" | "self" | "icebreaker" | "wallet">;
|
|
415
425
|
cacheTtlMs?: number; // default: 30000 (30s client-side cache)
|
|
@@ -422,20 +432,21 @@ const gate = createValironGate(config: {
|
|
|
422
432
|
|
|
423
433
|
**Default behavior**:
|
|
424
434
|
- Extracts agent ID from `x-agent-id` header (on-chain) or `x-agent-address` header (key-based)
|
|
425
|
-
- Returns 401 if no
|
|
435
|
+
- Returns 401 if no identity is found, or `AGENT_OWNERSHIP_REQUIRED` if the request verifier is missing or rejects the proof
|
|
426
436
|
- Returns 403 if agent is denied
|
|
427
437
|
- Returns 503 if the trust gate is unreachable (fail-closed)
|
|
428
|
-
- Caches
|
|
438
|
+
- Caches reputation decisions by identity, chain, signal selection and threshold for 30s; verifies each fresh request before cache use
|
|
429
439
|
|
|
430
440
|
**Example**:
|
|
431
441
|
```typescript
|
|
432
|
-
const valiron = new ValironSDK({ chain: "monad" });
|
|
442
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "monad" });
|
|
433
443
|
|
|
434
444
|
// Basic gate
|
|
435
|
-
app.use("/api/paid", createValironGate({ sdk: valiron }));
|
|
445
|
+
app.use("/api/paid", createValironGate({ verifyRequest: verifyAgentRequest, sdk: valiron }));
|
|
436
446
|
|
|
437
447
|
// Custom threshold + longer cache
|
|
438
448
|
app.use("/api/premium", createValironGate({
|
|
449
|
+
verifyRequest: verifyAgentRequest,
|
|
439
450
|
sdk: valiron,
|
|
440
451
|
minScore: 85,
|
|
441
452
|
trustSignals: ["8004", "sandbox"],
|
|
@@ -444,6 +455,7 @@ app.use("/api/premium", createValironGate({
|
|
|
444
455
|
|
|
445
456
|
// Custom agent ID extraction
|
|
446
457
|
app.use("/api/custom", createValironGate({
|
|
458
|
+
verifyRequest: verifyAgentRequest,
|
|
447
459
|
sdk: valiron,
|
|
448
460
|
extractAgentId: (req) => req.query.agent_id as string,
|
|
449
461
|
onDeny: (req, res, result) => {
|
|
@@ -470,7 +482,7 @@ Call this when shutting down long-running processes.
|
|
|
470
482
|
|
|
471
483
|
---
|
|
472
484
|
|
|
473
|
-
## Proxy Gateway
|
|
485
|
+
## Proxy Gateway
|
|
474
486
|
|
|
475
487
|
Forward requests through Valiron's edge proxy with automatic trust gating, logging, and SSRF protection.
|
|
476
488
|
|
|
@@ -527,7 +539,7 @@ For Web2 agents that don't have on-chain identities, Valiron supports key-based
|
|
|
527
539
|
3. Agent signs the nonce with their private key
|
|
528
540
|
4. Valiron verifies the signature and creates a `KeyAgentProfile`
|
|
529
541
|
|
|
530
|
-
The SDK
|
|
542
|
+
The SDK detects key-based claims from `x-agent-address`; a valid `verifyRequest` callback is still required. Prior enrollment proves the key existed, not that the current request is authorized.
|
|
531
543
|
|
|
532
544
|
### Sandbox Evaluation for Key Agents
|
|
533
545
|
|
|
@@ -560,8 +572,8 @@ curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox-ke
|
|
|
560
572
|
| `tier` | string \| null | Moody's-style trust tier once scored |
|
|
561
573
|
| `riskLevel` | string \| null | GREEN / YELLOW / RED once scored |
|
|
562
574
|
| `route` | string \| null | Route decision once scored |
|
|
563
|
-
| `icebreaker` | object \| null | Redacted from the
|
|
564
|
-
| `reasons` | string[] | Redacted from the
|
|
575
|
+
| `icebreaker` | object \| null | Redacted from the summary profile; use `getKeyAgentIcebreaker()` with a Pro key |
|
|
576
|
+
| `reasons` | string[] | Redacted from the summary profile |
|
|
565
577
|
| `timestamp` | string | ISO timestamp for the profile response |
|
|
566
578
|
|
|
567
579
|
```typescript
|
|
@@ -582,12 +594,12 @@ Verify agent-human linkage via Worldcoin's zero-knowledge proof system.
|
|
|
582
594
|
|
|
583
595
|
### verifyWorldId(agentId, proof, options?)
|
|
584
596
|
|
|
585
|
-
Submit a
|
|
597
|
+
Submit a complete production IDKit result with `idkit_result`, using operator authentication and a fresh owner proof from `signRequest`. Only a verified proof-of-human credential currently creates a trusted link; legacy links must be re-verified.
|
|
586
598
|
|
|
587
599
|
```typescript
|
|
588
600
|
const result = await valiron.verifyWorldId(agentId: string, proof: WorldIdProof, options?: {
|
|
589
601
|
chain?: SupportedChain;
|
|
590
|
-
}): Promise<
|
|
602
|
+
}): Promise<{ ok: boolean; agentId: string; worldId: WorldIdStatus; timestamp: string }>;
|
|
591
603
|
```
|
|
592
604
|
|
|
593
605
|
**Example**:
|
|
@@ -596,7 +608,8 @@ const result = await valiron.verifyWorldId("25459", {
|
|
|
596
608
|
merkle_root: "0x...",
|
|
597
609
|
nullifier_hash: "0x...",
|
|
598
610
|
proof: "0x...",
|
|
599
|
-
|
|
611
|
+
verification_level: "orb",
|
|
612
|
+
idkit_result: idkitResult, // complete, unmodified production IDKit result
|
|
600
613
|
});
|
|
601
614
|
```
|
|
602
615
|
|
|
@@ -607,13 +620,13 @@ Check if an agent has a verified World ID.
|
|
|
607
620
|
```typescript
|
|
608
621
|
const status = await valiron.getWorldIdStatus(agentId: string, options?: {
|
|
609
622
|
chain?: SupportedChain;
|
|
610
|
-
}): Promise<WorldIdStatus>;
|
|
611
|
-
// { verified: true,
|
|
623
|
+
}): Promise<{ agentId: string; worldId: WorldIdStatus; timestamp: string }>;
|
|
624
|
+
// status.worldId: { verified: true, verificationLevel: "orb" }
|
|
612
625
|
```
|
|
613
626
|
|
|
614
627
|
### getWorldIdProfile(agentId, options?)
|
|
615
628
|
|
|
616
|
-
Get
|
|
629
|
+
Get the World ID profile with an allowlisted verification summary using a Free or paid operator key. Icebreaker enrichment is included only for Pro/Enterprise.
|
|
617
630
|
|
|
618
631
|
```typescript
|
|
619
632
|
const profile = await valiron.getWorldIdProfile(agentId: string, options?: {
|
|
@@ -629,7 +642,7 @@ Self provides eligible-human verification from government ID credentials and can
|
|
|
629
642
|
|
|
630
643
|
### createSelfSession(agentId, request, options?)
|
|
631
644
|
|
|
632
|
-
Create
|
|
645
|
+
Create an owner-authorized Self Enterprise verification session. Configure `signRequest`; operator authentication alone cannot link a human to an agent. Omit return URLs or use the allowed `https://valiron.co` origin. Redirect the user to the returned `verificationUrl`; Self will call Valiron's signed webhook after completion.
|
|
633
646
|
|
|
634
647
|
```typescript
|
|
635
648
|
const session = await valiron.createSelfSession("25459", {
|
|
@@ -651,7 +664,7 @@ console.log(self.verified, self.selfAgentLinked);
|
|
|
651
664
|
|
|
652
665
|
### getSelfProfile(agentId, options?)
|
|
653
666
|
|
|
654
|
-
Get the
|
|
667
|
+
Get the Self profile with eligibility and agent-binding predicates using a Free or paid operator key; provider identifiers are omitted.
|
|
655
668
|
|
|
656
669
|
```typescript
|
|
657
670
|
const profile = await valiron.getSelfProfile("25459");
|
|
@@ -661,15 +674,15 @@ console.log(profile.humanTrust.hasAgentBinding);
|
|
|
661
674
|
|
|
662
675
|
### verifySelf(agentId, proof, options?)
|
|
663
676
|
|
|
664
|
-
|
|
677
|
+
Deprecated; retained for compatibility until the next major SDK release. Not supported for hosted customer integrations. Use `createSelfSession()`, send the user to the returned verification URL, and check `getSelfStatus()` after verification. Valiron receives the signed result from Self.
|
|
665
678
|
|
|
666
679
|
---
|
|
667
680
|
|
|
668
681
|
## Telemetry
|
|
669
682
|
|
|
670
|
-
The SDK collects opt-out usage telemetry to improve reliability. Events include SDK version, runtime, environment, method names, chain labels, latency, HTTP status/error buckets, route decisions, and coarse score/reputation buckets. Raw agent IDs, wallet addresses, API keys, and exact scores are not sent in SDK telemetry. Operator
|
|
683
|
+
The SDK collects opt-out usage telemetry to improve reliability. Events include SDK version, runtime, environment, method names, chain labels, latency, HTTP status/error buckets, route decisions, and coarse score/reputation buckets. Raw agent IDs, wallet addresses, API keys, and exact scores are not sent in SDK telemetry. Operator usage reporting is separate and disabled by default. Set `analytics: true` on `new ValironOperator(...)` to opt in. It reports authenticated decision/identity labels, method, status, latency and price; raw IP addresses, user agents, URL paths/query strings and arbitrary error messages are omitted or redacted. This option does not enable or disable SDK diagnostic telemetry.
|
|
671
684
|
|
|
672
|
-
SDK reports are anonymous client reports and may be sampled. Signal counts describe reported selections, not successful verifications. Version comes from the shipped package metadata. Environment defaults to recognized `NODE_ENV` values (`production` → `prod`, `development` → `dev`, `test` → `test`), otherwise `unknown`; set it explicitly for browser applications. Telemetry observer failures do not affect API calls.
|
|
685
|
+
SDK reports are anonymous client reports and may be sampled. Signal counts describe reported selections, not successful verifications. Version comes from the shipped package metadata. Environment defaults to recognized `NODE_ENV` values (`production` → `prod`, `development` → `dev`, `test` → `test`), otherwise `unknown`; set it explicitly for browser applications. Telemetry observer failures do not affect API calls.
|
|
673
686
|
|
|
674
687
|
### TelemetryConfig
|
|
675
688
|
|
|
@@ -683,6 +696,7 @@ SDK reports are anonymous client reports and may be sampled. Signal counts descr
|
|
|
683
696
|
**Example**:
|
|
684
697
|
```typescript
|
|
685
698
|
const valiron = new ValironSDK({
|
|
699
|
+
apiKey: process.env.VALIRON_API_KEY,
|
|
686
700
|
telemetry: {
|
|
687
701
|
enabled: false, // Disable entirely
|
|
688
702
|
},
|
|
@@ -690,6 +704,7 @@ const valiron = new ValironSDK({
|
|
|
690
704
|
|
|
691
705
|
// Or with custom sampling and handler
|
|
692
706
|
const valiron = new ValironSDK({
|
|
707
|
+
apiKey: process.env.VALIRON_API_KEY,
|
|
693
708
|
telemetry: {
|
|
694
709
|
sampleRate: 0.1, // Sample 10% of events
|
|
695
710
|
onEvent: (event) => { // Custom handler
|
|
@@ -703,10 +718,7 @@ const valiron = new ValironSDK({
|
|
|
703
718
|
|
|
704
719
|
## Middleware
|
|
705
720
|
|
|
706
|
-
|
|
707
|
-
`gate()` (protected endpoint), so they work from any server context without
|
|
708
|
-
agent challenge-response auth. Results are cached client-side (default 30s)
|
|
709
|
-
to survive x402's two-request payment flow and avoid cold-start failures.
|
|
721
|
+
Trust middleware adapters use authenticated profile reads to evaluate route policy locally. Configure the SDK with your server-side operator API key and bind the agent identifier to your authenticated caller. The callback must cryptographically verify the caller and reject replays; a profile lookup or header-presence check is insufficient. Provider identity middleware verifies its separate v2 signed proof protocol. Profile decisions are cached for 30 seconds by default, scoped by threshold and signals. Request proofs are always checked before cache hits.
|
|
710
722
|
|
|
711
723
|
### createValironGate(config) — Express
|
|
712
724
|
|
|
@@ -722,9 +734,10 @@ You do NOT need to wrap it yourself — it's safe to use directly with
|
|
|
722
734
|
```typescript
|
|
723
735
|
import { ValironSDK, valironFastifyPlugin } from "@valiron/sdk";
|
|
724
736
|
|
|
725
|
-
const valiron = new ValironSDK({ chain: "monad" });
|
|
737
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "monad" });
|
|
726
738
|
|
|
727
739
|
fastify.register(valironFastifyPlugin, {
|
|
740
|
+
verifyRequest: verifyAgentRequest,
|
|
728
741
|
sdk: valiron,
|
|
729
742
|
prefix: "/api/paid",
|
|
730
743
|
});
|
|
@@ -735,8 +748,9 @@ fastify.register(valironFastifyPlugin, {
|
|
|
735
748
|
```typescript
|
|
736
749
|
import { ValironSDK, createValironNextMiddleware } from "@valiron/sdk";
|
|
737
750
|
|
|
738
|
-
const valiron = new ValironSDK();
|
|
751
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
739
752
|
export default createValironNextMiddleware({
|
|
753
|
+
verifyRequest: verifyAgentRequest,
|
|
740
754
|
sdk: valiron,
|
|
741
755
|
paths: ["/api/paid"],
|
|
742
756
|
});
|
|
@@ -747,10 +761,11 @@ export default createValironNextMiddleware({
|
|
|
747
761
|
```typescript
|
|
748
762
|
import { ValironSDK, valironGateCheck } from "@valiron/sdk";
|
|
749
763
|
|
|
750
|
-
const valiron = new ValironSDK();
|
|
764
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
751
765
|
|
|
752
766
|
app.use(async (c, next) => {
|
|
753
767
|
const gate = await valironGateCheck(valiron, {
|
|
768
|
+
verifyRequest: (identifier) => verifyAgentRequest(c.req.raw, identifier),
|
|
754
769
|
agentId: c.req.header("x-agent-id") ?? null,
|
|
755
770
|
agentAddress: c.req.header("x-agent-address") ?? null,
|
|
756
771
|
});
|
|
@@ -760,6 +775,41 @@ app.use(async (c, next) => {
|
|
|
760
775
|
});
|
|
761
776
|
```
|
|
762
777
|
|
|
778
|
+
### runValironEdgeGate - Cloudflare Workers (edge)
|
|
779
|
+
|
|
780
|
+
`@valiron/sdk/edge-gate` is a node-free entry point for Cloudflare Workers and other fetch-based edge runtimes. It enforces the same route contract as the Node gates (fresh request-bound proof checked before every decision including cache hits, a 30-second profile cache per isolate, fail-closed 503s) without importing Node built-ins.
|
|
781
|
+
|
|
782
|
+
```typescript
|
|
783
|
+
import {
|
|
784
|
+
ValironClient,
|
|
785
|
+
createEdgeWalletProofVerifier,
|
|
786
|
+
runValironEdgeGate,
|
|
787
|
+
stripEdgeGateHeaders,
|
|
788
|
+
} from "@valiron/sdk/edge-gate";
|
|
789
|
+
|
|
790
|
+
const sdk = new ValironClient({ endpoint: env.VALIRON_ENDPOINT, apiKey: env.VALIRON_API_KEY });
|
|
791
|
+
const verifyRequest = createEdgeWalletProofVerifier({
|
|
792
|
+
sdk,
|
|
793
|
+
nonceStore: env.VALIRON_NONCE_STORE, // Durable Object binding - required, gate fails closed without it
|
|
794
|
+
evmVerifier: { verify: viemVerifyMessage }, // e.g. viem's verifyMessage
|
|
795
|
+
solanaVerifier: webCryptoSolanaVerifier, // exported; WebCrypto Ed25519
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
export default {
|
|
799
|
+
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
|
|
800
|
+
const outcome = await runValironEdgeGate(request, { sdk, verifyRequest, originSecret: env.VALIRON_ORIGIN_SECRET, waitUntil: p => ctx.waitUntil(p) });
|
|
801
|
+
if (!outcome.allowed) return outcome.response;
|
|
802
|
+
const outbound = stripEdgeGateHeaders(request);
|
|
803
|
+
for (const [name, value] of Object.entries(outcome.headers)) outbound.headers.set(name, value);
|
|
804
|
+
return fetch(outbound);
|
|
805
|
+
},
|
|
806
|
+
};
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
Pass `waitUntil: p => ctx.waitUntil(p)` so Workers retains automatic sandbox evaluation after a pending 403 response. Keep the SDK instance stable per isolate for the 30-second profile cache. Pending profiles are deliberately not cached.
|
|
810
|
+
|
|
811
|
+
`verifyRequest` is mandatory and application-owned, exactly as in the Node middleware. `createEdgeWalletProofVerifier` verifies the `valiron-wallet-request-v2` signed-request scheme locally at the edge: the registry owner's EIP-191 (EVM) or Ed25519 (Solana) signature over the canonical payload (agent id, chain, method, exact public URL, canonical JSON body digest, millisecond timestamp within 60 seconds, fresh nonce), checked against the agent's current registry owner wallet from the live profile, with the nonce consumed atomically in a Durable Object (121-second TTL; replay rejected). The SDK core stays dependency-free: callers inject an EVM verifier (viem works) and a Solana verifier (`webCryptoSolanaVerifier` is exported for the WebCrypto path); key-based web2 agents send `x-agent-address` with chain `key`. `createEdgeIdentityVerifier` remains available for hosted ANS verification (`POST /operator/identity/verify`) when the backend has ANS configured. On allow, the worker forwards the request to the origin with the returned trusted `x-valiron-gate-*` headers plus `x-valiron-gate-secret` when `originSecret` is set (the origin must reject requests without it, or be unreachable except through Cloudflare); run `stripEdgeGateHeaders` on every inbound request so clients cannot inject a decision. `MemoryNonceStore` is exported for local tests only - the verifier refuses to run without a nonce store (503, fail-closed). Statuses match the Node gate: 401 `MISSING_AGENT_IDENTITY`, 401 `AGENT_OWNERSHIP_REQUIRED`, 403 `TRUST_GATE_DENIED` / `AGENT_EVALUATION_PENDING`, 503 `TRUST_GATE_UNAVAILABLE`. Because the proof is checked before evaluation, an unreachable Valiron API fails closed as 401 `AGENT_OWNERSHIP_REQUIRED` when the hosted verifier cannot be reached, and as 503 `TRUST_GATE_UNAVAILABLE` when evaluation fails after a successful local wallet proof; the origin is never touched on failure. A deployable template is in `examples/cloudflare-gate-worker`; the full guide is [Cloudflare gate middleware](./CLOUDFLARE-GATE-MIDDLEWARE.md).
|
|
812
|
+
|
|
763
813
|
### Provider identity middleware — ANS and future adapters
|
|
764
814
|
|
|
765
815
|
Provider identity uses dedicated, non-caching gates because every request has
|
|
@@ -774,7 +824,7 @@ import {
|
|
|
774
824
|
} from "@valiron/sdk";
|
|
775
825
|
```
|
|
776
826
|
|
|
777
|
-
`createValironIdentityGate({ sdk, policy, getRawBody? })` protects Express and
|
|
827
|
+
`createValironIdentityGate({ audience: "https://api.example.com", origin: "https://api.example.com", sdk, policy, getRawBody? })` protects Express and
|
|
778
828
|
Connect routes. `valironIdentityFastifyPlugin` provides the equivalent Fastify
|
|
779
829
|
`preHandler`; `createValironIdentityNextMiddleware` hashes a cloned Fetch
|
|
780
830
|
request; and `valironIdentityGateCheck` accepts explicit proof fields and exact
|
|
@@ -803,7 +853,7 @@ without preserving its exact bytes.
|
|
|
803
853
|
|
|
804
854
|
### Client-Side Caching
|
|
805
855
|
|
|
806
|
-
|
|
856
|
+
Trust middleware adapters include a built-in in-memory cache (default TTL: 30 seconds). Provider identity gates do not cache request proofs.
|
|
807
857
|
This is important for payment protocols like x402 that make two requests per payment
|
|
808
858
|
(discover 402 → retry with payment). Without caching, the second trust check can fail
|
|
809
859
|
due to cold-start latency on the edge proxy.
|
|
@@ -878,8 +928,8 @@ Returned by `getAgentProfile()`.
|
|
|
878
928
|
| `agentId` | string | ERC-8004 token ID |
|
|
879
929
|
| `identity` | object | On-chain identity (name, wallet, endpoints, trustModels) |
|
|
880
930
|
| `onchainReputation` | object | Feedback count, average score, Solana ATOM metrics |
|
|
881
|
-
| `routing` | object |
|
|
882
|
-
| `chain` | object | `{
|
|
931
|
+
| `routing` | object | Allowlisted route summary, including `finalRoute`; enforce a gate policy rather than inferring caller authorization from a profile |
|
|
932
|
+
| `chain` | object | `{ network, identityRegistry, reputationRegistry, cluster? }`; infrastructure RPC URLs are omitted |
|
|
883
933
|
| `timestamp` | string | ISO timestamp |
|
|
884
934
|
|
|
885
935
|
### Request Headers
|
|
@@ -928,10 +978,23 @@ import {
|
|
|
928
978
|
|---------|------|-----|
|
|
929
979
|
| Gated endpoints | 3 | Unlimited |
|
|
930
980
|
| Sandbox tests / day | 5 | Unlimited |
|
|
931
|
-
| Webhooks |
|
|
932
|
-
| Proxy gateway |
|
|
933
|
-
| Analytics & logs |
|
|
934
|
-
| Custom tier thresholds |
|
|
935
|
-
| Wallet intelligence |
|
|
981
|
+
| Webhooks | ✓ | ✓ |
|
|
982
|
+
| Proxy gateway | ✓ | ✓ |
|
|
983
|
+
| Analytics & logs | ✓ | ✓ |
|
|
984
|
+
| Custom tier thresholds | ✓ | ✓ |
|
|
985
|
+
| Wallet intelligence | ✓ | ✓ |
|
|
986
|
+
| World ID and Self | ✓ | ✓ |
|
|
987
|
+
| Social Graph (Icebreaker) | — | ✓ |
|
|
988
|
+
| Valiron Crawler Protection | ✓ | ✓ |
|
|
989
|
+
| Monthly agent requests | 10,000 | 100,000 |
|
|
990
|
+
| Monthly bot protection requests | 10,000 | 100,000 |
|
|
936
991
|
|
|
937
992
|
Pro plan requires an operator API key (`val_op_` prefix) from the [Operator Dashboard](./DASHBOARD.md).
|
|
993
|
+
|
|
994
|
+
Usage billing: website signup and a server-side operator API key are required. Free includes 10,000 requests per product per UTC month; Pro includes 100,000 per product. An active paid Pro subscriber can separately enable additional crawler or middleware calls at 0.001 each in the subscription billing currency, displayed before acceptance. Each product has its own allowance, meter and opt-in. Without opt-in, that product stops at 100,000; Free must upgrade after 10,000. Billing uses durable hosted admission counters, not optional telemetry or every local SDK function call. SDK 0.5.0 also requires account activation for returning-browser recognition.
|
|
995
|
+
|
|
996
|
+
Track both products in [Dashboard → Usage](https://www.valiron.co/dashboard/usage): monthly admitted requests, remaining allowance, additional calls and estimated request-overage charges. Counts refresh every 15 seconds while visible; usage billing and traffic analytics use separate data sources.
|
|
997
|
+
|
|
998
|
+
## Crawler managed controls (0.7.0+)
|
|
999
|
+
|
|
1000
|
+
`createCrawlerControlClient({ configuration, apiKey, site })` adds background policy polling; pass it as `controlClient` to `createCrawlerRuntime`. The dashboard manages crawler access and tighter request budgets within installed ceilings, with publish/rollback, runtime revision acknowledgments, optional bounded recent decision logs and opt-in alerts. It does not deploy customer infrastructure or change work concurrency. Static runtimes are unchanged. See [Dashboard controls](./CRAWLER-PROTECTION.md#dashboard-controls) for the setup, API endpoints, leases and retention limits.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Security upgrade: request-bound identity
|
|
2
|
+
|
|
3
|
+
This guide describes the hardened source contract. Check the installed package supports these APIs and coordinate its release with your backend; a source merge does not publish packages or upgrade external clients.
|
|
4
|
+
|
|
5
|
+
Reputation belongs to an agent; an `x-agent-id` or `x-agent-address` header alone does not prove that the caller controls it.
|
|
6
|
+
|
|
7
|
+
## Trust gate integrations
|
|
8
|
+
|
|
9
|
+
`createValironGate`, `valironFastifyPlugin` and `createValironNextMiddleware` require `verifyRequest(request, identifier)`. `valironGateCheck` requires `verifyRequest(identifier)`. The callback must cryptographically verify the current caller against the registry owner or provider-bound key, bind the proof to the API audience, HTTP method, full URL and body, enforce a short timestamp window, and atomically reject replayed nonces in shared storage. It runs before every decision, including reputation-cache hits. An absent or invalid verifier denies the request. Never implement it as a header-presence check.
|
|
10
|
+
|
|
11
|
+
For provider-backed identities, use the built-in identity middleware described in [Provider identity](PROVIDER-IDENTITY.md). Configure its `audience` and trusted `origin`; the middleware computes request context and the raw-body digest locally. New signatures use `valiron-agent-request-v2`. Existing v1 proofs cannot authorize a request.
|
|
12
|
+
|
|
13
|
+
New agents remain denied while their real sandbox evaluation is pending. Provisional simulations do not establish behavioral reputation.
|
|
14
|
+
|
|
15
|
+
## Hosted wrappers, gates and proxy
|
|
16
|
+
|
|
17
|
+
SDK clients can provide a `signRequest({ method, url, body, chain })` callback in `ValironConfig`. It returns the proof headers for the actual URL and serialized body; signing finishes before the network timeout starts. The signer must create a new nonce and timestamp for each call.
|
|
18
|
+
|
|
19
|
+
Signed wallet requests use these headers: `x-agent-timestamp` (milliseconds), `x-agent-nonce` (24–128 URL-safe characters), and `x-agent-request-signature`. EVM owners sign the UTF-8 payload using EIP-191. Solana owners sign the same payload using Ed25519 and encode signatures as base64url.
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
valiron-wallet-request-v2
|
|
23
|
+
agent:<exact-request-agent-id>
|
|
24
|
+
chain:<normalized-chain>
|
|
25
|
+
method:<UPPERCASE-method>
|
|
26
|
+
url:<absolute-public-request-URL>
|
|
27
|
+
body-sha256:<lowercase-SHA256-hex>
|
|
28
|
+
timestamp:<milliseconds>
|
|
29
|
+
nonce:<fresh-nonce>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The body hash covers `JSON.stringify` of the parsed JSON body, or the empty string for a request without a body. The server checks the current registry owner and atomically consumes the nonce. Send a newly signed request for each retry. Provider-identity middleware instead hashes exact raw body bytes; these are separate proof protocols.
|
|
33
|
+
|
|
34
|
+
Only admitted requests consume a hosted wrapper's monthly quota. Crawler Protection applies local rate and access decisions before monthly admission; monthly exhaustion still prevents origin work.
|
|
35
|
+
|
|
36
|
+
## Identity enrollment and endpoints
|
|
37
|
+
|
|
38
|
+
World ID enrollment requires an authenticated Valiron operator, an owner-signed request and the complete, unmodified production IDKit result. Browser assertions and partial proofs are rejected. The server verifies the proof before persisting a link, derives credential strength from the verified credential, and ignores older records without server-verification provenance. Current enrollment accepts the proof-of-human credential. Existing device-only links must not be treated as biometric proof.
|
|
39
|
+
|
|
40
|
+
Self enrollment also requires operator authentication and owner approval. Newly created sessions carry ownership provenance; old sessions cannot create new trusted links. Sandbox probes use short-lived, agent-scoped capabilities rather than exposing observer-control secrets.
|
|
41
|
+
|
|
42
|
+
SDK API endpoints remain configurable. Crawler activation can use an explicitly configured HTTPS endpoint at `/operator/crawlers/activation`. Configure only a service you control and trust: it receives the operator credential. Redirects are rejected.
|
|
43
|
+
|
|
44
|
+
Operator usage analytics now require explicit `analytics: true`. Raw IP addresses, user agents, query strings and paths are not transmitted.
|
|
45
|
+
|
|
46
|
+
## Upgrade checklist
|
|
47
|
+
|
|
48
|
+
1. Configure application-owned verifiers for local gates and paywalls. An invalid or absent verifier returns `AGENT_OWNERSHIP_REQUIRED` (401); failed trust checks return 403.
|
|
49
|
+
2. Configure hosted request signers and migrate provider identities to proof v2. Each payment retry also needs a new identity nonce.
|
|
50
|
+
3. Re-verify older World ID/Self links and re-register operator/chain-scoped webhook subscriptions. Expect cold reputation decisions to deny until a real evaluation completes.
|
|
51
|
+
4. Enable operator analytics only with explicit `analytics: true`; SDK diagnostic telemetry remains separately configured.
|
|
52
|
+
5. Validate stale, replayed, wrong-subject, wrong-method, wrong-URL and altered-body proofs as well as valid requests. Missing verification, quota storage or required identity infrastructure must fail closed.
|
|
53
|
+
|
|
54
|
+
## Example: sign one hosted EVM gate request
|
|
55
|
+
|
|
56
|
+
This Node.js example signs for one configured registry agent and chain. The private key must belong to that agent's current registry owner. Use a wallet/key manager in production; never send the owner key to the API seller. A Solana signer must instead produce the Ed25519/base64url signature described above.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
60
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
61
|
+
import { ValironSDK } from "@valiron/sdk";
|
|
62
|
+
|
|
63
|
+
const agentId = "25459";
|
|
64
|
+
const chain = "ethereum";
|
|
65
|
+
const endpoint = "https://valiron-edge-proxy.onrender.com";
|
|
66
|
+
const key = process.env.AGENT_OWNER_PRIVATE_KEY;
|
|
67
|
+
if (!key) throw new Error("Configure your agent owner's signer");
|
|
68
|
+
const owner = privateKeyToAccount(key as `0x${string}`);
|
|
69
|
+
const sdk = new ValironSDK({
|
|
70
|
+
apiKey: process.env.VALIRON_API_KEY,
|
|
71
|
+
chain,
|
|
72
|
+
endpoint,
|
|
73
|
+
async signRequest(request) {
|
|
74
|
+
const target = new URL(request.url);
|
|
75
|
+
if (target.origin !== endpoint || target.pathname !== `/operator/gate/${agentId}` ||
|
|
76
|
+
request.chain !== chain || request.method !== "POST") {
|
|
77
|
+
throw new Error("This signer is scoped to one agent gate");
|
|
78
|
+
}
|
|
79
|
+
const timestamp = String(Date.now());
|
|
80
|
+
const nonce = randomBytes(24).toString("base64url");
|
|
81
|
+
const digest = createHash("sha256").update(request.body).digest("hex");
|
|
82
|
+
const message = [
|
|
83
|
+
"valiron-wallet-request-v2", `agent:${agentId}`, `chain:${chain}`,
|
|
84
|
+
`method:${request.method}`, `url:${request.url}`, `body-sha256:${digest}`,
|
|
85
|
+
`timestamp:${timestamp}`, `nonce:${nonce}`,
|
|
86
|
+
].join("\n");
|
|
87
|
+
return {
|
|
88
|
+
"x-agent-timestamp": timestamp,
|
|
89
|
+
"x-agent-nonce": nonce,
|
|
90
|
+
"x-agent-request-signature": await owner.signMessage({ message }),
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
const result = await sdk.gate(agentId);
|
|
95
|
+
if (!result.allow) throw new Error("Agent not admitted");
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Use a separately scoped signer for proxy or enrollment operations rather than removing the destination check. This wallet-request protocol is distinct from provider proof v2, which hashes raw bytes and binds an explicit API audience.
|
package/docs/TRUST-MODEL.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Trust Model
|
|
2
2
|
|
|
3
|
+
> **Request verification:** Examples using `verifyAgentRequest` assume an application-owned verifier imported from your own module, not an SDK export. It must verify a fresh signature against the claimed identity, bind method, full URL and body, and atomically reject replayed nonces. See the [request-proof upgrade guide](https://www.valiron.co/docs/agents/SECURITY-UPGRADE-2026-10-31.md). Missing or invalid proofs return 401 before profile-cache lookup.
|
|
4
|
+
|
|
5
|
+
Crawler source verification is separate from this agent reputation model. The [Valiron Crawler Protection](./CRAWLER-PROTECTION.md) uses supported IP/DNS or authenticated verified-WAF evidence, explicit route costs, shared quotas and work concurrency controls. Its `verified` classification is not an AAA–C trust rating, human identification or a promise that a crawl is affordable.
|
|
6
|
+
|
|
3
7
|
Valiron uses a hybrid trust model to evaluate AI agents hitting your API. This document explains what behaviors are evaluated and what each trust tier means for your routing decisions.
|
|
4
8
|
|
|
5
9
|
## Identity proof is not reputation
|
|
@@ -17,11 +21,13 @@ action of `allow`, `limit`, `challenge`, or `block`. An identity with no observe
|
|
|
17
21
|
reputation returns an unknown risk level rather than being inferred as risky.
|
|
18
22
|
|
|
19
23
|
ANS trust-index and lifecycle evidence remain external provider evidence; they
|
|
20
|
-
are not relabeled as Valiron-observed reputation. SDK
|
|
24
|
+
are not relabeled as Valiron-observed reputation. The SDK exposes dedicated
|
|
21
25
|
provider identity gates using `x-valiron-identity-*` proof headers. The ANS
|
|
22
26
|
resolver and provider credentials remain inside Valiron's hosted service. See
|
|
23
27
|
[Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md).
|
|
24
28
|
|
|
29
|
+
Each caller must also prove control of the identity for the current request. Local trust gates require `verifyRequest`; hosted gates require owner-signed v2 proofs. Reputation, human linkage and payment do not independently grant authority to perform an application action. Pending or provisional sandbox results do not permit production access; only completed evaluations contribute a definitive decision.
|
|
30
|
+
|
|
25
31
|
## Trust Tiers
|
|
26
32
|
|
|
27
33
|
Valiron assigns a Moody's-style credit tier from a normalized `0-100` trust score:
|
|
@@ -48,10 +54,10 @@ Supported signals:
|
|
|
48
54
|
|--------|-------------|------|
|
|
49
55
|
| `8004` | ERC-8004 / Solana on-chain reputation | Free |
|
|
50
56
|
| `sandbox` | Valiron behavioral sandbox score | Free |
|
|
51
|
-
| `world` | World ID human-agent link |
|
|
52
|
-
| `self` | Self eligible-human proof and optional Self Agent ID link |
|
|
57
|
+
| `world` | World ID human-agent link | Free |
|
|
58
|
+
| `self` | Self eligible-human proof and optional Self Agent ID link | Free |
|
|
53
59
|
| `icebreaker` | Icebreaker human/background attestation | Pro |
|
|
54
|
-
| `wallet` | Explainable wallet-history activity and risk signal |
|
|
60
|
+
| `wallet` | Explainable wallet-history activity and risk signal | Free |
|
|
55
61
|
|
|
56
62
|
Selected trust signals contribute to a combined trust assessment. Exact weighting and scoring internals are not part of the public API contract.
|
|
57
63
|
|
|
@@ -78,6 +84,7 @@ Or include it in an endpoint policy:
|
|
|
78
84
|
|
|
79
85
|
```typescript
|
|
80
86
|
app.use("/api/high-trust", createValironGate({
|
|
87
|
+
verifyRequest: verifyAgentRequest,
|
|
81
88
|
sdk: valiron,
|
|
82
89
|
trustSignals: ["8004", "sandbox", "wallet"],
|
|
83
90
|
minScore: 80,
|
|
@@ -105,19 +112,14 @@ The forecast combines:
|
|
|
105
112
|
|
|
106
113
|
The output includes `predictedNextScore`, `passProbability`, `riskDirection`, `confidence`, `recommendedPolicy`, `recommendedTests`, and human-readable reasons. A low-confidence forecast means Valiron has sparse evidence; it should be treated as a prompt to run another sandbox evaluation rather than a final judgment.
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
curl -H "Authorization: Bearer YOUR_JWT" \
|
|
112
|
-
https://valiron-edge-proxy.onrender.com/operator/analytics/agents/AGENT_ID/prediction
|
|
113
|
-
```
|
|
115
|
+
Review forecasts on the agent detail page in the Valiron dashboard. Use the SDK trust gate for runtime enforcement.
|
|
114
116
|
|
|
115
117
|
## Checking an Agent's Trust Status
|
|
116
118
|
|
|
117
119
|
```typescript
|
|
118
120
|
import { ValironSDK } from "@valiron/sdk";
|
|
119
121
|
|
|
120
|
-
const valiron = new ValironSDK();
|
|
122
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
121
123
|
const result = await valiron.triggerSandboxTest("AGENT_ID");
|
|
122
124
|
|
|
123
125
|
console.log(`Tier: ${result.tier}`);
|
|
@@ -135,6 +137,7 @@ Use selected signals in middleware:
|
|
|
135
137
|
|
|
136
138
|
```typescript
|
|
137
139
|
app.use("/api/paid", createValironGate({
|
|
140
|
+
verifyRequest: verifyAgentRequest,
|
|
138
141
|
sdk: valiron,
|
|
139
142
|
trustSignals: ["8004", "sandbox"],
|
|
140
143
|
minScore: 70,
|