@valiron/sdk 0.12.0 → 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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValironConfig, CallOptions, AgentProfile, AgentSnapshotSummary, WalletProfile, WalletResolution, SandboxResult, GateResult, GateOptions, RouteDecision, KeyAgentProfile, KeyAgentChallenge, WorldIdStatus, WorldIdAgentProfile, ChannelPreflightResponse, ChannelOpenResponse, ChannelConsumeResponse, ChannelStatusResponse, ChannelSettlementResponse, ChannelHealthResponse } 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,49 +196,75 @@ 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>>;
199
226
  /**
200
227
  * Get a challenge nonce for a key-based agent to prove identity.
201
228
  *
202
229
  * The agent must sign this challenge with its private key and
203
230
  * return the signature via `verifyKeyAgent()`.
204
231
  *
205
- * @param agentKeyHash - SHA-256 hash of the agent's public key
232
+ * @param agentAddress - Ethereum address of the agent
206
233
  * @returns Challenge nonce and expiry
207
234
  *
208
235
  * @example
209
236
  * ```typescript
210
- * const { challenge } = await valiron.getKeyAgentChallenge('a3f8c1d2...');
211
- * const response = signChallenge(challenge, keypair.privateKey, keypair.publicKey);
212
- * const profile = await valiron.verifyKeyAgent(response);
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 });
213
240
  * ```
214
241
  */
215
- getKeyAgentChallenge(agentKeyHash: string): Promise<KeyAgentChallenge>;
242
+ getKeyAgentChallenge(agentAddress: string): Promise<KeyAgentChallenge>;
216
243
  /**
217
- * Verify a key-based agent's identity via challenge-response.
244
+ * Verify a key-based agent's identity via EIP-191 challenge-response.
218
245
  *
219
- * Proves the agent controls the private key corresponding to the
220
- * public key. On success, returns the agent's trust profile.
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.
221
249
  *
222
- * @param params - Challenge response with signature and public key
250
+ * @param params - Challenge response with EIP-191 signature and address
223
251
  * @returns Agent trust profile (behavioral score + Icebreaker context if available)
224
252
  */
225
253
  verifyKeyAgent(params: {
226
254
  challenge: string;
227
255
  signature: string;
228
- publicKey: string;
229
- agentKeyHash: string;
230
- ethereumAddress?: string;
256
+ agentAddress: string;
231
257
  }): Promise<KeyAgentProfile>;
232
258
  /**
233
- * Get trust profile for a key-based agent by its key hash.
259
+ * Get trust profile for a key-based agent by its Ethereum address.
234
260
  *
235
261
  * Returns behavioral score and any Icebreaker ownership context.
236
262
  * The agent must have been verified via challenge-response at least once.
237
263
  *
238
- * @param agentKeyHash - SHA-256 hash of the agent's public key
264
+ * @param agentAddress - Ethereum address (keccak256-derived from secp256k1 public key)
239
265
  * @returns Agent trust profile
240
266
  */
241
- getKeyAgentProfile(agentKeyHash: string): Promise<KeyAgentProfile>;
267
+ getKeyAgentProfile(agentAddress: string): Promise<KeyAgentProfile>;
242
268
  /**
243
269
  * Verify a World ID proof linking a human to an agent.
244
270
  *
@@ -248,7 +274,7 @@ export declare class ValironSDK {
248
274
  *
249
275
  * @param agentId - The ERC-8004 agent ID
250
276
  * @param proof - World ID proof payload from IDKit
251
- * @param options - Optional overrides (e.g. `{ chain: 'world_chain' }`)
277
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
252
278
  * @returns Verification result with updated World ID status
253
279
  *
254
280
  * @example
@@ -300,7 +326,7 @@ export declare class ValironSDK {
300
326
  * while Icebreaker provides background enrichment (LinkedIn, GitHub, etc.).
301
327
  *
302
328
  * @param agentId - The ERC-8004 agent ID
303
- * @param options - Optional overrides (e.g. `{ chain: 'world_chain' }`)
329
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
304
330
  * @returns Combined human trust profile
305
331
  *
306
332
  * @example
@@ -312,103 +338,6 @@ export declare class ValironSDK {
312
338
  * ```
313
339
  */
