@valiron/sdk 1.2.1 → 1.3.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.
@@ -0,0 +1,277 @@
1
+ # Provider-Backed Agent Identity
2
+
3
+ Valiron now has a provider-independent verification foundation for identities
4
+ resolved through ANS, DNS, DIDs, API keys, and future standards. An ANS REST
5
+ resolver adapter is implemented and is registered at service startup when its
6
+ credentials and trusted CA bundle are configured. SDK 1.3 adds signing helpers,
7
+ a typed verification method, and dedicated identity gates for Express, Fastify,
8
+ Next.js, and framework-independent runtimes.
9
+
10
+ ## Responsibility boundary
11
+
12
+ An identity provider establishes the agent's canonical identifier, verification
13
+ key or credential, endpoints, metadata, and authoritative organization or domain
14
+ binding. Valiron verifies the signed request proof, prevents replay, attaches
15
+ reputation and activity to the stable provider identity, and applies the API
16
+ seller's policy.
17
+
18
+ Provider trust evidence is not silently converted into Valiron reputation. ANS
19
+ may expose certificate integrity, lifecycle, trust-index, permission, or
20
+ historical signals; Valiron keeps those external signals separate from behavior
21
+ Valiron observed and from the endpoint owner's action-time policy.
22
+
23
+ Valiron does not register domains or issue provider identities.
24
+
25
+ ## Identity statuses
26
+
27
+ | Status | Meaning |
28
+ | --- | --- |
29
+ | `anonymous` | No agent identity was supplied. |
30
+ | `claimed` | An identity was supplied, but resolution, authority binding, freshness, signature, or replay validation failed. |
31
+ | `verified` | The provider authority binding and signed request proof both passed. |
32
+
33
+ `verified` is pseudonymous. It proves that the caller controls the credential
34
+ bound to the agent identity; it does not identify an employee, customer, or
35
+ other human. This endpoint therefore always returns `humanIdentified: false`.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ npm install @valiron/sdk@^1.3.0
41
+ ```
42
+
43
+ ANS credentials and CA certificates are configured by Valiron on the hosted
44
+ verification service. API owners using the SDK do not need GoDaddy credentials
45
+ and must not expose Valiron's provider credentials to agents or browsers.
46
+
47
+ ## Agent: sign and send a request
48
+
49
+ The agent signs the canonical Valiron payload using the private key bound to its
50
+ provider identity. The signing callback lets the agent use its existing key
51
+ manager, HSM, wallet, or provider-specific crypto library.
52
+
53
+ ```typescript
54
+ import {
55
+ agentIdentityProofHeaders,
56
+ createAgentIdentityProof,
57
+ } from "@valiron/sdk";
58
+
59
+ const body = JSON.stringify({ operation: "quote", amount: 25 });
60
+ const proof = await createAgentIdentityProof({
61
+ provider: "ans",
62
+ agentId: "ans://v1.0.0.sales-agent.acme.com",
63
+ body,
64
+ sign: (payload) => agentKey.sign(payload),
65
+ });
66
+
67
+ await fetch("https://api.example.com/quote", {
68
+ method: "POST",
69
+ headers: {
70
+ "content-type": "application/json",
71
+ ...agentIdentityProofHeaders(proof),
72
+ },
73
+ body,
74
+ });
75
+ ```
76
+
77
+ The helper sends these proof headers:
78
+
79
+ | Header | Purpose |
80
+ | --- | --- |
81
+ | `x-valiron-identity-provider` | Resolver name, such as `ans` |
82
+ | `x-valiron-identity-agent-id` | Provider-canonical agent ID |
83
+ | `x-valiron-identity-signature` | Signature over the canonical payload |
84
+ | `x-valiron-identity-timestamp` | ISO 8601 signing time |
85
+ | `x-valiron-identity-nonce` | Unique replay-prevention nonce |
86
+ | `x-valiron-identity-key-id` | Optional provider key selector |
87
+
88
+ These headers are untrusted proof inputs until a Valiron identity gate validates
89
+ them. Never authorize a request merely because an `x-valiron-identity-*` header
90
+ exists, and never treat output metadata such as `x-valiron-tier` or
91
+ `x-valiron-route` as caller authentication.
92
+
93
+ There is intentionally no request-digest header. The receiving API computes
94
+ the SHA-256 digest from the exact request bytes so an agent cannot substitute a
95
+ digest for different content.
96
+
97
+ ## API owner: enforce an identity policy
98
+
99
+ For Express, capture the raw bytes while parsing and install the provider
100
+ identity gate on the protected route:
101
+
102
+ ```typescript
103
+ import express from "express";
104
+ import { ValironSDK, createValironIdentityGate } from "@valiron/sdk";
105
+
106
+ const app = express();
107
+ app.use(express.json({
108
+ verify(req: any, _res, bytes) {
109
+ req.rawBody = Buffer.from(bytes);
110
+ },
111
+ }));
112
+
113
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
114
+
115
+ app.post("/quote", createValironIdentityGate({
116
+ sdk: valiron,
117
+ policy: {
118
+ anonymous: "challenge",
119
+ claimed: "block",
120
+ verified: "allow",
121
+ minReputationScore: 65,
122
+ belowMinimumScore: "limit",
123
+ highRisk: "block",
124
+ },
125
+ }), handler);
126
+ ```
127
+
128
+ Allowed requests expose the normalized result as `req.valironIdentity`.
129
+ `challenge`, `block`, and `limit` decisions return HTTP 401, 403, and 429
130
+ respectively. Verification errors fail closed with HTTP 503. Body-bearing
131
+ Express and Fastify requests return HTTP 400 if exact raw bytes were not
132
+ captured. Next.js middleware safely hashes `request.clone()` automatically.
133
+
134
+ Equivalent exports are `valironIdentityFastifyPlugin`,
135
+ `createValironIdentityNextMiddleware`, and `valironIdentityGateCheck`.
136
+
137
+ ## Low-level verification request
138
+
139
+ `ValironSDK.verifyAgentIdentity(proof, policy)` calls
140
+ `POST /operator/identity/verify`. Advanced integrations can call it directly:
141
+
142
+ ```json
143
+ {
144
+ "provider": "ans",
145
+ "agentId": "ans://v1.0.0.sales-agent.acme.com",
146
+ "signature": "BASE64URL_OR_0xHEX_SIGNATURE",
147
+ "timestamp": "2026-09-04T12:00:00.000Z",
148
+ "nonce": "nonce-0123456789abcdef",
149
+ "requestDigest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
150
+ "keyId": "optional-provider-key-id",
151
+ "policy": {
152
+ "anonymous": "challenge",
153
+ "claimed": "block",
154
+ "verified": "allow",
155
+ "minReputationScore": 65,
156
+ "belowMinimumScore": "limit",
157
+ "mediumRisk": "limit",
158
+ "highRisk": "block"
159
+ }
160
+ }
161
+ ```
162
+
163
+ The signature covers the UTF-8 bytes of this exact payload:
164
+
165
+ ```text
166
+ valiron-agent-request-v1
167
+ agent-id:<provider-canonical-agent-id>
168
+ timestamp:<timestamp-as-submitted>
169
+ nonce:<nonce-as-submitted>
170
+ request-digest:<lowercase-request-digest>
171
+ ```
172
+
173
+ The request digest must use `sha256:` followed by 64 hexadecimal characters.
174
+ The nonce must contain 16–256 URL-safe characters. The default timestamp window
175
+ is five minutes, and nonce claims are retained for ten minutes.
176
+
177
+ The caller must calculate `requestDigest` from the protected request bytes and
178
+ apply the returned decision to that same request. This standalone verification
179
+ endpoint cannot infer the bytes of a separate downstream request.
180
+
181
+ ## Response
182
+
183
+ ```json
184
+ {
185
+ "agentId": "ans://v1.0.0.sales-agent.acme.com",
186
+ "provider": "ans",
187
+ "organization": "Acme Corp",
188
+ "identityStatus": "verified",
189
+ "humanIdentified": false,
190
+ "stableIdentityId": "identity:ans:<sha256>",
191
+ "credentialId": "7b93c61c-e261-488c-89a3-f948119be0a0",
192
+ "credentialVersion": "1.0.0",
193
+ "verifiedAt": "2026-09-04T12:00:00.000Z",
194
+ "reputationScore": 82,
195
+ "riskLevel": "low",
196
+ "policyDecision": {
197
+ "action": "allow",
198
+ "reason": "identity_verified"
199
+ }
200
+ }
201
+ ```
202
+
203
+ The action is one of `allow`, `limit`, `challenge`, or `block`. A verified
204
+ identity without stored reputation returns `reputationScore: null` and
205
+ `riskLevel: "unknown"`; it is not treated as having a negative score.
206
+
207
+ Failed proofs return HTTP 200 with `identityStatus: "claimed"` and a
208
+ machine-readable `failureReason`. See [Errors](./ERRORS.md#provider-backed-identity-errors).
209
+
210
+ ## Replay and storage behavior
211
+
212
+ Nonce claims use an atomic Redis write. Verification returns HTTP 503 when the
213
+ replay store is unavailable, so the flow cannot fail open. Only verified
214
+ requests update the stable identity activity record. Failed claims cannot write
215
+ activity or reputation against the identity they attempted to impersonate.
216
+
217
+ For ANS, the stable reputation subject is the normalized `agentHost`, such as
218
+ `sales-agent.acme.com`. The versioned ANS name and Registry Authority UUID are
219
+ returned as credential identity fields. A new ANS version therefore gets a new
220
+ credential while retaining the same Valiron reputation subject.
221
+
222
+ ## ANS resolver
223
+
224
+ As checked on 2026-09-10, the public ANS reference implementation uses
225
+ versioned `ans://v<major>.<minor>.<patch>.<agentHost>` names. Each version is an
226
+ independent registration with its own UUID and certificates, while `agentHost`
227
+ is the cross-version correlation key.
228
+
229
+ For an ANS claim, the adapter:
230
+
231
+ 1. resolves the exact host and version through `POST /v1/agents/resolution`;
232
+ 2. follows only a same-origin Registry Authority agent-details link;
233
+ 3. requires the UUID, host, ANS name, version, and `ACTIVE` lifecycle state to match;
234
+ 4. loads an identity certificate and validates its time window and signature chain against the configured CA roots;
235
+ 5. requires an exact URI SAN for the versioned ANS name;
236
+ 6. loads the current Transparency Log record, requires `ACTIVE` or `WARNING`, and matches its identity-certificate fingerprint; and
237
+ 7. extracts the certificate public key for the Valiron request proof.
238
+
239
+ The timestamp, nonce, request digest, and `valiron-agent-request-v1` payload are
240
+ a Valiron transport-proof envelope. They are not presented as an ANS-native HTTP
241
+ signature standard.
242
+
243
+ Configure the resolver on the edge-proxy service with:
244
+
245
+ | Variable | Required | Purpose |
246
+ | --- | --- | --- |
247
+ | `ANS_TRUSTED_CA_PEM` | yes | PEM bundle of trusted ANS Registry Authority CA roots; escaped `\\n` is accepted |
248
+ | `ANS_API_KEY` and `ANS_API_SECRET` | one auth method | GoDaddy classic Developer Portal `sso-key` credentials |
249
+ | `ANS_OAUTH_TOKEN` | one auth method | Future OAuth/PAT bearer token; takes precedence, so leave it unset when using classic credentials |
250
+ | `ANS_API_BASE_URL` | no | Registry Authority origin; defaults to `https://api.godaddy.com` |
251
+ | `ANS_TRANSPARENCY_BASE_URL` | no | Transparency Log origin; defaults to the matching production or OTE GoDaddy service |
252
+
253
+ The official production CA bundle is published at
254
+ <https://raw.githubusercontent.com/agentnameservice/ans-registry/main/pki/prod/ca-bundle.pem>
255
+ (with [PKI documentation](https://github.com/agentnameservice/ans-registry/tree/main/pki)).
256
+ Copy its raw PEM content with exact `BEGIN CERTIFICATE` and `END CERTIFICATE`
257
+ lines. Do not include Markdown backslashes or wrap the entire value in literal
258
+ quotes in the Render dashboard. These variables belong to Valiron's service,
259
+ not customer SDK installations.
260
+
261
+ If credentials or the CA bundle are absent, the resolver is not registered and
262
+ ANS claims return `claimed` with `failureReason: "resolver_unavailable"`.
263
+ Malformed, inactive, revoked, mismatched, untrusted, or certificate-less ANS
264
+ records cannot become `verified`.
265
+
266
+ This first adapter does not independently validate live DNS/DANE state, a SCITT
267
+ receipt, Merkle inclusion, checkpoint signatures, OCSP, or CRLs. Those are
268
+ additional ANS integrity checks, not claims made by this endpoint. There is no
269
+ domain-registration feature in Valiron.
270
+
271
+ Public references:
272
+
273
+ - <https://www.godaddy.com/en-in/ans/developers>
274
+ - <https://docs.developer.commerce.godaddy.com/en/docs/references/rest/ans/resolution>
275
+ - <https://github.com/agentnameservice/ans-registry>
276
+ - <https://github.com/agentnameservice/ans-sdk-go>
277
+ - <https://www.rfc-editor.org/rfc/rfc5280#section-6>
@@ -45,9 +45,16 @@ First identify which kind of agent is calling your API:
45
45
  |------------|--------|--------------|
46
46
  | ERC-8004 / Solana agent | `x-agent-id` | `getAgentProfile()` / `/operator/agent/:agentId` |
47
47
  | Local, Web2, or non-ERC-8004 agent | `x-agent-address` | `getKeyAgentProfile()` / `/operator/key/:agentAddress` |
48
+ | Provider-backed identity (ANS and future adapters) | `x-valiron-identity-*` proof headers | `createValironIdentityGate()` / `verifyAgentIdentity()` |
48
49
 
49
50
  Do not pass a local agent name such as `my-agent` to `/operator/agent/:agentId`. That endpoint expects an on-chain ERC-8004 token ID or Solana agent identifier. Non-ERC-8004 agents should use the key-based identity flow from [auth.md](https://www.valiron.co/auth.md).
50
51
 
52
+ For a provider-backed identity, use `createAgentIdentityProof()` in the agent
53
+ runtime and `createValironIdentityGate()` in the API. The receiving gate hashes
54
+ the exact request body, verifies the signature through Valiron, prevents replay,
55
+ and enforces `allow`, `limit`, `challenge`, or `block`. See
56
+ [Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md).
57
+
51
58
  For an on-chain agent, check their trust route:
52
59
 
53
60
  ```typescript
package/docs/README.md CHANGED
@@ -22,6 +22,7 @@ Valiron also provides **API Scaffolding** as a separate product for organization
22
22
  | [SDK-REFERENCE.md](./SDK-REFERENCE.md) | TypeScript SDK methods, signatures, and usage examples |
23
23
  | [TRUST-MODEL.md](./TRUST-MODEL.md) | How agents are scored, what behaviors are penalized, tier assignments |
24
24
  | [IDENTITY.md](./IDENTITY.md) | Agent identity — ERC-8004/Solana agents and key-based Web2 agents |
25
+ | [PROVIDER-IDENTITY.md](./PROVIDER-IDENTITY.md) | Provider-backed identity — SDK signing helpers and gates, normalized proofs, replay protection, policies, and ANS |
25
26
  | [SANDBOX.md](./SANDBOX.md) | How the sandbox evaluates agents and determines production readiness |
26
27
  | [CHAINS.md](./CHAINS.md) | Supported blockchain networks and contract addresses |
27
28
  | [ERRORS.md](./ERRORS.md) | Error codes, troubleshooting, and retry guidance |
@@ -30,6 +31,7 @@ Valiron also provides **API Scaffolding** as a separate product for organization
30
31
 
31
32
  - **Agent ID**: An agent's ERC-8004 token ID (EVM) or Metaplex Core asset pubkey (Solana) — their on-chain identity. Use this with `x-agent-id` and `/operator/agent/:agentId`.
32
33
  - **Key-Based Agent Address**: A persistent Ethereum-style address for a local, Web2, or non-ERC-8004 agent. Use this with `x-agent-address` and `/operator/key/:agentAddress`.
34
+ - **Provider-Backed Identity**: An ANS or future provider identity verified through `ValironSDK.verifyAgentIdentity()`. SDK 1.3 includes signing helpers and dedicated Express, Fastify, Next.js, and generic identity gates. Valiron hosts the ANS credentials and CA configuration.
33
35
  - **Sequential ID** (Solana only): A convenience integer (1, 2, 42…) assigned by the QuantuLabs indexer. Maps to an asset pubkey.
34
36
  - **Trust Tier**: AAA (highest trust) → C (lowest trust). Assigned based on behavioral evaluation.
35
37
  - **Risk Level**: GREEN, YELLOW, or RED.
@@ -47,9 +49,15 @@ Valiron also provides **API Scaffolding** as a separate product for organization
47
49
  | ERC-8004 / on-chain EVM agent | ERC-8004 token ID | `x-agent-id` | `/operator/agent/:agentId` |
48
50
  | Solana 8004 agent | Metaplex Core asset pubkey or indexed ID | `x-agent-id` | `/operator/agent/:agentId?chain=solana` |
49
51
  | Local, Web2, or non-ERC-8004 agent | Persistent Ethereum-style agent address | `x-agent-address` | `/operator/key/:agentAddress` |
52
+ | ANS, DNS, DID, API-key, or future provider identity | Provider-canonical agent ID | `x-valiron-identity-*` proof headers | SDK identity gate or `/operator/identity/verify` |
50
53
 
51
54
  Do not send a local agent name such as `my-agent` to `/operator/agent/:agentId`. That endpoint is for registry-backed on-chain agents. Local and Web2 agents should generate or reuse a persistent keypair, prove ownership through Valiron's challenge-response flow, and then use their `x-agent-address` for trust checks.
52
55
 
56
+ Provider identity gates calculate the digest from the API's exact raw request
57
+ bytes and never trust a caller-supplied digest header. ANS credentials and the
58
+ trusted CA bundle live in Valiron's hosted service, not customer applications. See
59
+ [Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md).
60
+
53
61
  ## Supported Registries
54
62
 
55
63
  | Network | Provider | Identity | Reputation |
@@ -372,6 +372,31 @@ console.log(snapshot.interactionCount); // 15
372
372
 
373
373
  ---
374
374
 
375
+ ### verifyAgentIdentity(proof, policy?)
376
+
377
+ Verifies an ANS or other provider-backed identity, loads Valiron reputation,
378
+ and returns the requested policy decision.
379
+
380
+ ```typescript
381
+ const identity = await valiron.verifyAgentIdentity(proof, {
382
+ anonymous: "challenge",
383
+ claimed: "block",
384
+ verified: "allow",
385
+ minReputationScore: 65,
386
+ belowMinimumScore: "limit",
387
+ highRisk: "block",
388
+ });
389
+ ```
390
+
391
+ For protected API routes, prefer the provider identity middleware below. It
392
+ calculates `requestDigest` from the exact received bytes. Direct callers are
393
+ responsible for binding the proof and decision to those same bytes.
394
+
395
+ See [Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md) for proof and result
396
+ types, signing helpers, identity statuses, and policy semantics.
397
+
398
+ ---
399
+
375
400
  ### createValironGate(config)
376
401
 
377
402
  Express-compatible middleware factory. Automatically gates requests based on agent trust.
@@ -717,6 +742,47 @@ app.use(async (c, next) => {
717
742
  });
718
743
  ```
719
744
 
745
+ ### Provider identity middleware — ANS and future adapters
746
+
747
+ Provider identity uses dedicated, non-caching gates because every request has
748
+ a fresh timestamp and nonce:
749
+
750
+ ```typescript
751
+ import {
752
+ createValironIdentityGate,
753
+ valironIdentityFastifyPlugin,
754
+ createValironIdentityNextMiddleware,
755
+ valironIdentityGateCheck,
756
+ } from "@valiron/sdk";
757
+ ```
758
+
759
+ `createValironIdentityGate({ sdk, policy, getRawBody? })` protects Express and
760
+ Connect routes. `valironIdentityFastifyPlugin` provides the equivalent Fastify
761
+ `preHandler`; `createValironIdentityNextMiddleware` hashes a cloned Fetch
762
+ request; and `valironIdentityGateCheck` accepts explicit proof fields and exact
763
+ body bytes for Hono, Koa, Bun, and custom runtimes.
764
+
765
+ The default transport uses `x-valiron-identity-provider`,
766
+ `x-valiron-identity-agent-id`, `x-valiron-identity-signature`,
767
+ `x-valiron-identity-timestamp`, `x-valiron-identity-nonce`, and optional
768
+ `x-valiron-identity-key-id`. The request digest is never accepted from a header;
769
+ the gate calculates it locally. See
770
+ [Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md#api-owner-enforce-an-identity-policy)
771
+ for complete Express and agent examples.
772
+
773
+ Policy actions map to HTTP status as follows:
774
+
775
+ | Action | Middleware behavior |
776
+ | --- | --- |
777
+ | `allow` | Continue and attach `valironIdentity` to the request |
778
+ | `challenge` | HTTP 401 with `WWW-Authenticate: ValironIdentity` |
779
+ | `block` | HTTP 403 |
780
+ | `limit` | HTTP 429 with `Retry-After: 60` |
781
+
782
+ Unexpected verification failures return 503 and fail closed. Express and
783
+ Fastify return `IDENTITY_RAW_BODY_REQUIRED` with HTTP 400 when a body was parsed
784
+ without preserving its exact bytes.
785
+
720
786
  ### Client-Side Caching
721
787
 
722
788
  All middleware adapters include a built-in in-memory cache (default TTL: 30 seconds).
@@ -821,6 +887,14 @@ import {
821
887
  valironFastifyPlugin,
822
888
  createValironNextMiddleware,
823
889
  valironGateCheck,
890
+ createValironIdentityGate,
891
+ valironIdentityFastifyPlugin,
892
+ createValironIdentityNextMiddleware,
893
+ valironIdentityGateCheck,
894
+ createAgentIdentityProof,
895
+ agentIdentityProofHeaders,
896
+ sha256RequestDigest,
897
+ buildAgentIdentitySigningPayload,
824
898
  isValidAddress,
825
899
  generateChallenge,
826
900
  type WalletRiskSnapshot,
@@ -2,6 +2,26 @@
2
2
 
3
3
  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
4
 
5
+ ## Identity proof is not reputation
6
+
7
+ Provider-backed identity separates who controls an agent identity
8
+ from how that agent should be treated. `anonymous`, `claimed`, and `verified`
9
+ describe identity evidence only. `verified` remains pseudonymous and does not
10
+ mean that Valiron identified a human or that the agent has good behavioral
11
+ history.
12
+
13
+ After identity verification, Valiron looks up reputation using the stable
14
+ provider-canonical subject. For ANS this is `agentHost`, not the versioned ANS
15
+ name or registration UUID. The verification endpoint can then return a policy
16
+ action of `allow`, `limit`, `challenge`, or `block`. An identity with no observed
17
+ reputation returns an unknown risk level rather than being inferred as risky.
18
+
19
+ ANS trust-index and lifecycle evidence remain external provider evidence; they
20
+ are not relabeled as Valiron-observed reputation. SDK 1.3 exposes dedicated
21
+ provider identity gates using `x-valiron-identity-*` proof headers. The ANS
22
+ resolver and provider credentials remain inside Valiron's hosted service. See
23
+ [Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md).
24
+
5
25
  ## Trust Tiers
6
26
 
7
27
  Valiron assigns a Moody's-style credit tier from a normalized `0-100` trust score:
package/docs/llms.txt CHANGED
@@ -10,6 +10,8 @@ On-chain agents use x-agent-id and GET /operator/agent/{agentId}. The agentId is
10
10
 
11
11
  Local, Web2, and non-ERC-8004 agents use x-agent-address plus challenge-response auth. Do not send a local agent name to /operator/agent/{agentId}. Generate or reuse a persistent Ethereum-style keypair, request POST /operator/key/{agentAddress}/challenge, sign the challenge, verify with POST /operator/key/verify, then use x-agent-address and x-agent-session on gated requests. Agents can follow https://www.valiron.co/auth.md.
12
12
 
13
+ Provider-backed identity uses SDK 1.3 signing helpers and x-valiron-identity-* proof headers. Agents call createAgentIdentityProof() and agentIdentityProofHeaders(); API owners use createValironIdentityGate(), valironIdentityFastifyPlugin, createValironIdentityNextMiddleware, or valironIdentityGateCheck. The headers are untrusted proof inputs until the gate hashes exact request bytes, calls verifyAgentIdentity(), prevents replay, and enforces allow|limit|challenge|block. Valiron hosts ANS credentials and CA trust; customers do not configure them. See https://www.valiron.co/docs/agents/PROVIDER-IDENTITY.md.
14
+
13
15
  ## API
14
16
 
15
17
  Base URL: https://valiron-edge-proxy.onrender.com
@@ -45,6 +47,11 @@ POST /operator/key/verify
45
47
  ### Key-based agent profile
46
48
  GET /operator/key/{agentAddress}
47
49
 
50
+ ### Provider-backed identity proof
51
+ POST /operator/identity/verify
52
+ Body: { provider, agentId, signature, timestamp, nonce, requestDigest, keyId?, policy? }
53
+ Returns: { agentId, provider, organization, identityStatus, humanIdentified, stableIdentityId, credentialId?, credentialVersion?, externalTrust?, verifiedAt, failureReason?, reputationScore, riskLevel, policyDecision }
54
+
48
55
  ### Trust gate (allow/deny)
49
56
  POST /operator/gate/{agentId}
50
57
  Body: { "ttlMs": 86400000 }
@@ -67,7 +74,7 @@ GET /operator/health
67
74
  Install: npm install @valiron/sdk
68
75
 
69
76
  ```typescript
70
- import { ValironSDK } from "@valiron/sdk";
77
+ import { ValironSDK, createValironIdentityGate } from "@valiron/sdk";
71
78
  const valiron = new ValironSDK({ chain: "ethereum" });
72
79
 
73
80
  // Quick routing check
@@ -96,6 +103,12 @@ console.log(snapshot.previousHash); // "0x0" (genesis)
96
103
  // Sandbox evaluation for key-based agent
97
104
  const keyResult = await valiron.triggerKeyAgentSandbox("0x1234...abcd");
98
105
  console.log(keyResult.tier); // "A"
106
+
107
+ // Provider identity: low-level verification
108
+ const identity = await valiron.verifyAgentIdentity(proof, { claimed: "block" });
109
+
110
+ // Provider identity: route enforcement
111
+ app.post("/api/quote", createValironIdentityGate({ sdk: valiron }), handler);
99
112
  ```
100
113
 
101
114
  Auto-sandbox: Middleware automatically triggers sandbox evaluation for new agents (on-chain with totalFeedback=0, or key-based with no score). Returns 403 with { error: "Agent pending evaluation", retryAfterMs: 30000 }.
@@ -108,7 +121,7 @@ GET/POST/etc /wrap/{operatorId}/{path}
108
121
 
109
122
  Wrapper config fields: path, method, targetUrl (upstream API base URL), pricePerCall, paymentProtocol ("x402" or "mpp"), paymentNetwork ("eip155:8453", "eip155:84532", "tempo:4217", or "tempo:42431"), payoutAddress, trustEnabled, rateLimit, upstreamAuthType, upstreamAuthHeader, upstreamAuthSecret.
110
123
 
111
- Free wrappers (pricePerCall=0) forward directly to targetUrl. x402 paid wrappers return 402 with x402 payment challenge and require retry with X-PAYMENT. MPP paid wrappers return 402 with WWW-Authenticate: Payment and require retry with Authorization: Payment. Trust-enabled wrappers require x-agent-id and deny untrusted agents before forwarding. Use SDK middleware in your own backend when you need to support x-agent-address.
124
+ Free wrappers (pricePerCall=0) forward directly to targetUrl. x402 paid wrappers return 402 with x402 payment challenge and require retry with X-PAYMENT. MPP paid wrappers return 402 with WWW-Authenticate: Payment and require retry with Authorization: Payment. Trust-enabled wrappers require x-agent-id and deny untrusted agents before forwarding. Use SDK middleware in your own backend when you need to support x-agent-address. Wrapper controls and analytics apply only to traffic sent to `/wrap/{operatorId}/{path}`: publish that URL to agents and protect any public origin with HMAC upstream auth, rejecting direct unsigned requests. Do not treat `x-valiron-*` metadata headers as credentials.
112
125
 
113
126
  ## Operator SDK (ValironOperator)
114
127
 
@@ -256,6 +269,7 @@ All middleware returns actionable JSON. Use the stable `code` for program logic
256
269
  - docs/agents/SDK-REFERENCE.md — TypeScript SDK reference
257
270
  - docs/agents/TRUST-MODEL.md — Trust evaluation and behavioral factors
258
271
  - docs/agents/IDENTITY.md — ERC-8004 identity and reputation
272
+ - docs/agents/PROVIDER-IDENTITY.md — Provider-independent identity proof, replay protection, policy actions, and ANS adapter status
259
273
  - docs/agents/SANDBOX.md — Sandbox testing environment
260
274
  - docs/agents/CHAINS.md — Supported blockchains
261
275
  - docs/agents/ERRORS.md — Error handling and troubleshooting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiron/sdk",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Official TypeScript SDK for Valiron — Trust & Reputation Middleware for API Protection",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "clean": "node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true});\"",
21
21
  "build": "pnpm clean && tsc",
22
22
  "dev": "tsc --watch",
23
- "test": "node test/validate.mjs && node test/validate-examples.mjs && tsx test/test-identity.ts",
23
+ "test": "node test/validate.mjs && node test/validate-examples.mjs && node test/validate-middleware.mjs && node test/validate-provider-identity.mjs && tsx test/test-identity.ts",
24
24
  "prepublishOnly": "pnpm build"
25
25
  },
26
26
  "keywords": [