@valiron/sdk 1.3.1 → 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 -140
- package/dist/clients.d.ts +8 -7
- package/dist/clients.js +35 -25
- 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 +10 -12
- package/dist/index.js +10 -11
- 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 +38 -18
- package/docs/AGENT-READY-APIS.md +3 -181
- package/docs/API-REFERENCE.md +160 -563
- 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 +20 -14
- package/docs/ERRORS.md +36 -17
- package/docs/IDENTITY.md +31 -19
- package/docs/PROVIDER-IDENTITY.md +19 -24
- package/docs/QUICKSTART.md +38 -26
- package/docs/README.md +20 -3
- package/docs/SANDBOX.md +12 -8
- package/docs/SDK-REFERENCE.md +87 -55
- package/docs/SECURITY-UPGRADE-2026-10-31.md +98 -0
- package/docs/TRUST-MODEL.md +17 -23
- package/docs/llms.txt +65 -292
- package/package.json +21 -5
package/docs/SDK-REFERENCE.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
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
|
+
SDK 0.2.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
|
+
|
|
5
15
|
## Installation
|
|
6
16
|
|
|
7
17
|
```bash
|
|
@@ -22,12 +32,13 @@ const valiron = new ValironSDK(config?: ValironConfig);
|
|
|
22
32
|
|
|
23
33
|
| Field | Type | Default | Description |
|
|
24
34
|
|-------|------|---------|-------------|
|
|
25
|
-
| `apiKey` | string | — | Operator API key.
|
|
35
|
+
| `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
36
|
| `endpoint` | string | `https://valiron-edge-proxy.onrender.com` | API base URL |
|
|
27
37
|
| `chain` | SupportedChain | `"ethereum"` | Default blockchain network |
|
|
28
38
|
| `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
39
|
| `debug` | boolean | `false` | Enable debug logging |
|
|
30
|
-
| `telemetry` | TelemetryConfig | — | Optional telemetry configuration |
|
|
40
|
+
| `telemetry` | TelemetryConfig | — | Optional SDK diagnostic telemetry configuration |
|
|
41
|
+
| `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
42
|
|
|
32
43
|
### SupportedChain
|
|
33
44
|
|
|
@@ -77,7 +88,7 @@ if (route === "prod") {
|
|
|
77
88
|
|
|
78
89
|
**Solana example**:
|
|
79
90
|
```typescript
|
|
80
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
91
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
81
92
|
|
|
82
93
|
// By asset pubkey
|
|
83
94
|
const route = await valiron.checkAgent("DFkntsJ9aTCHkK88m6WZVQEvLdLNi4X1LVUgRMqetFPM");
|
|
@@ -107,7 +118,6 @@ interface AgentProfile {
|
|
|
107
118
|
onchainReputation: OnchainReputation;
|
|
108
119
|
routing: {
|
|
109
120
|
finalRoute: RouteDecision;
|
|
110
|
-
meetsThreshold: boolean;
|
|
111
121
|
};
|
|
112
122
|
chain: ChainContext;
|
|
113
123
|
timestamp: string;
|
|
@@ -118,13 +128,12 @@ interface AgentProfile {
|
|
|
118
128
|
```typescript
|
|
119
129
|
const profile = await valiron.getAgentProfile("25459");
|
|
120
130
|
console.log(profile.routing.finalRoute); // "prod"
|
|
121
|
-
console.log(profile.routing.meetsThreshold); // true
|
|
122
131
|
console.log(profile.onchainReputation.averageScore); // 92.5
|
|
123
132
|
```
|
|
124
133
|
|
|
125
134
|
**Solana example**:
|
|
126
135
|
```typescript
|
|
127
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
136
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
128
137
|
const profile = await valiron.getAgentProfile("1226"); // sequential ID works
|
|
129
138
|
|
|
130
139
|
console.log(profile.identity.name); // "NoahScout_Bot.noah"
|
|
@@ -152,7 +161,7 @@ console.log(profile.routing.finalRoute);
|
|
|
152
161
|
|
|
153
162
|
**Solana example**:
|
|
154
163
|
```typescript
|
|
155
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
164
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
156
165
|
const profile = await valiron.getWalletProfile("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9");
|
|
157
166
|
```
|
|
158
167
|
|
|
@@ -160,7 +169,7 @@ const profile = await valiron.getWalletProfile("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwi
|
|
|
160
169
|
|
|
161
170
|
### getWalletRisk(wallet, options?)
|
|
162
171
|
|
|
163
|
-
Return an explainable wallet-history assessment. This is
|
|
172
|
+
Return an explainable wallet-history assessment. This is included with Free and requires an operator API key.
|
|
164
173
|
|
|
165
174
|
```typescript
|
|
166
175
|
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
@@ -185,7 +194,7 @@ Supported history networks are Ethereum, Base, Arbitrum, Optimism, Polygon, and
|
|
|
185
194
|
|
|
186
195
|
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
196
|
|
|
188
|
-
|
|
197
|
+
Wallet resolution returns the associated agent ID when available.
|
|
189
198
|
|
|
190
199
|
Signature: `resolveWallet(wallet: string, options?: { chain?: SupportedChain }): Promise<WalletResolution>`
|
|
191
200
|
|
|
@@ -212,9 +221,10 @@ if (resolution.agentId) {
|
|
|
212
221
|
|
|
213
222
|
**Solana example**:
|
|
214
223
|
```typescript
|
|
215
|
-
const valiron = new ValironSDK({ chain: "solana" });
|
|
224
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
|
|
216
225
|
const resolution = await valiron.resolveWallet("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9");
|
|
217
|
-
//
|
|
226
|
+
// Solana matches return source "solana_registry"; no match returns "none".
|
|
227
|
+
// The SDK 1.4 ResolutionSource type does not yet include "solana_registry".
|
|
218
228
|
```
|
|
219
229
|
|
|
220
230
|
---
|
|
@@ -292,7 +302,7 @@ console.log(result.valironScore); // 85
|
|
|
292
302
|
|
|
293
303
|
### gate(agentId, options?)
|
|
294
304
|
|
|
295
|
-
|
|
305
|
+
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
306
|
|
|
297
307
|
```typescript
|
|
298
308
|
const result = await valiron.gate(agentId: string, options?: {
|
|
@@ -351,9 +361,7 @@ interface AgentSnapshotSummary {
|
|
|
351
361
|
agentId: string;
|
|
352
362
|
snapshotHash: string; // deterministic SHA-256 hash of behavioral evaluation (opaque)
|
|
353
363
|
previousHash: string; // hash from prior evaluation, or "0x0" for first
|
|
354
|
-
encryptedDataUri: string | null; // IPFS CID of encrypted snapshot data, if available
|
|
355
364
|
timestamp: string | null; // ISO 8601 timestamp of evaluation
|
|
356
|
-
interactionCount: number; // total interactions in the evaluation window
|
|
357
365
|
}
|
|
358
366
|
```
|
|
359
367
|
|
|
@@ -362,7 +370,6 @@ interface AgentSnapshotSummary {
|
|
|
362
370
|
const snapshot = await valiron.getAgentSnapshot("25459");
|
|
363
371
|
console.log(snapshot.snapshotHash); // "0x3a7f..."
|
|
364
372
|
console.log(snapshot.previousHash); // "0x0" (genesis) or "0x8b2c..."
|
|
365
|
-
console.log(snapshot.interactionCount); // 15
|
|
366
373
|
```
|
|
367
374
|
|
|
368
375
|
**Notes**:
|
|
@@ -374,7 +381,7 @@ console.log(snapshot.interactionCount); // 15
|
|
|
374
381
|
|
|
375
382
|
### verifyAgentIdentity(proof, policy?)
|
|
376
383
|
|
|
377
|
-
Verifies
|
|
384
|
+
Verifies a provider proof v2 bound to audience, method, full URL and the exact raw-body digest, loads Valiron reputation,
|
|
378
385
|
and returns the requested policy decision.
|
|
379
386
|
|
|
380
387
|
```typescript
|
|
@@ -401,7 +408,7 @@ types, signing helpers, identity statuses, and policy semantics.
|
|
|
401
408
|
|
|
402
409
|
Express-compatible middleware factory. Automatically gates requests based on agent trust.
|
|
403
410
|
|
|
404
|
-
Uses
|
|
411
|
+
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
412
|
|
|
406
413
|
**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
414
|
|
|
@@ -410,6 +417,7 @@ import { ValironSDK, createValironGate } from "@valiron/sdk";
|
|
|
410
417
|
|
|
411
418
|
const gate = createValironGate(config: {
|
|
412
419
|
sdk: ValironSDK;
|
|
420
|
+
verifyRequest: (request: Request, identifier: string) => Promise<boolean>; // required for authorization
|
|
413
421
|
minScore?: number; // default: 65
|
|
414
422
|
trustSignals?: Array<"8004" | "sandbox" | "world" | "self" | "icebreaker" | "wallet">;
|
|
415
423
|
cacheTtlMs?: number; // default: 30000 (30s client-side cache)
|
|
@@ -422,20 +430,21 @@ const gate = createValironGate(config: {
|
|
|
422
430
|
|
|
423
431
|
**Default behavior**:
|
|
424
432
|
- Extracts agent ID from `x-agent-id` header (on-chain) or `x-agent-address` header (key-based)
|
|
425
|
-
- Returns 401 if no
|
|
433
|
+
- Returns 401 if no identity is found, or `AGENT_OWNERSHIP_REQUIRED` if the request verifier is missing or rejects the proof
|
|
426
434
|
- Returns 403 if agent is denied
|
|
427
435
|
- Returns 503 if the trust gate is unreachable (fail-closed)
|
|
428
|
-
- Caches
|
|
436
|
+
- Caches reputation decisions by identity, chain, signal selection and threshold for 30s; verifies each fresh request before cache use
|
|
429
437
|
|
|
430
438
|
**Example**:
|
|
431
439
|
```typescript
|
|
432
|
-
const valiron = new ValironSDK({ chain: "monad" });
|
|
440
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "monad" });
|
|
433
441
|
|
|
434
442
|
// Basic gate
|
|
435
|
-
app.use("/api/paid", createValironGate({ sdk: valiron }));
|
|
443
|
+
app.use("/api/paid", createValironGate({ verifyRequest: verifyAgentRequest, sdk: valiron }));
|
|
436
444
|
|
|
437
445
|
// Custom threshold + longer cache
|
|
438
446
|
app.use("/api/premium", createValironGate({
|
|
447
|
+
verifyRequest: verifyAgentRequest,
|
|
439
448
|
sdk: valiron,
|
|
440
449
|
minScore: 85,
|
|
441
450
|
trustSignals: ["8004", "sandbox"],
|
|
@@ -444,6 +453,7 @@ app.use("/api/premium", createValironGate({
|
|
|
444
453
|
|
|
445
454
|
// Custom agent ID extraction
|
|
446
455
|
app.use("/api/custom", createValironGate({
|
|
456
|
+
verifyRequest: verifyAgentRequest,
|
|
447
457
|
sdk: valiron,
|
|
448
458
|
extractAgentId: (req) => req.query.agent_id as string,
|
|
449
459
|
onDeny: (req, res, result) => {
|
|
@@ -470,7 +480,7 @@ Call this when shutting down long-running processes.
|
|
|
470
480
|
|
|
471
481
|
---
|
|
472
482
|
|
|
473
|
-
## Proxy Gateway
|
|
483
|
+
## Proxy Gateway
|
|
474
484
|
|
|
475
485
|
Forward requests through Valiron's edge proxy with automatic trust gating, logging, and SSRF protection.
|
|
476
486
|
|
|
@@ -527,11 +537,16 @@ For Web2 agents that don't have on-chain identities, Valiron supports key-based
|
|
|
527
537
|
3. Agent signs the nonce with their private key
|
|
528
538
|
4. Valiron verifies the signature and creates a `KeyAgentProfile`
|
|
529
539
|
|
|
530
|
-
The SDK
|
|
540
|
+
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
541
|
|
|
532
542
|
### Sandbox Evaluation for Key Agents
|
|
533
543
|
|
|
534
|
-
New key agents (verified but not yet scored)
|
|
544
|
+
New key agents (verified but not yet scored) receive 403 with `retryAfterMs: 30000`. The middleware attempts to trigger `triggerKeyAgentSandbox()` in the background. This run requires a valid operator API key; if it fails, the agent remains pending until an operator starts an evaluation. After evaluation completes, the agent receives a trust score; middleware allows the request when `verified === true` and the score meets the endpoint's `minScore`.
|
|
545
|
+
|
|
546
|
+
The current key-only sandbox relay does not observe the agent's own HTTP
|
|
547
|
+
behavior. Do not use that score alone to authorize a high-value purchase or
|
|
548
|
+
payout. The Web2 Icebreaker demo uses signed key ownership and reports
|
|
549
|
+
`behavioralScore: null` when no real behavioral evidence exists.
|
|
535
550
|
|
|
536
551
|
You can also trigger evaluation manually:
|
|
537
552
|
|
|
@@ -542,7 +557,7 @@ const result = await valiron.triggerKeyAgentSandbox("0x1234...abcd");
|
|
|
542
557
|
Or via HTTP:
|
|
543
558
|
|
|
544
559
|
```bash
|
|
545
|
-
curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox-key/0x1234...abcd
|
|
560
|
+
curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox-key/0x1234...abcd -H "Authorization: Bearer $VALIRON_API_KEY"
|
|
546
561
|
```
|
|
547
562
|
|
|
548
563
|
### KeyAgentProfile
|
|
@@ -555,10 +570,20 @@ curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox-ke
|
|
|
555
570
|
| `tier` | string \| null | Moody's-style trust tier once scored |
|
|
556
571
|
| `riskLevel` | string \| null | GREEN / YELLOW / RED once scored |
|
|
557
572
|
| `route` | string \| null | Route decision once scored |
|
|
558
|
-
| `icebreaker` | object \| null |
|
|
559
|
-
| `reasons` | string[] |
|
|
573
|
+
| `icebreaker` | object \| null | Redacted from the summary profile; use `getKeyAgentIcebreaker()` with a Pro key |
|
|
574
|
+
| `reasons` | string[] | Redacted from the summary profile |
|
|
560
575
|
| `timestamp` | string | ISO timestamp for the profile response |
|
|
561
576
|
|
|
577
|
+
```typescript
|
|
578
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
579
|
+
const { icebreaker } = await valiron.getKeyAgentIcebreaker(agentAddress);
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
The private Icebreaker result contains the attestation state, owner, verified
|
|
583
|
+
social handles, organization, and profile and credential URLs. It does not
|
|
584
|
+
contain social connections or mutuals, and does not alter the Web2 behavioral
|
|
585
|
+
score automatically.
|
|
586
|
+
|
|
562
587
|
---
|
|
563
588
|
|
|
564
589
|
## World ID Methods
|
|
@@ -567,12 +592,12 @@ Verify agent-human linkage via Worldcoin's zero-knowledge proof system.
|
|
|
567
592
|
|
|
568
593
|
### verifyWorldId(agentId, proof, options?)
|
|
569
594
|
|
|
570
|
-
Submit a
|
|
595
|
+
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.
|
|
571
596
|
|
|
572
597
|
```typescript
|
|
573
598
|
const result = await valiron.verifyWorldId(agentId: string, proof: WorldIdProof, options?: {
|
|
574
599
|
chain?: SupportedChain;
|
|
575
|
-
}): Promise<
|
|
600
|
+
}): Promise<{ ok: boolean; agentId: string; worldId: WorldIdStatus; timestamp: string }>;
|
|
576
601
|
```
|
|
577
602
|
|
|
578
603
|
**Example**:
|
|
@@ -581,7 +606,8 @@ const result = await valiron.verifyWorldId("25459", {
|
|
|
581
606
|
merkle_root: "0x...",
|
|
582
607
|
nullifier_hash: "0x...",
|
|
583
608
|
proof: "0x...",
|
|
584
|
-
|
|
609
|
+
verification_level: "orb",
|
|
610
|
+
idkit_result: idkitResult, // complete, unmodified production IDKit result
|
|
585
611
|
});
|
|
586
612
|
```
|
|
587
613
|
|
|
@@ -592,13 +618,13 @@ Check if an agent has a verified World ID.
|
|
|
592
618
|
```typescript
|
|
593
619
|
const status = await valiron.getWorldIdStatus(agentId: string, options?: {
|
|
594
620
|
chain?: SupportedChain;
|
|
595
|
-
}): Promise<WorldIdStatus>;
|
|
596
|
-
// { verified: true,
|
|
621
|
+
}): Promise<{ agentId: string; worldId: WorldIdStatus; timestamp: string }>;
|
|
622
|
+
// status.worldId: { verified: true, verificationLevel: "orb" }
|
|
597
623
|
```
|
|
598
624
|
|
|
599
625
|
### getWorldIdProfile(agentId, options?)
|
|
600
626
|
|
|
601
|
-
Get
|
|
627
|
+
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.
|
|
602
628
|
|
|
603
629
|
```typescript
|
|
604
630
|
const profile = await valiron.getWorldIdProfile(agentId: string, options?: {
|
|
@@ -614,7 +640,7 @@ Self provides eligible-human verification from government ID credentials and can
|
|
|
614
640
|
|
|
615
641
|
### createSelfSession(agentId, request, options?)
|
|
616
642
|
|
|
617
|
-
Create
|
|
643
|
+
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.
|
|
618
644
|
|
|
619
645
|
```typescript
|
|
620
646
|
const session = await valiron.createSelfSession("25459", {
|
|
@@ -636,7 +662,7 @@ console.log(self.verified, self.selfAgentLinked);
|
|
|
636
662
|
|
|
637
663
|
### getSelfProfile(agentId, options?)
|
|
638
664
|
|
|
639
|
-
Get the
|
|
665
|
+
Get the Self profile with eligibility and agent-binding predicates using a Free or paid operator key; provider identifiers are omitted.
|
|
640
666
|
|
|
641
667
|
```typescript
|
|
642
668
|
const profile = await valiron.getSelfProfile("25459");
|
|
@@ -646,15 +672,15 @@ console.log(profile.humanTrust.hasAgentBinding);
|
|
|
646
672
|
|
|
647
673
|
### verifySelf(agentId, proof, options?)
|
|
648
674
|
|
|
649
|
-
|
|
675
|
+
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.
|
|
650
676
|
|
|
651
677
|
---
|
|
652
678
|
|
|
653
679
|
## Telemetry
|
|
654
680
|
|
|
655
|
-
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
|
|
681
|
+
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.
|
|
656
682
|
|
|
657
|
-
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.
|
|
683
|
+
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.
|
|
658
684
|
|
|
659
685
|
### TelemetryConfig
|
|
660
686
|
|
|
@@ -668,6 +694,7 @@ SDK reports are anonymous client reports and may be sampled. Signal counts descr
|
|
|
668
694
|
**Example**:
|
|
669
695
|
```typescript
|
|
670
696
|
const valiron = new ValironSDK({
|
|
697
|
+
apiKey: process.env.VALIRON_API_KEY,
|
|
671
698
|
telemetry: {
|
|
672
699
|
enabled: false, // Disable entirely
|
|
673
700
|
},
|
|
@@ -675,6 +702,7 @@ const valiron = new ValironSDK({
|
|
|
675
702
|
|
|
676
703
|
// Or with custom sampling and handler
|
|
677
704
|
const valiron = new ValironSDK({
|
|
705
|
+
apiKey: process.env.VALIRON_API_KEY,
|
|
678
706
|
telemetry: {
|
|
679
707
|
sampleRate: 0.1, // Sample 10% of events
|
|
680
708
|
onEvent: (event) => { // Custom handler
|
|
@@ -688,10 +716,7 @@ const valiron = new ValironSDK({
|
|
|
688
716
|
|
|
689
717
|
## Middleware
|
|
690
718
|
|
|
691
|
-
|
|
692
|
-
`gate()` (protected endpoint), so they work from any server context without
|
|
693
|
-
agent challenge-response auth. Results are cached client-side (default 30s)
|
|
694
|
-
to survive x402's two-request payment flow and avoid cold-start failures.
|
|
719
|
+
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.
|
|
695
720
|
|
|
696
721
|
### createValironGate(config) — Express
|
|
697
722
|
|
|
@@ -707,9 +732,10 @@ You do NOT need to wrap it yourself — it's safe to use directly with
|
|
|
707
732
|
```typescript
|
|
708
733
|
import { ValironSDK, valironFastifyPlugin } from "@valiron/sdk";
|
|
709
734
|
|
|
710
|
-
const valiron = new ValironSDK({ chain: "monad" });
|
|
735
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "monad" });
|
|
711
736
|
|
|
712
737
|
fastify.register(valironFastifyPlugin, {
|
|
738
|
+
verifyRequest: verifyAgentRequest,
|
|
713
739
|
sdk: valiron,
|
|
714
740
|
prefix: "/api/paid",
|
|
715
741
|
});
|
|
@@ -720,8 +746,9 @@ fastify.register(valironFastifyPlugin, {
|
|
|
720
746
|
```typescript
|
|
721
747
|
import { ValironSDK, createValironNextMiddleware } from "@valiron/sdk";
|
|
722
748
|
|
|
723
|
-
const valiron = new ValironSDK();
|
|
749
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
724
750
|
export default createValironNextMiddleware({
|
|
751
|
+
verifyRequest: verifyAgentRequest,
|
|
725
752
|
sdk: valiron,
|
|
726
753
|
paths: ["/api/paid"],
|
|
727
754
|
});
|
|
@@ -732,10 +759,11 @@ export default createValironNextMiddleware({
|
|
|
732
759
|
```typescript
|
|
733
760
|
import { ValironSDK, valironGateCheck } from "@valiron/sdk";
|
|
734
761
|
|
|
735
|
-
const valiron = new ValironSDK();
|
|
762
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
736
763
|
|
|
737
764
|
app.use(async (c, next) => {
|
|
738
765
|
const gate = await valironGateCheck(valiron, {
|
|
766
|
+
verifyRequest: (identifier) => verifyAgentRequest(c.req.raw, identifier),
|
|
739
767
|
agentId: c.req.header("x-agent-id") ?? null,
|
|
740
768
|
agentAddress: c.req.header("x-agent-address") ?? null,
|
|
741
769
|
});
|
|
@@ -759,7 +787,7 @@ import {
|
|
|
759
787
|
} from "@valiron/sdk";
|
|
760
788
|
```
|
|
761
789
|
|
|
762
|
-
`createValironIdentityGate({ sdk, policy, getRawBody? })` protects Express and
|
|
790
|
+
`createValironIdentityGate({ audience: "https://api.example.com", origin: "https://api.example.com", sdk, policy, getRawBody? })` protects Express and
|
|
763
791
|
Connect routes. `valironIdentityFastifyPlugin` provides the equivalent Fastify
|
|
764
792
|
`preHandler`; `createValironIdentityNextMiddleware` hashes a cloned Fetch
|
|
765
793
|
request; and `valironIdentityGateCheck` accepts explicit proof fields and exact
|
|
@@ -788,7 +816,7 @@ without preserving its exact bytes.
|
|
|
788
816
|
|
|
789
817
|
### Client-Side Caching
|
|
790
818
|
|
|
791
|
-
|
|
819
|
+
Trust middleware adapters include a built-in in-memory cache (default TTL: 30 seconds). Provider identity gates do not cache request proofs.
|
|
792
820
|
This is important for payment protocols like x402 that make two requests per payment
|
|
793
821
|
(discover 402 → retry with payment). Without caching, the second trust check can fail
|
|
794
822
|
due to cold-start latency on the edge proxy.
|
|
@@ -863,8 +891,8 @@ Returned by `getAgentProfile()`.
|
|
|
863
891
|
| `agentId` | string | ERC-8004 token ID |
|
|
864
892
|
| `identity` | object | On-chain identity (name, wallet, endpoints, trustModels) |
|
|
865
893
|
| `onchainReputation` | object | Feedback count, average score, Solana ATOM metrics |
|
|
866
|
-
| `routing` | object |
|
|
867
|
-
| `chain` | object | `{
|
|
894
|
+
| `routing` | object | Allowlisted route summary, including `finalRoute`; enforce a gate policy rather than inferring caller authorization from a profile |
|
|
895
|
+
| `chain` | object | `{ network, identityRegistry, reputationRegistry, cluster? }`; infrastructure RPC URLs are omitted |
|
|
868
896
|
| `timestamp` | string | ISO timestamp |
|
|
869
897
|
|
|
870
898
|
### Request Headers
|
|
@@ -913,11 +941,15 @@ import {
|
|
|
913
941
|
|---------|------|-----|
|
|
914
942
|
| Gated endpoints | 3 | Unlimited |
|
|
915
943
|
| Sandbox tests / day | 5 | Unlimited |
|
|
916
|
-
| Webhooks |
|
|
917
|
-
| Proxy gateway |
|
|
918
|
-
| Analytics & logs |
|
|
919
|
-
|
|
|
920
|
-
|
|
|
921
|
-
|
|
|
944
|
+
| Webhooks | ✓ | ✓ |
|
|
945
|
+
| Proxy gateway | ✓ | ✓ |
|
|
946
|
+
| Analytics & logs | ✓ | ✓ |
|
|
947
|
+
| Custom tier thresholds | ✓ | ✓ |
|
|
948
|
+
| Wallet intelligence | ✓ | ✓ |
|
|
949
|
+
| World ID and Self | ✓ | ✓ |
|
|
950
|
+
| Social Graph (Icebreaker) | — | ✓ |
|
|
951
|
+
| Valiron Crawler Protection | ✓ | ✓ |
|
|
952
|
+
| Monthly agent requests | 10,000 | 100,000 |
|
|
953
|
+
| Monthly bot protection requests | 10,000 | 100,000 |
|
|
922
954
|
|
|
923
955
|
Pro plan requires an operator API key (`val_op_` prefix) from the [Operator Dashboard](./DASHBOARD.md).
|
|
@@ -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,21 +54,12 @@ 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 |
|
|
55
|
-
|
|
56
|
-
When multiple signals are selected, Valiron computes each signal on a `0-100` scale and normalizes the configured weights across only those selected signals. The default weights are:
|
|
60
|
+
| `wallet` | Explainable wallet-history activity and risk signal | Free |
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|--------|----------------|
|
|
60
|
-
| `sandbox` | 55 |
|
|
61
|
-
| `8004` | 25 |
|
|
62
|
-
| `world` | 15 |
|
|
63
|
-
| `self` | 15 |
|
|
64
|
-
| `icebreaker` | 5 |
|
|
65
|
-
| `wallet` | 15 |
|
|
62
|
+
Selected trust signals contribute to a combined trust assessment. Exact weighting and scoring internals are not part of the public API contract.
|
|
66
63
|
|
|
67
64
|
If no signals are specified, Valiron uses the plug-and-play default: sandbox plus any other available trust signals.
|
|
68
65
|
|
|
@@ -87,6 +84,7 @@ Or include it in an endpoint policy:
|
|
|
87
84
|
|
|
88
85
|
```typescript
|
|
89
86
|
app.use("/api/high-trust", createValironGate({
|
|
87
|
+
verifyRequest: verifyAgentRequest,
|
|
90
88
|
sdk: valiron,
|
|
91
89
|
trustSignals: ["8004", "sandbox", "wallet"],
|
|
92
90
|
minScore: 80,
|
|
@@ -114,19 +112,14 @@ The forecast combines:
|
|
|
114
112
|
|
|
115
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.
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
curl -H "Authorization: Bearer YOUR_JWT" \
|
|
121
|
-
https://valiron-edge-proxy.onrender.com/operator/analytics/agents/AGENT_ID/prediction
|
|
122
|
-
```
|
|
115
|
+
Review forecasts on the agent detail page in the Valiron dashboard. Use the SDK trust gate for runtime enforcement.
|
|
123
116
|
|
|
124
117
|
## Checking an Agent's Trust Status
|
|
125
118
|
|
|
126
119
|
```typescript
|
|
127
120
|
import { ValironSDK } from "@valiron/sdk";
|
|
128
121
|
|
|
129
|
-
const valiron = new ValironSDK();
|
|
122
|
+
const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
|
|
130
123
|
const result = await valiron.triggerSandboxTest("AGENT_ID");
|
|
131
124
|
|
|
132
125
|
console.log(`Tier: ${result.tier}`);
|
|
@@ -137,13 +130,14 @@ console.log(`Meets threshold: ${result.meetsThreshold}`);
|
|
|
137
130
|
Or via HTTP:
|
|
138
131
|
|
|
139
132
|
```bash
|
|
140
|
-
curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/AGENT_ID
|
|
133
|
+
curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/AGENT_ID -H "Authorization: Bearer $VALIRON_API_KEY"
|
|
141
134
|
```
|
|
142
135
|
|
|
143
136
|
Use selected signals in middleware:
|
|
144
137
|
|
|
145
138
|
```typescript
|
|
146
139
|
app.use("/api/paid", createValironGate({
|
|
140
|
+
verifyRequest: verifyAgentRequest,
|
|
147
141
|
sdk: valiron,
|
|
148
142
|
trustSignals: ["8004", "sandbox"],
|
|
149
143
|
minScore: 70,
|
|
@@ -174,4 +168,4 @@ ATOM reputation updated
|
|
|
174
168
|
Next evaluation includes new on-chain data
|
|
175
169
|
```
|
|
176
170
|
|
|
177
|
-
|
|
171
|
+
Feedback write-back is managed by Valiron. Write-back is fire-and-forget — if the transaction fails, the evaluation result is still returned.
|