314
340
  getWorldIdProfile(agentId: string, options?: CallOptions): Promise<WorldIdAgentProfile>;
315
- /**
316
- * Preflight gate check for a Solana payment channel.
317
- *
318
- * Checks the agent's trust score and returns the escrow address,
319
- * credit line, and tier policy. Call this before opening a channel.
320
- *
321
- * @param agentId - The agent ID (ERC-8004 or Solana)
322
- * @param walletAddress - The agent's Solana wallet address
323
- * @returns Preflight result with escrow address and credit line
324
- *
325
- * @example
326
- * ```typescript
327
- * const preflight = await valiron.channelPreflight('25459', 'So1ana...');
328
- * console.log(preflight.escrowAddress); // deposit USDC here
329
- * console.log(preflight.creditLineReadable); // '$50.00'
330
- * console.log(preflight.tier); // 'AA'
331
- * ```
332
- */
333
- channelPreflight(agentId: string, walletAddress: string): Promise<ChannelPreflightResponse>;
334
- /**
335
- * Open a payment channel after depositing USDC to the escrow.
336
- *
337
- * Verifies the deposit transaction on-chain and opens a credit line
338
- * based on the agent's trust tier.
339
- *
340
- * @param agentId - The agent ID
341
- * @param walletAddress - The agent's Solana wallet address
342
- * @param depositSignature - The Solana transaction signature of the USDC deposit
343
- * @returns Channel session with ID, credit line, and expiry
344
- *
345
- * @example
346
- * ```typescript
347
- * const channel = await valiron.channelOpen('25459', 'So1ana...', '5eykt...');
348
- * console.log(channel.sessionId); // 'ch_abc123'
349
- * console.log(channel.creditLineReadable); // '$50.00'
350
- * console.log(channel.expiresAt); // ISO timestamp
351
- * ```
352
- */
353
- channelOpen(agentId: string, walletAddress: string, depositSignature: string): Promise<ChannelOpenResponse>;
354
- /**
355
- * Consume credit from an open payment channel.
356
- *
357
- * Records a charge against the channel's credit line. The session ID
358
- * is used as the authorization token.
359
- *
360
- * @param sessionId - The channel session ID from `channelOpen()`
361
- * @param cost - Amount to charge in USDC (e.g. 0.5 for $0.50)
362
- * @param description - Optional description of the charge
363
- * @returns Usage record with remaining balance
364
- *
365
- * @example
366
- * ```typescript
367
- * const usage = await valiron.channelConsume('ch_abc123', 0.5, 'GPT-4 call');
368
- * console.log(usage.session.remainingReadable); // '$49.50'
369
- * console.log(usage.session.requestCount); // 1
370
- * ```
371
- */
372
- channelConsume(sessionId: string, cost: number, description?: string): Promise<ChannelConsumeResponse>;
373
- /**
374
- * Get the current status of a payment channel.
375
- *
376
- * @param sessionId - The channel session ID
377
- * @returns Channel status with balance, request count, and expiry
378
- *
379
- * @example
380
- * ```typescript
381
- * const status = await valiron.channelStatus('ch_abc123');
382
- * console.log(status.remainingReadable); // '$49.50'
383
- * console.log(status.active); // true
384
- * console.log(status.settled); // false
385
- * ```
386
- */
387
- channelStatus(sessionId: string): Promise<ChannelStatusResponse>;
388
- /**
389
- * Settle and close a payment channel.
390
- *
391
- * Closes the channel, calculates unused credit, and refunds
392
- * unspent USDC back to the agent's wallet on Solana.
393
- *
394
- * @param sessionId - The channel session ID
395
- * @returns Settlement result with refund details
396
- *
397
- * @example
398
- * ```typescript
399
- * const settlement = await valiron.channelSettle('ch_abc123');
400
- * console.log(settlement.totalConsumedReadable); // '$0.50'
401
- * console.log(settlement.refundReadable); // '$49.50'
402
- * console.log(settlement.refundSignature); // Solana TX sig
403
- * ```
404
- */
405
- channelSettle(sessionId: string): Promise<ChannelSettlementResponse>;
406
- /**
407
- * Check payment channel service health.
408
- *
409
- * @returns Health status and escrow address
410
- */
411
- channelHealth(): Promise<ChannelHealthResponse>;
412
341
  /**
413
342
  * Flush any pending telemetry events and release resources.
414
343
  *
@@ -433,7 +362,7 @@ export * from "./types";
433
362
  export { ValironClient } from "./clients";
434
363
  export { createValironGate, valironFastifyPlugin, createValironNextMiddleware, valironGateCheck, } from "./middleware";
435
364
  export type { ValironGateConfig, ValironFastifyConfig, ValironNextConfig, ValironGateCheckResult, } from "./middleware";
436
- export { generateAgentKeypair, deriveKeyHash, generateChallenge, signChallenge, verifyChallenge, } from "./identity";
437
- export type { AgentKeypair, ChallengeResponse, } from "./identity";
365
+ export { isValidAddress, generateChallenge, } from "./identity";
366
+ export type { ChallengeResponse, } from "./identity";
438
367
  export { ValironOperator } from "./operatorSdk";
439
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.ValironOperator = exports.verifyChallenge = exports.signChallenge = exports.generateChallenge = exports.deriveKeyHash = exports.generateAgentKeypair = 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,36 @@ 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
+ }
232
262
  // ─── Key-Based Agent Identity (Web2 Agents) ─────────────────────────────
233
263
  /**
234
264
  * Get a challenge nonce for a key-based agent to prove identity.
@@ -236,42 +266,43 @@ class ValironSDK {
236
266
  * The agent must sign this challenge with its private key and
237
267
  * return the signature via `verifyKeyAgent()`.
238
268
  *
239
- * @param agentKeyHash - SHA-256 hash of the agent's public key
269
+ * @param agentAddress - Ethereum address of the agent
240
270
  * @returns Challenge nonce and expiry
241
271
  *
242
272
  * @example
243
273
  * ```typescript
244
- * const { challenge } = await valiron.getKeyAgentChallenge('a3f8c1d2...');
245
- * const response = signChallenge(challenge, keypair.privateKey, keypair.publicKey);
246
- * const profile = await valiron.verifyKeyAgent(response);
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 });
247
277
  * ```
248
278
  */
