@valiron/sdk 0.11.0 → 0.12.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
@@ -1,87 +1,52 @@
1
1
  # @valiron/sdk
2
2
 
3
- Official TypeScript SDK for **Valiron** — Trust Infrastructure for AI Agent Systems
3
+ Official TypeScript SDK for **Valiron** — Trust & Reputation Middleware for API Protection
4
4
 
5
- Valiron verifies AI agent trustworthiness using on-chain reputation (ERC-8004) and behavioral analysis. This SDK provides routing decisions based on agent trust scores, enabling you to protect infrastructure while maintaining service availability for verified agents.
5
+ Protect your API endpoints from bad or malicious AI agents. Valiron evaluates incoming agents using on-chain identity (ERC-8004), behavioral sandbox testing, and Moody's-style credit ratings — so you can allow trusted agents and block risky ones automatically.
6
6
 
7
7
  ## Installation
8
8
 
9
9
  ```bash
10
10
  npm install @valiron/sdk
11
- # or
12
- yarn add @valiron/sdk
13
- # or
14
- pnpm add @valiron/sdk
15
11
  ```
16
12
 
17
13
  ## Quick Start
18
14
 
19
15
  ```typescript
20
- import { ValironSDK } from '@valiron/sdk';
16
+ import { ValironSDK, createValironGate } from "@valiron/sdk";
21
17
 
22
- const valiron = new ValironSDK();
18
+ const valiron = new ValironSDK({ chain: "ethereum" });
23
19
 
24
- // Quick routing check
25
- const route = await valiron.checkAgent('25459');
26
- // route: 'prod' | 'prod_throttled' | 'sandbox' | 'sandbox_only'
20
+ // Check if an agent is trusted
21
+ const route = await valiron.checkAgent("AGENT_ID");
22
+ // Returns: "prod" | "prod_throttled" | "sandbox" | "sandbox_only"
27
23
 
28
- // Full trust profile
29
- const profile = await valiron.getAgentProfile('25459');
24
+ // Gate an agent — allow/deny decision
25
+ const gate = await valiron.gate("AGENT_ID");
26
+ if (gate.allow) { /* serve the request */ }
30
27
 
31
- // Trust gate for payment endpoints
32
- const gate = await valiron.gate('25459');
33
- if (gate.allow) { /* proceed */ }
28
+ // One-line Express middleware — blocks untrusted agents automatically
29
+ app.use("/api/paid", createValironGate({ sdk: valiron }));
34
30
 
35
- // Behavioral snapshot (for hash-chain commitments)
36
- const snapshot = await valiron.getAgentSnapshot('25459');
37
- console.log(snapshot.snapshotHash); // '0xabc…'
38
- console.log(snapshot.previousHash); // '0x0' (genesis)
39
-
40
- // Multichain — override per-call or at construction
41
- const monadValiron = new ValironSDK({ chain: 'monad' });
42
- await monadValiron.checkAgent('8348');
43
- await valiron.checkAgent('8348', { chain: 'base' });
44
-
45
- // Solana — use chain: 'solana' with base-58 pubkey or sequential ID
46
- const solanaValiron = new ValironSDK({ chain: 'solana' });
47
- const profile = await solanaValiron.getAgentProfile('1226'); // sequential ID
48
- console.log(profile.identity.name); // 'NoahScout_Bot.noah'
49
- console.log(profile.onchainReputation.solana?.trustTier); // 'trusted'
31
+ // Payment channels (Solana) — trust-adaptive USDC credit lines
32
+ const preflight = await valiron.channelPreflight("1226", "So1anaWa11et...");
33
+ const channel = await valiron.channelOpen("1226", "So1anaWa11et...", "depositTxSig");
34
+ const usage = await valiron.channelConsume(channel.sessionId, 0.50, "API call");
35
+ const settlement = await valiron.channelSettle(channel.sessionId);
50
36
  ```
51
37
 
