@valiron/sdk 0.11.1 → 1.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 CHANGED
@@ -27,10 +27,28 @@ if (gate.allow) { /* serve the request */ }
27
27
 
28
28
  // One-line Express middleware — blocks untrusted agents automatically
29
29
  app.use("/api/paid", createValironGate({ sdk: valiron }));
30
+
31
+ // Fastify, Next.js, and generic middleware also available
32
+ // See SDK Reference for valironFastifyPlugin, createValironNextMiddleware, valironGateCheck
30
33
  ```
31
34
 
32
35
  No API key required for read operations.
33
36
 
37
+ ### Additional Features
38
+
39
+ - **Proxy Gateway** (Pro) — Forward requests through Valiron's edge proxy with SSRF protection
40
+ - **Key-Based Agents** — Support Web2 agents via EIP-191 challenge-response (auto-detected)
41
+ - **World ID** — Verify agent-human linkage via Worldcoin proof-of-personhood
42
+ - **Telemetry** — Optional anonymous usage metrics (disable with `telemetry: { enabled: false }`)
43
+
44
+ ### Cleanup
45
+
46
+ Call `dispose()` when shutting down long-running servers:
47
+
48
+ ```typescript
49
+ await valiron.dispose();
50
+ ```
51
+
34
52
  ## Documentation
35
53
 
36
54
  Full SDK reference, API docs, trust model, and integration guides:
package/dist/clients.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValironConfig, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, SandboxResult, GateResult, GateOptions, CallOptions } from "./types";
1
+ import { ValironConfig, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, SandboxResult, GateResult, GateOptions, CallOptions, KeyAgentChallenge, KeyAgentProfile, WorldIdStatus, WorldIdAgentProfile, ProxyRequest, ProxyResponse } from "./types";
2
2
  /**
3
3
  * HTTP client for the Valiron Operator API.
4
4
  *
@@ -73,6 +73,71 @@ export declare class ValironClient {
73
73
  * `POST /operator/gate/:agentId`
74
74
  */
75
75
  gate(agentId: string, options?: GateOptions): Promise<GateResult>;
76
+ /**
77
+ * Proxy an API call through Valiron's trust gateway.
78
+ *
79
+ * Linear flow: Agent → Valiron → API Seller
80
+ *
81
+ * Valiron evaluates the agent's trust score and either forwards the
82
+ * request to the real API or blocks it with a 403.
83
+ *
84
+ * `POST /proxy/:agentId`
85
+ */
86
+ proxy<T = unknown>(agentId: string, request: ProxyRequest, options?: CallOptions): Promise<ProxyResponse<T>>;
87
+ /**
88
+ * Get a challenge nonce for key-based identity verification.
89
+ *
90
+ * `POST /operator/key/:agentAddress/challenge`
91
+ */
92
+ getKeyAgentChallenge(agentAddress: string): Promise<KeyAgentChallenge>;
93
+ /**
94
+ * Verify a key-based agent via challenge-response signature.
95
+ *
96
+ * `POST /operator/key/verify`
97
+ */
98
+ verifyKeyAgent(params: {
99
+ challenge: string;
100
+ signature: string;
101
+ agentAddress: string;
102
+ }): Promise<KeyAgentProfile>;
103
+ /**
104
+ * Get trust profile for a verified key-based agent.
105
+ *
106
+ * `GET /operator/key/:agentAddress`
107
+ */
108
+ getKeyAgentProfile(agentAddress: string): Promise<KeyAgentProfile>;
109
+ /**
110
+ * Verify a World ID proof linking a human to an agent.
111
+ *
112
+ * `POST /operator/world-id/verify/:agentId`
113
+ */
114
+ verifyWorldId(agentId: string, proof: {
115
+ proof: string;
116
+ merkle_root: string;
117
+ nullifier_hash: string;
118
+ verification_level: "orb" | "device" | "phone";
119
+ }, options?: CallOptions): Promise<{
120
+ ok: boolean;
121
+ agentId: string;
122
+ worldId: WorldIdStatus;
123
+ timestamp: string;
124
+ }>;
125
+ /**
126
+ * Get World ID verification status for an agent.
127
+ *
128
+ * `GET /operator/world-id/status/:agentId`
129
+ */
130
+ getWorldIdStatus(agentId: string, options?: CallOptions): Promise<{
131
+ agentId: string;
132
+ worldId: WorldIdStatus;
133
+ timestamp: string;
134
+ }>;
135
+ /**
136
+ * Get enriched human-agent trust profile (World ID + Icebreaker).
137
+ *
138
+ * `GET /operator/world-id/profile/:agentId`
139
+ */
140
+ getWorldIdProfile(agentId: string, options?: CallOptions): Promise<WorldIdAgentProfile>;
76
141
  /** Flush any pending telemetry events and clean up resources. */
77
142
  dispose(): Promise<void>;
78
143
  private buildHeaders;
package/dist/clients.js CHANGED
@@ -128,6 +128,71 @@ class ValironClient {
128
128
  delete result.reasons;
129
129
  return result;
130
130
  }
131
+ // ─── Proxy Gateway ──────────────────────────────────────────────────────
132
+ /**
133
+ * Proxy an API call through Valiron's trust gateway.
134
+ *
135
+ * Linear flow: Agent → Valiron → API Seller
136
+ *
137
+ * Valiron evaluates the agent's trust score and either forwards the
138
+ * request to the real API or blocks it with a 403.
139
+ *
140
+ * `POST /proxy/:agentId`
141
+ */
142
+ async proxy(agentId, request, options) {
143
+ const chain = this.resolveChain(options);
144
+ return this.post(`/proxy/${agentId}`, request, chain);
145
+ }
146
+ // ─── Key-Based Agent Identity (Web2 Agents) ─────────────────────────────
147
+ /**
148
+ * Get a challenge nonce for key-based identity verification.
149
+ *
150
+ * `POST /operator/key/:agentAddress/challenge`
151
+ */
152
+ async getKeyAgentChallenge(agentAddress) {
153
+ return this.post(`/operator/key/${agentAddress}/challenge`);
154
+ }
155
+ /**
156
+ * Verify a key-based agent via challenge-response signature.
157
+ *
158
+ * `POST /operator/key/verify`
159
+ */
160
+ async verifyKeyAgent(params) {
161
+ return this.post(`/operator/key/verify`, params);
162
+ }
163
+ /**
164
+ * Get trust profile for a verified key-based agent.
165
+ *
166
+ * `GET /operator/key/:agentAddress`
167
+ */
168
+ async getKeyAgentProfile(agentAddress) {
169
+ return this.get(`/operator/key/${agentAddress}`);
170
+ }
171
+ // ─── World ID (Proof-of-Personhood) ───────────────────────────────────
172
+ /**
173
+ * Verify a World ID proof linking a human to an agent.
174
+ *
175
+ * `POST /operator/world-id/verify/:agentId`
176
+ */
177
+ async verifyWorldId(agentId, proof, options) {
178
+ return this.post(`/operator/world-id/verify/${agentId}`, proof, this.resolveChain(options));
179
+ }
180
+ /**
181
+ * Get World ID verification status for an agent.
182
+ *
183
+ * `GET /operator/world-id/status/:agentId`
184
+ */
185
+ async getWorldIdStatus(agentId, options) {
186
+ return this.get(`/operator/world-id/status/${agentId}`, this.resolveChain(options));
187
+ }
188
+ /**
189
+ * Get enriched human-agent trust profile (World ID + Icebreaker).
190
+ *
191
+ * `GET /operator/world-id/profile/:agentId`
192
+ */
193
+ async getWorldIdProfile(agentId, options) {
194
+ return this.get(`/operator/world-id/profile/${agentId}`, this.resolveChain(options));
195
+ }
131
196
  /** Flush any pending telemetry events and clean up resources. */
132
197
  async dispose() {
133
198
  await this.telemetry.dispose();
@@ -332,6 +397,14 @@ class ValironClient {
332
397
  return "triggerSandboxTest";
333
398
  if (path.startsWith("/operator/gate/"))
334
399
  return "gate";
400
+ if (path.startsWith("/operator/world-id/verify/"))
401
+ return "verifyWorldId";
402
+ if (path.startsWith("/operator/world-id/status/"))
403
+ return "getWorldIdStatus";
404
+ if (path.startsWith("/operator/world-id/profile/"))
405
+ return "getWorldIdProfile";
406
+ if (path.startsWith("/operator/key/"))
407
+ return "keyAgent";
335
408
  return "unknown";
336
409
  }
337
410
  }
@@ -0,0 +1,16 @@
1
+ export interface ChallengeResponse {
2
+ /** The challenge nonce that was signed */
3
+ challenge: string;
4
+ /** EIP-191 signature (0x-prefixed hex) */
5
+ signature: string;
6
+ /** The agent's Ethereum address */
7
+ agentAddress: string;
8
+ }
9
+ /** Validate that a string looks like an Ethereum address (0x + 40 hex chars). */
10
+ export declare function isValidAddress(address: string): boolean;
11
+ /**
12
+ * Generate a random challenge nonce for identity verification.
13
+ *
14
+ * @returns A 32-byte hex-encoded nonce
15
+ */
16
+ export declare function generateChallenge(): string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidAddress = isValidAddress;
4
+ exports.generateChallenge = generateChallenge;
5
+ const crypto_1 = require("crypto");
6
+ // ─── Validation Helpers ─────────────────────────────────────────────────────
7
+ /** Validate that a string looks like an Ethereum address (0x + 40 hex chars). */
8
+ function isValidAddress(address) {
9
+ return /^0x[a-fA-F0-9]{40}$/.test(address);
10
+ }
11
+ // ─── Challenge Generation ───────────────────────────────────────────────────
12
+ /**
13
+ * Generate a random challenge nonce for identity verification.
14
+ *
15
+ * @returns A 32-byte hex-encoded nonce
16
+ */
17
+ function generateChallenge() {
18
+ return (0, crypto_1.randomBytes)(32).toString("hex");
19
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValironConfig, CallOptions, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, SandboxResult, GateResult, GateOptions, RouteDecision } from "./types";
1
+ import { ValironConfig, CallOptions, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, SandboxResult, GateResult, GateOptions, RouteDecision, KeyAgentProfile, KeyAgentChallenge, WorldIdStatus, WorldIdAgentProfile, ProxyRequest, ProxyResponse } from "./types";
2
2
  /**
3
3
  * Valiron SDK – Official TypeScript SDK for the Trust Layer for Agentic Economy
4
4
  *
@@ -196,6 +196,148 @@ export declare class ValironSDK {
196
196
  * ```