249
- async getKeyAgentChallenge(agentKeyHash) {
250
- return this.client.getKeyAgentChallenge(agentKeyHash);
279
+ async getKeyAgentChallenge(agentAddress) {
280
+ return this.client.getKeyAgentChallenge(agentAddress);
251
281
  }
252
282
  /**
253
- * Verify a key-based agent's identity via challenge-response.
283
+ * Verify a key-based agent's identity via EIP-191 challenge-response.
254
284
  *
255
- * Proves the agent controls the private key corresponding to the
256
- * public key. On success, returns the agent's trust profile.
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.
257
288
  *
258
- * @param params - Challenge response with signature and public key
289
+ * @param params - Challenge response with EIP-191 signature and address
259
290
  * @returns Agent trust profile (behavioral score + Icebreaker context if available)
260
291
  */
261
292
  async verifyKeyAgent(params) {
262
293
  return this.client.verifyKeyAgent(params);
263
294
  }
264
295
  /**
265
- * Get trust profile for a key-based agent by its key hash.
296
+ * Get trust profile for a key-based agent by its Ethereum address.
266
297
  *
267
298
  * Returns behavioral score and any Icebreaker ownership context.
268
299
  * The agent must have been verified via challenge-response at least once.
269
300
  *
270
- * @param agentKeyHash - SHA-256 hash of the agent's public key
301
+ * @param agentAddress - Ethereum address (keccak256-derived from secp256k1 public key)
271
302
  * @returns Agent trust profile
272
303
  */
273
- async getKeyAgentProfile(agentKeyHash) {
274
- return this.client.getKeyAgentProfile(agentKeyHash);
304
+ async getKeyAgentProfile(agentAddress) {
305
+ return this.client.getKeyAgentProfile(agentAddress);
275
306
  }
276
307
  // ─── World ID (Proof-of-Personhood) ─────────────────────────────────
277
308
  /**
@@ -283,7 +314,7 @@ class ValironSDK {
283
314
  *
284
315
  * @param agentId - The ERC-8004 agent ID
285
316
  * @param proof - World ID proof payload from IDKit
286
- * @param options - Optional overrides (e.g. `{ chain: 'world_chain' }`)
317
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
287
318
  * @returns Verification result with updated World ID status
288
319
  *
289
320
  * @example
@@ -325,7 +356,7 @@ class ValironSDK {
325
356
  * while Icebreaker provides background enrichment (LinkedIn, GitHub, etc.).
326
357
  *
327
358
  * @param agentId - The ERC-8004 agent ID
328
- * @param options - Optional overrides (e.g. `{ chain: 'world_chain' }`)
359
+ * @param options - Optional overrides (e.g. `{ chain: 'base' }`)
329
360
  * @returns Combined human trust profile
330
361
  *
331
362
  * @example
@@ -339,116 +370,6 @@ class ValironSDK {
339
370
  async getWorldIdProfile(agentId, options) {
340
371
  return this.client.getWorldIdProfile(agentId, options);
341
372
  }
342
- // ─── Payment Channels (Solana) ─────────────────────────────────────────
343
- /**
344
- * Preflight gate check for a Solana payment channel.
345
- *
346
- * Checks the agent's trust score and returns the escrow address,
347
- * credit line, and tier policy. Call this before opening a channel.
348
- *
349
- * @param agentId - The agent ID (ERC-8004 or Solana)
350
- * @param walletAddress - The agent's Solana wallet address
351
- * @returns Preflight result with escrow address and credit line
352
- *
353
- * @example
354
- * ```typescript
355
- * const preflight = await valiron.channelPreflight('25459', 'So1ana...');
356
- * console.log(preflight.escrowAddress); // deposit USDC here
357
- * console.log(preflight.creditLineReadable); // '$50.00'
358
- * console.log(preflight.tier); // 'AA'
359
- * ```
360
- */
361
- async channelPreflight(agentId, walletAddress) {
362
- return this.client.channelPreflight(agentId, walletAddress);
363
- }
364
- /**
365
- * Open a payment channel after depositing USDC to the escrow.
366
- *
367
- * Verifies the deposit transaction on-chain and opens a credit line
368
- * based on the agent's trust tier.
369
- *
370
- * @param agentId - The agent ID
371
- * @param walletAddress - The agent's Solana wallet address
372
- * @param depositSignature - The Solana transaction signature of the USDC deposit
373
- * @returns Channel session with ID, credit line, and expiry
374
- *
375
- * @example
376
- * ```typescript
377
- * const channel = await valiron.channelOpen('25459', 'So1ana...', '5eykt...');
378
- * console.log(channel.sessionId); // 'ch_abc123'
379
- * console.log(channel.creditLineReadable); // '$50.00'
380
- * console.log(channel.expiresAt); // ISO timestamp
381
- * ```
382
- */
383
- async channelOpen(agentId, walletAddress, depositSignature) {
384
- return this.client.channelOpen(agentId, walletAddress, depositSignature);
385
- }
386
- /**
387
- * Consume credit from an open payment channel.
388
- *
389
- * Records a charge against the channel's credit line. The session ID
390
- * is used as the authorization token.
391
- *
392
- * @param sessionId - The channel session ID from `channelOpen()`
393
- * @param cost - Amount to charge in USDC (e.g. 0.5 for $0.50)
394
- * @param description - Optional description of the charge
395
- * @returns Usage record with remaining balance
396
- *
397
- * @example
398
- * ```typescript
399
- * const usage = await valiron.channelConsume('ch_abc123', 0.5, 'GPT-4 call');
400
- * console.log(usage.session.remainingReadable); // '$49.50'
401
- * console.log(usage.session.requestCount); // 1
402
- * ```
403
- */
404
- async channelConsume(sessionId, cost, description) {
405
- return this.client.channelConsume(sessionId, cost, description);
406
- }
407
- /**
408
- * Get the current status of a payment channel.
409
- *
410
- * @param sessionId - The channel session ID
411
- * @returns Channel status with balance, request count, and expiry
412
- *
413
- * @example
414
- * ```typescript
415
- * const status = await valiron.channelStatus('ch_abc123');
416
- * console.log(status.remainingReadable); // '$49.50'
417
- * console.log(status.active); // true
418
- * console.log(status.settled); // false
419
- * ```
420
- */
421
- async channelStatus(sessionId) {
422
- return this.client.channelStatus(sessionId);
423
- }
424
- /**
425
- * Settle and close a payment channel.
426
- *
427
- * Closes the channel, calculates unused credit, and refunds
428
- * unspent USDC back to the agent's wallet on Solana.
429
- *
430
- * @param sessionId - The channel session ID
431
- * @returns Settlement result with refund details
432
- *
433
- * @example
434
- * ```typescript
435
- * const settlement = await valiron.channelSettle('ch_abc123');
436
- * console.log(settlement.totalConsumedReadable); // '$0.50'
437
- * console.log(settlement.refundReadable); // '$49.50'
438
- * console.log(settlement.refundSignature); // Solana TX sig
439
- * ```
440
- */
441
- async channelSettle(sessionId) {
442
- return this.client.channelSettle(sessionId);
443
- }
444
- /**
445
- * Check payment channel service health.
446
- *
447
- * @returns Health status and escrow address
448
- */
449
- async channelHealth() {
450
- return this.client.channelHealth();
451
- }
452
373
  /**
453
374
  * Flush any pending telemetry events and release resources.
454
375
  *
@@ -482,10 +403,7 @@ Object.defineProperty(exports, "valironFastifyPlugin", { enumerable: true, get:
482
403
  Object.defineProperty(exports, "createValironNextMiddleware", { enumerable: true, get: function () { return middleware_1.createValironNextMiddleware; } });
483
404
  Object.defineProperty(exports, "valironGateCheck", { enumerable: true, get: function () { return middleware_1.valironGateCheck; } });
484
405
  var identity_1 = require("./identity");
485
- Object.defineProperty(exports, "generateAgentKeypair", { enumerable: true, get: function () { return identity_1.generateAgentKeypair; } });
486
- Object.defineProperty(exports, "deriveKeyHash", { enumerable: true, get: function () { return identity_1.deriveKeyHash; } });
406
+ Object.defineProperty(exports, "isValidAddress", { enumerable: true, get: function () { return identity_1.isValidAddress; } });
487
407
  Object.defineProperty(exports, "generateChallenge", { enumerable: true, get: function () { return identity_1.generateChallenge; } });
488
- Object.defineProperty(exports, "signChallenge", { enumerable: true, get: function () { return identity_1.signChallenge; } });
489
- Object.defineProperty(exports, "verifyChallenge", { enumerable: true, get: function () { return identity_1.verifyChallenge; } });
490
408
  var operatorSdk_1 = require("./operatorSdk");
491
409
  Object.defineProperty(exports, "ValironOperator", { enumerable: true, get: function () { return operatorSdk_1.ValironOperator; } });
@@ -6,7 +6,7 @@ import type { GateResult } from "./types";
6
6
  * Supports both on-chain (ERC-8004/Solana) and key-based (web2) agents.
7
7
  * Auto-detects agent type from request headers:
8
8
  * - `x-agent-id` → on-chain gate
9
- * - `x-agent-key-hash` → key-based profile lookup
9
+ * - `x-agent-address` (or legacy `x-agent-key-hash`) → key-based profile lookup
10
10
  */
11
11
  export interface ValironGateConfig {
12
12
  /** Configured ValironSDK instance. */
@@ -17,10 +17,10 @@ export interface ValironGateConfig {
17
17
  */
18
18
  extractAgentId?: (req: any) => string | null;
19
19
  /**
20
- * Extract the key-based agent hash from an incoming request.
21
- * Defaults to reading `x-agent-key-hash` header.
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
22
  */
23
- extractAgentKeyHash?: (req: any) => string | null;
23
+ extractAgentAddress?: (req: any) => string | null;
24
24
  /** Minimum Valiron score to allow (default: 65). */
25
25
  minScore?: number;
26
26
  /** TTL for cached sandbox results in ms (default: 86400000 = 24 h). */
@@ -45,7 +45,7 @@ export interface ValironGateConfig {
45
45
  * const valiron = new ValironSDK({ chain: 'monad' });
46
46
  *
47
47
  * // Apply before your x402 / payment handler
48
- * // Works with both on-chain (x-agent-id) and key-based (x-agent-key-hash) agents
48
+ * Works with both on-chain (x-agent-id) and key-based (x-agent-address) agents
49
49
  * app.use('/api/paid', createValironGate({ sdk: valiron }));
50
50
  *
51
51
  * // Custom threshold
@@ -69,10 +69,10 @@ export interface ValironFastifyConfig {
69
69
  */
70
70
  extractAgentId?: (req: any) => string | null;
71
71
  /**
72
- * Extract the key-based agent hash from a Fastify request.
73
- * Defaults to reading `x-agent-key-hash` header.
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
74
  */
75
- extractAgentKeyHash?: (req: any) => string | null;
75
+ extractAgentAddress?: (req: any) => string | null;
76
76
  /** Minimum Valiron score to allow (default: 65). */
77
77
  minScore?: number;
78
78
  /** TTL for cached sandbox results in ms (default: 86400000 = 24 h). */
@@ -127,10 +127,10 @@ export interface ValironNextConfig {
127
127
  */
128
128
  extractAgentId?: (req: Request) => string | null;
129
129
  /**
130
- * Extract the key-based agent hash from a Next.js request.
131
- * Defaults to reading `x-agent-key-hash` header.
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
132
  */
133
- extractAgentKeyHash?: (req: Request) => string | null;
133
+ extractAgentAddress?: (req: Request) => string | null;
134
134
  /** Minimum Valiron score to allow (default: 65). */
135
135
  minScore?: number;
136
136
  /** TTL for cached sandbox results in ms (default: 86400000 = 24 h). */
@@ -206,7 +206,7 @@ export interface ValironGateCheckResult {
206
206
  * app.use('/api/*', async (c, next) => {
207
207
  * const gate = await valironGateCheck(valiron, {
208
208
  * agentId: c.req.header('x-agent-id') ?? null,
209
- * agentKeyHash: c.req.header('x-agent-key-hash') ?? null,
209
+ * agentAddress: c.req.header('x-agent-address') ?? null,
210
210
  * });
211
211
  * if (!gate.allow) return c.json(gate.body, gate.status);
212
212
  * c.set('valiron', gate.result);
@@ -220,7 +220,7 @@ export interface ValironGateCheckResult {
220
220
  * app.use(async (ctx, next) => {
221
221
  * const gate = await valironGateCheck(valiron, {
222
222
  * agentId: ctx.get('x-agent-id') || null,
223
- * agentKeyHash: ctx.get('x-agent-key-hash') || null,
223
+ * agentAddress: ctx.get('x-agent-address') || null,
224
224
  * });
225
225
  * if (!gate.allow) {
226
226
  * ctx.status = gate.status;
@@ -236,7 +236,7 @@ export declare function valironGateCheck(sdk: ValironSDK, opts: {
236
236
  /** On-chain agent ID (ERC-8004 / Solana). */
237
237
  agentId?: string | null;
238
238
  /** Key-based agent hash (web2). Checked if agentId is not provided. */
239
- agentKeyHash?: string | null;
239
+ agentAddress?: string | null;
240
240
  minScore?: number;
241
241
  ttlMs?: number;
242
242
  }): Promise<ValironGateCheckResult>;