52
- ## Methods
53
-
54
- | Method | Returns | Description |
55
- |--------|---------|-------------|
56
- | `checkAgent(agentId, opts?)` | `RouteDecision` | Quick routing check |
57
- | `getAgentProfile(agentId, opts?)` | `AgentProfile` | Full trust profile (identity + reputation + routing) |
58
- | `getWalletProfile(wallet, opts?)` | `WalletProfile` | Reverse-lookup wallet → trust profile |
59
- | `resolveWallet(wallet, opts?)` | `WalletResolution` | Lightweight wallet → agentId (Redis → cache → Agent0 subgraph) |
60
- | `triggerSandboxTest(agentId, opts?)` | `SandboxResult` | Run sandbox tests, compute behavioral score |
61
- | `gate(agentId, opts?)` | `GateResult` | Trust gate: reputation + sandbox → allow/deny |
62
- | `getAgentSnapshot(agentId, opts?)` | `AgentSnapshotSummary` | Opaque behavioral snapshot hash for chain commitments |
63
- | `createValironGate(config)` | Express middleware | Drop-in middleware wrapping `gate()` |
64
-
65
- All methods accept an optional `{ chain }` override. See the [full documentation](https://valiron.co/docs) for response shapes, options, and examples.
66
-
67
- ## Telemetry
68
-
69
- Anonymous usage telemetry is collected by default (opt-out). No PII is collected.
70
-
71
- ```ts
72
- const valiron = new ValironSDK({ telemetry: { enabled: false } });
73
-
74
- // Customize
75
- const valiron2 = new ValironSDK({
76
- telemetry: { appId: 'my-app', env: 'prod' },
77
- });
78
- ```
38
+ No API key required for read operations.
79
39
 
80
40
  ## Documentation
81
41
 
82
- - [Full Documentation](https://valiron.co/docs) — interactive docs with all methods, examples, and dynamic pricing
83
- - [llms.txt](https://valiron.co/llms.txt) — compact reference for LLM integration
84
- - [ERC-8004 Standard](https://eips.ethereum.org/EIPS/eip-8004)
42
+ Full SDK reference, API docs, trust model, and integration guides:
43
+
44
+ - **[valiron.co/docs](https://valiron.co/docs)** — interactive documentation
45
+ - **[SDK Reference](https://valiron.co/docs/agents/SDK-REFERENCE.md)** — all methods, options, and response types
46
+ - **[API Reference](https://valiron.co/docs/agents/API-REFERENCE.md)** — HTTP endpoints
47
+ - **[Quickstart](https://valiron.co/docs/agents/QUICKSTART.md)** — get started in 2 minutes
48
+ - **[llms.txt](https://valiron.co/llms.txt)** — compact reference for LLM/agent integration
49
+ - **Install agent skill**: `npx @valiron/skill`
85
50
 
86
51
  ## Support
87
52
 
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, ChannelPreflightResponse, ChannelOpenResponse, ChannelConsumeResponse, ChannelStatusResponse, ChannelSettlementResponse, ChannelHealthResponse } from "./types";
2
2
  /**
3
3
  * HTTP client for the Valiron Operator API.
4
4
  *
@@ -73,10 +73,122 @@ export declare class ValironClient {
73
73
  * `POST /operator/gate/:agentId`
74
74
  */
75
75
  gate(agentId: string, options?: GateOptions): Promise<GateResult>;
76
+ /**
77
+ * Get a challenge nonce for key-based identity verification.
78
+ *
79
+ * `POST /operator/key/:agentKeyHash/challenge`
80
+ */
81
+ getKeyAgentChallenge(agentKeyHash: string): Promise<KeyAgentChallenge>;
82
+ /**
83
+ * Verify a key-based agent via challenge-response signature.
84
+ *
85
+ * `POST /operator/key/verify`
86
+ */
87
+ verifyKeyAgent(params: {
88
+ challenge: string;
89
+ signature: string;
90
+ publicKey: string;
91
+ agentKeyHash: string;
92
+ ethereumAddress?: string;
93
+ }): Promise<KeyAgentProfile>;
94
+ /**
95
+ * Get trust profile for a verified key-based agent.
96
+ *
97
+ * `GET /operator/key/:agentKeyHash`
98
+ */
99
+ getKeyAgentProfile(agentKeyHash: string): Promise<KeyAgentProfile>;
100
+ /**
101
+ * Verify a World ID proof linking a human to an agent.
102
+ *
103
+ * `POST /operator/world-id/verify/:agentId`
104
+ */
105
+ verifyWorldId(agentId: string, proof: {
106
+ proof: string;
107
+ merkle_root: string;
108
+ nullifier_hash: string;
109
+ verification_level: "orb" | "device" | "phone";
110
+ }, options?: CallOptions): Promise<{
111
+ ok: boolean;
112
+ agentId: string;
113
+ worldId: WorldIdStatus;
114
+ timestamp: string;
115
+ }>;
116
+ /**
117
+ * Get World ID verification status for an agent.
118
+ *
119
+ * `GET /operator/world-id/status/:agentId`
120
+ */
121
+ getWorldIdStatus(agentId: string, options?: CallOptions): Promise<{
122
+ agentId: string;
123
+ worldId: WorldIdStatus;
124
+ timestamp: string;
125
+ }>;
126
+ /**
127
+ * Get enriched human-agent trust profile (World ID + Icebreaker).
128
+ *
129
+ * `GET /operator/world-id/profile/:agentId`
130
+ */
131
+ getWorldIdProfile(agentId: string, options?: CallOptions): Promise<WorldIdAgentProfile>;
132
+ /**
133
+ * Preflight gate check for a payment channel.
134
+ *
135
+ * Checks agent trust score, returns escrow address and credit line
136
+ * policy for the agent's tier. Call this before opening a channel.
137
+ *
138
+ * `POST /channel/preflight/:agentId`
139
+ */
140
+ channelPreflight(agentId: string, walletAddress: string): Promise<ChannelPreflightResponse>;
141
+ /**
142
+ * Open a payment channel with a deposit transaction.
143
+ *
144
+ * The agent must have already deposited USDC to the escrow address
145
+ * returned by `channelPreflight()`. Pass the deposit TX signature
146
+ * to verify on-chain and open the credit line.
147
+ *
148
+ * `POST /channel/open/:agentId`
149
+ */
150
+ channelOpen(agentId: string, walletAddress: string, depositSignature: string): Promise<ChannelOpenResponse>;
151
+ /**
152
+ * Consume credit from an open payment channel.
153
+ *
154
+ * Records a usage charge against the channel's credit line.
155
+ * Requires the session ID as a Bearer token in the Authorization header.
156
+ *
157
+ * `POST /channel/consume/:sessionId`
158
+ */
159
+ channelConsume(sessionId: string, cost: number, description?: string): Promise<ChannelConsumeResponse>;
160
+ /**
161
+ * Get the current status of a payment channel.
162
+ *
163
+ * Returns credit usage, remaining balance, request count, and expiry.
164
+ *
165
+ * `GET /channel/status/:sessionId`
166
+ */
167
+ channelStatus(sessionId: string): Promise<ChannelStatusResponse>;
168
+ /**
169
+ * Settle and close a payment channel.
170
+ *
171
+ * Closes the channel, calculates unused credit, and initiates
172
+ * a USDC refund to the agent's wallet for any unspent balance.
173
+ *
174
+ * `POST /channel/settle/:sessionId`
175
+ */
176
+ channelSettle(sessionId: string): Promise<ChannelSettlementResponse>;
177
+ /**
178
+ * Check payment channel service health.
179
+ *
180
+ * `GET /channel/health`
181
+ */
182
+ channelHealth(): Promise<ChannelHealthResponse>;
76
183
  /** Flush any pending telemetry events and clean up resources. */
77
184
  dispose(): Promise<void>;
78
185
  private buildHeaders;
79
186
  private get;
80
187
  private post;
188
+ /**
189
+ * POST with a custom Bearer token (used by channel consume where
190
+ * the session ID is the auth token, not the operator API key).
191
+ */
192
+ private postWithAuth;
81
193
  private extractMethodName;
82
194
  }
package/dist/clients.js CHANGED
@@ -128,6 +128,120 @@ class ValironClient {
128
128
  delete result.reasons;
129
129
  return result;
130
130
  }
131
+ // ─── Key-Based Agent Identity (Web2 Agents) ─────────────────────────────
132
+ /**
133
+ * Get a challenge nonce for key-based identity verification.
134
+ *
135
+ * `POST /operator/key/:agentKeyHash/challenge`
136
+ */
137
+ async getKeyAgentChallenge(agentKeyHash) {
138
+ return this.post(`/operator/key/${agentKeyHash}/challenge`);
139
+ }
140
+ /**
141
+ * Verify a key-based agent via challenge-response signature.
142
+ *
143
+ * `POST /operator/key/verify`
144
+ */
145
+ async verifyKeyAgent(params) {
146
+ return this.post(`/operator/key/verify`, params);
147
+ }
148
+ /**
149
+ * Get trust profile for a verified key-based agent.
150
+ *
151
+ * `GET /operator/key/:agentKeyHash`
152
+ */
153
+ async getKeyAgentProfile(agentKeyHash) {
154
+ return this.get(`/operator/key/${agentKeyHash}`);
155
+ }
156
+ // ─── World ID (Proof-of-Personhood) ───────────────────────────────────
157
+ /**
158
+ * Verify a World ID proof linking a human to an agent.
159
+ *
160
+ * `POST /operator/world-id/verify/:agentId`
161
+ */
162
+ async verifyWorldId(agentId, proof, options) {
163
+ return this.post(`/operator/world-id/verify/${agentId}`, proof, this.resolveChain(options));
164
+ }
165
+ /**
166
+ * Get World ID verification status for an agent.
167
+ *
168
+ * `GET /operator/world-id/status/:agentId`
169
+ */
170
+ async getWorldIdStatus(agentId, options) {
171
+ return this.get(`/operator/world-id/status/${agentId}`, this.resolveChain(options));
172
+ }
173
+ /**
174
+ * Get enriched human-agent trust profile (World ID + Icebreaker).
175
+ *
176
+ * `GET /operator/world-id/profile/:agentId`
177
+ */
178
+ async getWorldIdProfile(agentId, options) {
179
+ return this.get(`/operator/world-id/profile/${agentId}`, this.resolveChain(options));
180
+ }
181
+ // ─── Payment Channels (Solana) ──────────────────────────────────────────
182
+ /**
183
+ * Preflight gate check for a payment channel.
184
+ *
185
+ * Checks agent trust score, returns escrow address and credit line
186
+ * policy for the agent's tier. Call this before opening a channel.
187
+ *
188
+ * `POST /channel/preflight/:agentId`
189
+ */
190
+ async channelPreflight(agentId, walletAddress) {
191
+ return this.post(`/channel/preflight/${agentId}`, { walletAddress });
192
+ }
193
+ /**
194
+ * Open a payment channel with a deposit transaction.
195
+ *
196
+ * The agent must have already deposited USDC to the escrow address
197
+ * returned by `channelPreflight()`. Pass the deposit TX signature
198
+ * to verify on-chain and open the credit line.
199
+ *
200
+ * `POST /channel/open/:agentId`
201
+ */
202
+ async channelOpen(agentId, walletAddress, depositSignature) {
203
+ return this.post(`/channel/open/${agentId}`, { walletAddress, depositSignature });
204
+ }
205
+ /**
206
+ * Consume credit from an open payment channel.
207
+ *
208
+ * Records a usage charge against the channel's credit line.
209
+ * Requires the session ID as a Bearer token in the Authorization header.
210
+ *
211
+ * `POST /channel/consume/:sessionId`
212
+ */
213
+ async channelConsume(sessionId, cost, description) {
214
+ return this.postWithAuth(`/channel/consume/${sessionId}`, { cost, ...(description ? { description } : {}) }, sessionId);
215
+ }
216
+ /**
217
+ * Get the current status of a payment channel.
218
+ *
219
+ * Returns credit usage, remaining balance, request count, and expiry.
220
+ *
221
+ * `GET /channel/status/:sessionId`
222
+ */
223
+ async channelStatus(sessionId) {
224
+ return this.get(`/channel/status/${sessionId}`);
225
+ }
226
+ /**
227
+ * Settle and close a payment channel.
228
+ *
229
+ * Closes the channel, calculates unused credit, and initiates
230
+ * a USDC refund to the agent's wallet for any unspent balance.
231
+ *
232
+ * `POST /channel/settle/:sessionId`
233
+ */
234
+ async channelSettle(sessionId) {
235
+ return this.post(`/channel/settle/${sessionId}`, {});
236
+ }
237
+ /**
238
+ * Check payment channel service health.
239
+ *
240
+ * `GET /channel/health`
241
+ */
242
+ async channelHealth() {
243
+ return this.get(`/channel/health`);
244
+ }
131
245
  /** Flush any pending telemetry events and clean up resources. */
132
246
  async dispose() {
133
247
  await this.telemetry.dispose();
@@ -321,6 +435,100 @@ class ValironClient {
321
435
  throw new types_1.ValironError(error.message || "Network error", "NETWORK_ERROR");
322
436
  }
323
437
  }
438
+ /**
439
+ * POST with a custom Bearer token (used by channel consume where
440
+ * the session ID is the auth token, not the operator API key).
441
+ */
442
+ async postWithAuth(path, body, bearerToken) {
443
+ const url = new URL(path, this.endpoint);
444
+ if (this.debug) {
445
+ console.log(`[Valiron SDK] POST (auth) ${url.toString()}`, body);
446
+ }
447
+ const controller = new AbortController();
448
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
449
+ const start = Date.now();
450
+ try {
451
+ const headers = {
452
+ "Content-Type": "application/json",
453
+ "Authorization": `Bearer ${bearerToken}`,
454
+ };
455
+ const response = await fetch(url.toString(), {
456
+ method: "POST",
457
+ headers,
458
+ body: JSON.stringify(body),
459
+ signal: controller.signal,
460
+ });
461
+ clearTimeout(timeoutId);
462
+ const durationMs = Date.now() - start;
463
+ const methodName = this.extractMethodName(path);
464
+ if (!response.ok) {
465
+ const respBody = await response
466
+ .json()
467
+ .catch(() => ({ message: response.statusText }));
468
+ this.telemetry.emit("sdk_call", {
469
+ method: methodName,
470
+ chain: "solana",
471
+ duration_ms: durationMs,
472
+ success: false,
473
+ http_status: response.status,
474
+ error_code: "API_ERROR",
475
+ retries: 0,
476
+ timeout_count: 0,
477
+ abort_count: 0,
478
+ });
479
+ this.telemetry.recordLatency(methodName, "solana", durationMs);
480
+ throw new types_1.ValironError(respBody.error || respBody.message || `Request failed: ${response.statusText}`, "API_ERROR", response.status);
481
+ }
482
+ const data = await response.json();
483
+ this.telemetry.emit("sdk_call", {
484
+ method: methodName,
485
+ chain: "solana",
486
+ duration_ms: durationMs,
487
+ success: true,
488
+ http_status: response.status,
489
+ retries: 0,
490
+ timeout_count: 0,
491
+ abort_count: 0,
492
+ });
493
+ this.telemetry.recordLatency(methodName, "solana", durationMs);
494
+ if (this.debug)
495
+ console.log(`[Valiron SDK] Response:`, data);
496
+ return data;
497
+ }
498
+ catch (error) {
499
+ clearTimeout(timeoutId);
500
+ const durationMs = Date.now() - start;
501
+ const methodName = this.extractMethodName(path);
502
+ if (error.name === "AbortError") {
503
+ this.telemetry.emit("sdk_call", {
504
+ method: methodName,
505
+ chain: "solana",
506
+ duration_ms: durationMs,
507
+ success: false,
508
+ error_code: "TIMEOUT_ERROR",
509
+ retries: 0,
510
+ timeout_count: 1,
511
+ abort_count: 1,
512
+ });
513
+ this.telemetry.recordLatency(methodName, "solana", durationMs);
514
+ throw new types_1.ValironError(`Request timeout after ${this.timeout}ms`, "TIMEOUT_ERROR");
515
+ }
516
+ if (error instanceof types_1.ValironError)
517
+ throw error;
518
+ this.telemetry.emit("sdk_call", {
519
+ method: methodName,
520
+ chain: "solana",
521
+ duration_ms: durationMs,
522
+ success: false,
523
+ error_code: "NETWORK_ERROR",
524
+ retries: 0,
525
+ timeout_count: 0,
526
+ abort_count: 0,
527
+ });
528
+ this.telemetry.recordLatency(methodName, "solana", durationMs);
529
+ throw new types_1.ValironError(error.message || "Network error", "NETWORK_ERROR");
530
+ }
531
+ }
324
532
  extractMethodName(path) {
325
533
  if (path.startsWith("/operator/agent/"))
326
534
  return "getAgentProfile";
@@ -332,6 +540,26 @@ class ValironClient {
332
540
  return "triggerSandboxTest";
333
541
  if (path.startsWith("/operator/gate/"))
334
542
  return "gate";
543
+ if (path.startsWith("/operator/world-id/verify/"))
544
+ return "verifyWorldId";
545
+ if (path.startsWith("/operator/world-id/status/"))
546
+ return "getWorldIdStatus";
547
+ if (path.startsWith("/operator/world-id/profile/"))
548
+ return "getWorldIdProfile";
549
+ if (path.startsWith("/operator/key/"))
550
+ return "keyAgent";
551
+ if (path.startsWith("/channel/preflight/"))
552
+ return "channelPreflight";
553
+ if (path.startsWith("/channel/open/"))
554
+ return "channelOpen";
555
+ if (path.startsWith("/channel/consume/"))
556
+ return "channelConsume";
557
+ if (path.startsWith("/channel/status/"))
558
+ return "channelStatus";
559
+ if (path.startsWith("/channel/settle/"))
560
+ return "channelSettle";
561
+ if (path === "/channel/health")
562
+ return "channelHealth";
335
563
  return "unknown";
336
564
  }
337
565
  }
@@ -0,0 +1,80 @@
1
+ export interface AgentKeypair {
2
+ /** Raw Ed25519 private key (base64-encoded) */
3
+ privateKey: string;
4
+ /** Raw Ed25519 public key (base64-encoded) */
5
+ publicKey: string;
6
+ /** SHA-256 hash of the public key — the agent's portable identifier */
7
+ agentKeyHash: string;
8
+ }
9
+ export interface ChallengeResponse {
10
+ /** The challenge nonce that was signed */
11
+ challenge: string;
12
+ /** Base64-encoded signature of the challenge */
13
+ signature: string;
14
+ /** The agent's public key (base64-encoded) — needed for first-contact verification */
15
+ publicKey: string;
16
+ /** The agent's key hash (SHA-256 of public key) */
17
+ agentKeyHash: string;
18
+ }
19
+ /**
20
+ * Generate an Ed25519 keypair for an agent.
21
+ *
22
+ * The SHA-256 hash of the public key becomes the agent's
23
+ * stable, portable identifier — no registration needed.
24
+ *
25
+ * @returns The keypair and derived agent key hash
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { generateAgentKeypair } from '@valiron/sdk';
30
+ *
31
+ * const keypair = generateAgentKeypair();
32
+ * console.log(keypair.agentKeyHash); // "a3f8c1d2e5..."
33
+ *
34
+ * // Store privateKey securely (env var, file, KMS)
35
+ * // Use agentKeyHash as the agent's identity
36
+ * ```
37
+ */
38
+ export declare function generateAgentKeypair(): AgentKeypair;
39
+ /**
40
+ * Derive the agent key hash from a base64-encoded public key.
41
+ *
42
+ * @param publicKeyB64 - Base64-encoded Ed25519 public key (SPKI DER format)
43
+ * @returns SHA-256 hex hash of the public key
44
+ */
45
+ export declare function deriveKeyHash(publicKeyB64: string): string;
46
+ /**
47
+ * Generate a random challenge nonce for identity verification.
48
+ *
49
+ * @returns A 32-byte hex-encoded nonce
50
+ */
51
+ export declare function generateChallenge(): string;
52
+ /**
53
+ * Sign a challenge with the agent's private key.
54
+ * Used to prove the agent controls the keypair.
55
+ *
56
+ * @param challenge - The challenge nonce to sign
57
+ * @param privateKeyB64 - Base64-encoded Ed25519 private key (PKCS8 DER format)
58
+ * @param publicKeyB64 - Base64-encoded Ed25519 public key (SPKI DER format)
59
+ * @returns The challenge response containing signature + identity info
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * import { signChallenge } from '@valiron/sdk';
64
+ *
65
+ * // Agent receives a challenge from Valiron middleware
66
+ * const response = signChallenge(challenge, keypair.privateKey, keypair.publicKey);
67
+ * // Send response back to prove identity
68
+ * ```
69
+ */
70
+ export declare function signChallenge(challenge: string, privateKeyB64: string, publicKeyB64: string): ChallengeResponse;
71
+ /**
72
+ * Verify a challenge-response signature.
73
+ * Confirms the agent controls the private key corresponding to the public key.
74
+ *
75
+ * @param challenge - The original challenge nonce
76
+ * @param signatureB64 - Base64-encoded signature
77
+ * @param publicKeyB64 - Base64-encoded Ed25519 public key
78
+ * @returns true if the signature is valid
79
+ */
80
+ export declare function verifyChallenge(challenge: string, signatureB64: string, publicKeyB64: string): boolean;