197
197
  */
198
198
  gate(agentId: string, options?: GateOptions): Promise<GateResult>;
199
+ /**
200
+ * Proxy an API call through Valiron's trust gateway.
201
+ *
202
+ * Linear flow: Agent → Valiron → API Seller
203
+ *
204
+ * Valiron evaluates the agent inline and either forwards the request to
205
+ * the real API or blocks with 403. The agent never touches the API
206
+ * seller directly.
207
+ *
208
+ * @param agentId - On-chain agent ID (ERC-8004 token ID or Solana pubkey)
209
+ * @param request - Target URL, method, headers, and body to forward
210
+ * @param options - Optional chain override
211
+ * @returns Proxied API response wrapped with Valiron metadata
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * const result = await valiron.proxy('25459', {
216
+ * target: 'https://api-seller.example.com/data',
217
+ * method: 'GET',
218
+ * });
219
+ *
220
+ * if (result._valiron.allow) {
221
+ * console.log(result.response); // Real API data
222
+ * }
223
+ * ```
224
+ */
225
+ proxy<T = unknown>(agentId: string, request: ProxyRequest, options?: CallOptions): Promise<ProxyResponse<T>>;
226
+ /**
227
+ * Get a challenge nonce for a key-based agent to prove identity.
228
+ *
229
+ * The agent must sign this challenge with its private key and
230
+ * return the signature via `verifyKeyAgent()`.
231
+ *
232
+ * @param agentAddress - Ethereum address of the agent
233
+ * @returns Challenge nonce and expiry
234
+ *
235
+ * @example
236
+ * ```typescript
237
+ * const { challenge } = await valiron.getKeyAgentChallenge('0x1234...abcd');
238
+ * const signature = await account.signMessage({ message: challenge });
239
+ * const profile = await valiron.verifyKeyAgent({ challenge, signature, agentAddress });
240
+ * ```
241
+ */
242
+ getKeyAgentChallenge(agentAddress: string): Promise<KeyAgentChallenge>;
243
+ /**
244
+ * Verify a key-based agent's identity via EIP-191 challenge-response.
245
+ *
246
+ * The server recovers the signer's address from the signature and verifies
247
+ * it matches the claimed agentAddress. On success, returns the agent's
248
+ * trust profile.
249
+ *
250
+ * @param params - Challenge response with EIP-191 signature and address
251
+ * @returns Agent trust profile (behavioral score + Icebreaker context if available)
252
+ */
253
+ verifyKeyAgent(params: {
254
+ challenge: string;
255
+ signature: string;
256
+ agentAddress: string;
257
+ }): Promise<KeyAgentProfile>;
258
+ /**
259
+ * Get trust profile for a key-based agent by its Ethereum address.
260
+ *
261
+ * Returns behavioral score and any Icebreaker ownership context.
262
+ * The agent must have been verified via challenge-response at least once.
263
+ *
264
+ * @param agentAddress - Ethereum address (keccak256-derived from secp256k1 public key)
265
+ * @returns Agent trust profile
266
+ */
267
+ getKeyAgentProfile(agentAddress: string): Promise<KeyAgentProfile>;
268
+ /**
269
+ * Verify a World ID proof linking a human to an agent.
270
+ *
271
+ * The human uses World ID (IDKit) to generate a zero-knowledge proof
272
+ * of personhood, which is then verified against the World ID API.
273
+ * On success, the agent is marked as human-linked. Links are immutable.
274
+ *
275
+ * @param agentId - The ERC-8004 agent ID
276
+ * @param proof - World ID proof payload from IDKit
277
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
278
+ * @returns Verification result with updated World ID status
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * const result = await valiron.verifyWorldId('25459', {
283
+ * proof: '0x...',
284
+ * merkle_root: '0x...',
285
+ * nullifier_hash: '0x...',
286
+ * verification_level: 'orb',
287
+ * });
288
+ * console.log(result.worldId.verified); // true
289
+ * ```
290
+ */
291
+ verifyWorldId(agentId: string, proof: {
292
+ proof: string;
293
+ merkle_root: string;
294
+ nullifier_hash: string;
295
+ verification_level: "orb" | "device" | "phone";
296
+ }, options?: CallOptions): Promise<{
297
+ ok: boolean;
298
+ agentId: string;
299
+ worldId: WorldIdStatus;
300
+ timestamp: string;
301
+ }>;
302
+ /**
303
+ * Get World ID verification status for an agent.
304
+ *
305
+ * @param agentId - The ERC-8004 agent ID
306
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
307
+ * @returns World ID status including verification level and timestamp
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * const { worldId } = await valiron.getWorldIdStatus('25459');
312
+ * if (worldId.verified) {
313
+ * console.log(`Verified via ${worldId.verificationLevel}`);
314
+ * }
315
+ * ```
316
+ */
317
+ getWorldIdStatus(agentId: string, options?: CallOptions): Promise<{
318
+ agentId: string;
319
+ worldId: WorldIdStatus;
320
+ timestamp: string;
321
+ }>;
322
+ /**
323
+ * Get enriched human-agent trust profile combining World ID + Icebreaker.
324
+ *
325
+ * World ID provides the human-agent link (proof-of-personhood),
326
+ * while Icebreaker provides background enrichment (LinkedIn, GitHub, etc.).
327
+ *
328
+ * @param agentId - The ERC-8004 agent ID
329
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
330
+ * @returns Combined human trust profile
331
+ *
332
+ * @example
333
+ * ```typescript
334
+ * const profile = await valiron.getWorldIdProfile('25459');
335
+ * console.log(profile.humanTrust.hasHumanLink); // true
336
+ * console.log(profile.humanTrust.hasBackground); // true
337
+ * console.log(profile.icebreaker.verifiedHandles); // [{source: 'github', handle: 'alice'}]
338
+ * ```
339
+ */
340
+ getWorldIdProfile(agentId: string, options?: CallOptions): Promise<WorldIdAgentProfile>;
199
341
  /**
200
342
  * Flush any pending telemetry events and release resources.
201
343
  *
@@ -220,3 +362,7 @@ export * from "./types";
220
362
  export { ValironClient } from "./clients";
221
363
  export { createValironGate, valironFastifyPlugin, createValironNextMiddleware, valironGateCheck, } from "./middleware";
222
364
  export type { ValironGateConfig, ValironFastifyConfig, ValironNextConfig, ValironGateCheckResult, } from "./middleware";
365
+ export { isValidAddress, generateChallenge, } from "./identity";
366
+ export type { ChallengeResponse, } from "./identity";
367
+ export { ValironOperator } from "./operatorSdk";
368
+ export type { ValironOperatorConfig, PaywallConfig } from "./operatorSdk";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.valironGateCheck = exports.createValironNextMiddleware = exports.valironFastifyPlugin = exports.createValironGate = exports.ValironClient = exports.ValironSDK = void 0;
17
+ exports.ValironOperator = exports.generateChallenge = exports.isValidAddress = exports.valironGateCheck = exports.createValironNextMiddleware = exports.valironFastifyPlugin = exports.createValironGate = exports.ValironClient = exports.ValironSDK = void 0;
18
18
  const clients_1 = require("./clients");
19
19
  /**
20
20
  * Valiron SDK – Official TypeScript SDK for the Trust Layer for Agentic Economy
@@ -229,6 +229,147 @@ class ValironSDK {
229
229
  async gate(agentId, options) {
230
230
  return this.client.gate(agentId, options);
231
231
  }
232
+ // ─── Proxy Gateway ──────────────────────────────────────────────────────
233
+ /**
234
+ * Proxy an API call through Valiron's trust gateway.
235
+ *
236
+ * Linear flow: Agent → Valiron → API Seller
237
+ *
238
+ * Valiron evaluates the agent inline and either forwards the request to
239
+ * the real API or blocks with 403. The agent never touches the API
240
+ * seller directly.
241
+ *
242
+ * @param agentId - On-chain agent ID (ERC-8004 token ID or Solana pubkey)
243
+ * @param request - Target URL, method, headers, and body to forward
244
+ * @param options - Optional chain override
245
+ * @returns Proxied API response wrapped with Valiron metadata
246
+ *
247
+ * @example
248
+ * ```typescript
249
+ * const result = await valiron.proxy('25459', {
250
+ * target: 'https://api-seller.example.com/data',
251
+ * method: 'GET',
252
+ * });
253
+ *
254
+ * if (result._valiron.allow) {
255
+ * console.log(result.response); // Real API data
256
+ * }
257
+ * ```
258
+ */
259
+ async proxy(agentId, request, options) {
260
+ return this.client.proxy(agentId, request, options);
261
+ }
262
+ // ─── Key-Based Agent Identity (Web2 Agents) ─────────────────────────────
263
+ /**
264
+ * Get a challenge nonce for a key-based agent to prove identity.
265
+ *
266
+ * The agent must sign this challenge with its private key and
267
+ * return the signature via `verifyKeyAgent()`.
268
+ *
269
+ * @param agentAddress - Ethereum address of the agent
270
+ * @returns Challenge nonce and expiry
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * const { challenge } = await valiron.getKeyAgentChallenge('0x1234...abcd');
275
+ * const signature = await account.signMessage({ message: challenge });
276
+ * const profile = await valiron.verifyKeyAgent({ challenge, signature, agentAddress });
277
+ * ```
278
+ */
279
+ async getKeyAgentChallenge(agentAddress) {
280
+ return this.client.getKeyAgentChallenge(agentAddress);
281
+ }
282
+ /**
283
+ * Verify a key-based agent's identity via EIP-191 challenge-response.
284
+ *
285
+ * The server recovers the signer's address from the signature and verifies
286
+ * it matches the claimed agentAddress. On success, returns the agent's
287
+ * trust profile.
288
+ *
289
+ * @param params - Challenge response with EIP-191 signature and address
290
+ * @returns Agent trust profile (behavioral score + Icebreaker context if available)
291
+ */
292
+ async verifyKeyAgent(params) {
293
+ return this.client.verifyKeyAgent(params);
294
+ }
295
+ /**
296
+ * Get trust profile for a key-based agent by its Ethereum address.
297
+ *
298
+ * Returns behavioral score and any Icebreaker ownership context.
299
+ * The agent must have been verified via challenge-response at least once.
300
+ *
301
+ * @param agentAddress - Ethereum address (keccak256-derived from secp256k1 public key)
302
+ * @returns Agent trust profile
303
+ */
304
+ async getKeyAgentProfile(agentAddress) {
305
+ return this.client.getKeyAgentProfile(agentAddress);
306
+ }
307
+ // ─── World ID (Proof-of-Personhood) ─────────────────────────────────
308
+ /**
309
+ * Verify a World ID proof linking a human to an agent.
310
+ *
311
+ * The human uses World ID (IDKit) to generate a zero-knowledge proof
312
+ * of personhood, which is then verified against the World ID API.
313
+ * On success, the agent is marked as human-linked. Links are immutable.
314
+ *
315
+ * @param agentId - The ERC-8004 agent ID
316
+ * @param proof - World ID proof payload from IDKit
317
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
318
+ * @returns Verification result with updated World ID status
319
+ *
320
+ * @example
321
+ * ```typescript
322
+ * const result = await valiron.verifyWorldId('25459', {
323
+ * proof: '0x...',
324
+ * merkle_root: '0x...',
325
+ * nullifier_hash: '0x...',
326
+ * verification_level: 'orb',
327
+ * });
328
+ * console.log(result.worldId.verified); // true
329
+ * ```
330
+ */
331
+ async verifyWorldId(agentId, proof, options) {
332
+ return this.client.verifyWorldId(agentId, proof, options);
333
+ }
334
+ /**
335
+ * Get World ID verification status for an agent.
336
+ *
337
+ * @param agentId - The ERC-8004 agent ID
338
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
339
+ * @returns World ID status including verification level and timestamp
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * const { worldId } = await valiron.getWorldIdStatus('25459');
344
+ * if (worldId.verified) {
345
+ * console.log(`Verified via ${worldId.verificationLevel}`);
346
+ * }
347
+ * ```
348
+ */
349
+ async getWorldIdStatus(agentId, options) {
350
+ return this.client.getWorldIdStatus(agentId, options);
351
+ }
352
+ /**
353
+ * Get enriched human-agent trust profile combining World ID + Icebreaker.
354
+ *
355
+ * World ID provides the human-agent link (proof-of-personhood),
356
+ * while Icebreaker provides background enrichment (LinkedIn, GitHub, etc.).
357
+ *
358
+ * @param agentId - The ERC-8004 agent ID
359
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
360
+ * @returns Combined human trust profile
361
+ *
362
+ * @example
363
+ * ```typescript
364
+ * const profile = await valiron.getWorldIdProfile('25459');
365
+ * console.log(profile.humanTrust.hasHumanLink); // true
366
+ * console.log(profile.humanTrust.hasBackground); // true
367
+ * console.log(profile.icebreaker.verifiedHandles); // [{source: 'github', handle: 'alice'}]
368
+ * ```
369
+ */
370
+ async getWorldIdProfile(agentId, options) {
371
+ return this.client.getWorldIdProfile(agentId, options);
372
+ }
232
373
  /**
233
374
  * Flush any pending telemetry events and release resources.
234
375
  *
@@ -261,3 +402,8 @@ Object.defineProperty(exports, "createValironGate", { enumerable: true, get: fun
261
402
  Object.defineProperty(exports, "valironFastifyPlugin", { enumerable: true, get: function () { return middleware_1.valironFastifyPlugin; } });
262
403
  Object.defineProperty(exports, "createValironNextMiddleware", { enumerable: true, get: function () { return middleware_1.createValironNextMiddleware; } });
263
404
  Object.defineProperty(exports, "valironGateCheck", { enumerable: true, get: function () { return middleware_1.valironGateCheck; } });
405
+ var identity_1 = require("./identity");
406
+ Object.defineProperty(exports, "isValidAddress", { enumerable: true, get: function () { return identity_1.isValidAddress; } });
407
+ Object.defineProperty(exports, "generateChallenge", { enumerable: true, get: function () { return identity_1.generateChallenge; } });
408
+ var operatorSdk_1 = require("./operatorSdk");
409
+ Object.defineProperty(exports, "ValironOperator", { enumerable: true, get: function () { return operatorSdk_1.ValironOperator; } });
@@ -2,15 +2,25 @@ import type { ValironSDK } from "./index";
2
2
  import type { GateResult } from "./types";
3
3
  /**
4
4
  * Configuration for the Valiron trust gate middleware.
5
+ *
6
+ * Supports both on-chain (ERC-8004/Solana) and key-based (web2) agents.
7
+ * Auto-detects agent type from request headers:
8
+ * - `x-agent-id` → on-chain gate
9
+ * - `x-agent-address` (or legacy `x-agent-key-hash`) → key-based profile lookup
5
10
  */
6
11
  export interface ValironGateConfig {
7
12
  /** Configured ValironSDK instance. */
8
13
  sdk: ValironSDK;
9
14
  /**
10
- * Extract the agent ID from an incoming request.
15
+ * Extract the on-chain agent ID from an incoming request.
11
16
  * Defaults to reading `x-agent-id` header.
12
17
  */
13
18
  extractAgentId?: (req: any) => string | null;
19
+ /**
20
+ * Extract the key-based agent address from an incoming request.
21
+ * Defaults to reading `x-agent-address` header (falls back to `x-agent-key-hash`).
22
+ */
23
+ extractAgentAddress?: (req: any) => string | null;
14
24
  /** Minimum Valiron score to allow (default: 65). */
15
25
  minScore?: number;
16
26
  /** TTL for cached sandbox results in ms (default: 86400000 = 24 h). */
@@ -35,6 +45,7 @@ export interface ValironGateConfig {
35
45
  * const valiron = new ValironSDK({ chain: 'monad' });
36
46
  *
37
47
  * // Apply before your x402 / payment handler
48
+ * Works with both on-chain (x-agent-id) and key-based (x-agent-address) agents
38
49
  * app.use('/api/paid', createValironGate({ sdk: valiron }));
39
50
  *
40
51
  * // Custom threshold
@@ -53,10 +64,15 @@ export interface ValironFastifyConfig {
53
64
  /** Configured ValironSDK instance. */
54
65
  sdk: ValironSDK;
55
66
  /**
56
- * Extract the agent ID from a Fastify request.
67
+ * Extract the on-chain agent ID from a Fastify request.
57
68
  * Defaults to reading `x-agent-id` header.
58
69
  */
59
70
  extractAgentId?: (req: any) => string | null;
71
+ /**
72
+ * Extract the key-based agent address from a Fastify request.
73
+ * Defaults to reading `x-agent-address` header (falls back to `x-agent-key-hash`).
74
+ */
75
+ extractAgentAddress?: (req: any) => string | null;
60
76
  /** Minimum Valiron score to allow (default: 65). */
61
77
  minScore?: number;
62
78
  /** TTL for cached sandbox results in ms (default: 86400000 = 24 h). */
@@ -106,10 +122,15 @@ export interface ValironNextConfig {
106
122
  /** Configured ValironSDK instance. */
107
123
  sdk: ValironSDK;
108
124
  /**
109
- * Extract the agent ID from a Next.js request.
125
+ * Extract the on-chain agent ID from a Next.js request.
110
126
  * Defaults to reading `x-agent-id` header.
111
127
  */
112
128
  extractAgentId?: (req: Request) => string | null;
129
+ /**
130
+ * Extract the key-based agent address from a Next.js request.
131
+ * Defaults to reading `x-agent-address` header (falls back to `x-agent-key-hash`).
132
+ */
133
+ extractAgentAddress?: (req: Request) => string | null;
113
134
  /** Minimum Valiron score to allow (default: 65). */
114
135
  minScore?: number;
115
136
  /** TTL for cached sandbox results in ms (default: 86400000 = 24 h). */
@@ -185,6 +206,7 @@ export interface ValironGateCheckResult {
185
206
  * app.use('/api/*', async (c, next) => {
186
207
  * const gate = await valironGateCheck(valiron, {
187
208
  * agentId: c.req.header('x-agent-id') ?? null,
209
+ * agentAddress: c.req.header('x-agent-address') ?? null,
188
210
  * });
189
211
  * if (!gate.allow) return c.json(gate.body, gate.status);
190
212
  * c.set('valiron', gate.result);
@@ -198,6 +220,7 @@ export interface ValironGateCheckResult {
198
220
  * app.use(async (ctx, next) => {
199
221
  * const gate = await valironGateCheck(valiron, {
200
222
  * agentId: ctx.get('x-agent-id') || null,
223
+ * agentAddress: ctx.get('x-agent-address') || null,
201
224
  * });
202
225
  * if (!gate.allow) {
203
226
  * ctx.status = gate.status;
@@ -210,7 +233,10 @@ export interface ValironGateCheckResult {
210
233
  * ```
211
234
  */
212
235
  export declare function valironGateCheck(sdk: ValironSDK, opts: {
213
- agentId: string | null;
236
+ /** On-chain agent ID (ERC-8004 / Solana). */
237
+ agentId?: string | null;
238
+ /** Key-based agent hash (web2). Checked if agentId is not provided. */
239
+ agentAddress?: string | null;
214
240
  minScore?: number;
215
241
  ttlMs?: number;
216
242
  }): Promise<ValironGateCheckResult>;