@bankofai/x402-extensions 1.0.0-beta.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.
Files changed (52) hide show
  1. package/README.md +28 -0
  2. package/dist/cjs/bazaar/index.d.ts +4 -0
  3. package/dist/cjs/bazaar/index.js +1048 -0
  4. package/dist/cjs/bazaar/index.js.map +1 -0
  5. package/dist/cjs/builder-code/index.d.ts +225 -0
  6. package/dist/cjs/builder-code/index.js +369 -0
  7. package/dist/cjs/builder-code/index.js.map +1 -0
  8. package/dist/cjs/index-B8S563vv.d.ts +929 -0
  9. package/dist/cjs/index-BUV9B9f8.d.ts +929 -0
  10. package/dist/cjs/index.d.ts +373 -0
  11. package/dist/cjs/index.js +3536 -0
  12. package/dist/cjs/index.js.map +1 -0
  13. package/dist/cjs/offer-receipt/index.d.ts +702 -0
  14. package/dist/cjs/offer-receipt/index.js +909 -0
  15. package/dist/cjs/offer-receipt/index.js.map +1 -0
  16. package/dist/cjs/payment-identifier/index.d.ts +345 -0
  17. package/dist/cjs/payment-identifier/index.js +285 -0
  18. package/dist/cjs/payment-identifier/index.js.map +1 -0
  19. package/dist/cjs/sign-in-with-x/index.d.ts +1117 -0
  20. package/dist/cjs/sign-in-with-x/index.js +876 -0
  21. package/dist/cjs/sign-in-with-x/index.js.map +1 -0
  22. package/dist/esm/bazaar/index.d.mts +4 -0
  23. package/dist/esm/bazaar/index.mjs +51 -0
  24. package/dist/esm/bazaar/index.mjs.map +1 -0
  25. package/dist/esm/builder-code/index.d.mts +225 -0
  26. package/dist/esm/builder-code/index.mjs +27 -0
  27. package/dist/esm/builder-code/index.mjs.map +1 -0
  28. package/dist/esm/chunk-4IPDE3NS.mjs +990 -0
  29. package/dist/esm/chunk-4IPDE3NS.mjs.map +1 -0
  30. package/dist/esm/chunk-N74HQTNO.mjs +807 -0
  31. package/dist/esm/chunk-N74HQTNO.mjs.map +1 -0
  32. package/dist/esm/chunk-OWZP4CUR.mjs +333 -0
  33. package/dist/esm/chunk-OWZP4CUR.mjs.map +1 -0
  34. package/dist/esm/chunk-RERA4OZZ.mjs +233 -0
  35. package/dist/esm/chunk-RERA4OZZ.mjs.map +1 -0
  36. package/dist/esm/chunk-TIVMC3ZS.mjs +828 -0
  37. package/dist/esm/chunk-TIVMC3ZS.mjs.map +1 -0
  38. package/dist/esm/index-B8S563vv.d.mts +929 -0
  39. package/dist/esm/index-BUV9B9f8.d.mts +929 -0
  40. package/dist/esm/index.d.mts +373 -0
  41. package/dist/esm/index.mjs +455 -0
  42. package/dist/esm/index.mjs.map +1 -0
  43. package/dist/esm/offer-receipt/index.d.mts +702 -0
  44. package/dist/esm/offer-receipt/index.mjs +97 -0
  45. package/dist/esm/offer-receipt/index.mjs.map +1 -0
  46. package/dist/esm/payment-identifier/index.d.mts +345 -0
  47. package/dist/esm/payment-identifier/index.mjs +39 -0
  48. package/dist/esm/payment-identifier/index.mjs.map +1 -0
  49. package/dist/esm/sign-in-with-x/index.d.mts +1117 -0
  50. package/dist/esm/sign-in-with-x/index.mjs +73 -0
  51. package/dist/esm/sign-in-with-x/index.mjs.map +1 -0
  52. package/package.json +124 -0
@@ -0,0 +1,1117 @@
1
+ import { z } from 'zod';
2
+ import { ResourceServerExtension } from '@bankofai/x402-core/types';
3
+ import { ClientExtension } from '@bankofai/x402-core/client';
4
+
5
+ /**
6
+ * Type definitions for the Sign-In-With-X (SIWX) extension
7
+ *
8
+ * Implements CAIP-122 standard for chain-agnostic wallet-based identity assertions.
9
+ * Per x402 v2 spec: typescript/site/CHANGELOG-v2.md lines 237-341
10
+ */
11
+
12
+ /**
13
+ * Extension identifier constant
14
+ */
15
+ declare const SIGN_IN_WITH_X = "sign-in-with-x";
16
+ /**
17
+ * Supported signature schemes per CHANGELOG-v2.md line 271.
18
+ *
19
+ * NOTE: This is primarily informational. Actual signature verification
20
+ * is determined by the chainId prefix, not this field:
21
+ * - `eip155:*` chains use EVM verification (handles eip191, eip712, eip1271, eip6492 automatically)
22
+ * - `solana:*` chains use Ed25519 verification (siws)
23
+ *
24
+ * The signatureScheme field serves as a hint for clients to select
25
+ * the appropriate signing UX.
26
+ */
27
+ type SignatureScheme = "eip191" | "eip1271" | "eip6492" | "siws";
28
+ /** Signature algorithm type per CAIP-122 */
29
+ type SignatureType = "eip191" | "ed25519";
30
+ /**
31
+ * Supported chain configuration in supportedChains array.
32
+ * Specifies which chains the server accepts for authentication.
33
+ */
34
+ interface SupportedChain {
35
+ /** CAIP-2 chain identifier (e.g., "eip155:8453", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp") */
36
+ chainId: string;
37
+ /** Signature algorithm type per CAIP-122 */
38
+ type: SignatureType;
39
+ /** Optional signature scheme hint (informational) */
40
+ signatureScheme?: SignatureScheme;
41
+ }
42
+ /**
43
+ * Server-declared extension info included in PaymentRequired.extensions.
44
+ * Contains message metadata shared across all supported chains.
45
+ * Per CHANGELOG-v2.md lines 263-272
46
+ */
47
+ interface SIWxExtensionInfo {
48
+ /** Server's domain */
49
+ domain: string;
50
+ /** Full resource URI */
51
+ uri: string;
52
+ /** Human-readable purpose for signing */
53
+ statement?: string;
54
+ /** CAIP-122 version, always "1" */
55
+ version: string;
56
+ /** Cryptographic nonce (SDK auto-generates) */
57
+ nonce: string;
58
+ /** ISO 8601 timestamp (SDK auto-generates) */
59
+ issuedAt: string;
60
+ /** Optional expiry (default: +5 min) */
61
+ expirationTime?: string;
62
+ /** Optional validity start */
63
+ notBefore?: string;
64
+ /** Optional correlation ID */
65
+ requestId?: string;
66
+ /** Associated resources */
67
+ resources?: string[];
68
+ }
69
+ /**
70
+ * JSON Schema for SIWX extension validation
71
+ * Per CHANGELOG-v2.md lines 276-292
72
+ */
73
+ interface SIWxExtensionSchema {
74
+ $schema: string;
75
+ type: "object";
76
+ properties: {
77
+ domain: {
78
+ type: "string";
79
+ };
80
+ address: {
81
+ type: "string";
82
+ };
83
+ statement?: {
84
+ type: "string";
85
+ };
86
+ uri: {
87
+ type: "string";
88
+ format: "uri";
89
+ };
90
+ version: {
91
+ type: "string";
92
+ };
93
+ chainId: {
94
+ type: "string";
95
+ };
96
+ type: {
97
+ type: "string";
98
+ };
99
+ nonce: {
100
+ type: "string";
101
+ };
102
+ issuedAt: {
103
+ type: "string";
104
+ format: "date-time";
105
+ };
106
+ expirationTime?: {
107
+ type: "string";
108
+ format: "date-time";
109
+ };
110
+ notBefore?: {
111
+ type: "string";
112
+ format: "date-time";
113
+ };
114
+ requestId?: {
115
+ type: "string";
116
+ };
117
+ resources?: {
118
+ type: "array";
119
+ items: {
120
+ type: "string";
121
+ format: "uri";
122
+ };
123
+ };
124
+ signature: {
125
+ type: "string";
126
+ };
127
+ };
128
+ required: string[];
129
+ }
130
+ /**
131
+ * Complete SIWX extension structure (info + supportedChains + schema).
132
+ * Follows standard x402 v2 extension pattern with multi-chain support.
133
+ */
134
+ interface SIWxExtension {
135
+ info: SIWxExtensionInfo;
136
+ supportedChains: SupportedChain[];
137
+ schema: SIWxExtensionSchema;
138
+ }
139
+ /**
140
+ * Zod schema for SIWX payload validation
141
+ * Client proof payload sent in SIGN-IN-WITH-X header
142
+ * Per CHANGELOG-v2.md lines 301-315
143
+ */
144
+ declare const SIWxPayloadSchema: z.ZodObject<{
145
+ domain: z.ZodString;
146
+ address: z.ZodString;
147
+ statement: z.ZodOptional<z.ZodString>;
148
+ uri: z.ZodString;
149
+ version: z.ZodString;
150
+ chainId: z.ZodString;
151
+ type: z.ZodEnum<["eip191", "ed25519"]>;
152
+ nonce: z.ZodString;
153
+ issuedAt: z.ZodString;
154
+ expirationTime: z.ZodOptional<z.ZodString>;
155
+ notBefore: z.ZodOptional<z.ZodString>;
156
+ requestId: z.ZodOptional<z.ZodString>;
157
+ resources: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
158
+ signatureScheme: z.ZodOptional<z.ZodEnum<["eip191", "eip1271", "eip6492", "siws"]>>;
159
+ signature: z.ZodString;
160
+ }, "strip", z.ZodTypeAny, {
161
+ type: "eip191" | "ed25519";
162
+ uri: string;
163
+ domain: string;
164
+ address: string;
165
+ version: string;
166
+ chainId: string;
167
+ nonce: string;
168
+ issuedAt: string;
169
+ signature: string;
170
+ statement?: string | undefined;
171
+ expirationTime?: string | undefined;
172
+ notBefore?: string | undefined;
173
+ requestId?: string | undefined;
174
+ resources?: string[] | undefined;
175
+ signatureScheme?: "eip191" | "eip1271" | "eip6492" | "siws" | undefined;
176
+ }, {
177
+ type: "eip191" | "ed25519";
178
+ uri: string;
179
+ domain: string;
180
+ address: string;
181
+ version: string;
182
+ chainId: string;
183
+ nonce: string;
184
+ issuedAt: string;
185
+ signature: string;
186
+ statement?: string | undefined;
187
+ expirationTime?: string | undefined;
188
+ notBefore?: string | undefined;
189
+ requestId?: string | undefined;
190
+ resources?: string[] | undefined;
191
+ signatureScheme?: "eip191" | "eip1271" | "eip6492" | "siws" | undefined;
192
+ }>;
193
+ /**
194
+ * Client proof payload type (inferred from zod schema)
195
+ */
196
+ type SIWxPayload = z.infer<typeof SIWxPayloadSchema>;
197
+ /**
198
+ * Options for declaring SIWX extension on server.
199
+ *
200
+ * Most fields are optional and derived automatically from request context:
201
+ * - `domain`: Parsed from resourceUri or request URL
202
+ * - `resourceUri`: From request URL
203
+ * - `network`: From payment requirements (accepts[].network)
204
+ *
205
+ * Explicit values override automatic derivation.
206
+ */
207
+ interface DeclareSIWxOptions {
208
+ /** Server's domain. If omitted, derived from resourceUri or request URL. */
209
+ domain?: string;
210
+ /** Full resource URI. If omitted, derived from request URL. */
211
+ resourceUri?: string;
212
+ /** Human-readable purpose */
213
+ statement?: string;
214
+ /** CAIP-122 version (default: "1") */
215
+ version?: string;
216
+ /**
217
+ * Network(s) to support. If omitted, derived from payment requirements.
218
+ * - Single chain: "eip155:8453" or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
219
+ * - Multi-chain: ["eip155:8453", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"]
220
+ */
221
+ network?: string | string[];
222
+ /**
223
+ * Optional expiration duration in seconds.
224
+ * - Number (e.g., 300): Signature expires after this many seconds
225
+ * - undefined: Infinite expiration (no expirationTime field in wire format)
226
+ */
227
+ expirationSeconds?: number;
228
+ }
229
+ /**
230
+ * Validation result from validateSIWxMessage
231
+ */
232
+ interface SIWxValidationResult {
233
+ valid: boolean;
234
+ error?: string;
235
+ }
236
+ /**
237
+ * Options for message validation
238
+ */
239
+ interface SIWxValidationOptions {
240
+ /** Maximum age for issuedAt in milliseconds (default: 5 minutes) */
241
+ maxAge?: number;
242
+ /** Custom nonce validation function */
243
+ checkNonce?: (nonce: string) => boolean | Promise<boolean>;
244
+ }
245
+ /**
246
+ * Result from signature verification
247
+ */
248
+ interface SIWxVerifyResult {
249
+ valid: boolean;
250
+ /** Recovered/verified address (checksummed) */
251
+ address?: string;
252
+ error?: string;
253
+ }
254
+ /**
255
+ * EVM message verifier function type.
256
+ * Compatible with viem's publicClient.verifyMessage().
257
+ *
258
+ * When provided to verifySIWxSignature, enables:
259
+ * - EIP-1271 (deployed smart contract wallets)
260
+ * - EIP-6492 (counterfactual/pre-deploy smart wallets)
261
+ *
262
+ * Without a verifier, only EOA signatures (EIP-191) can be verified.
263
+ *
264
+ * @example
265
+ * ```typescript
266
+ * import { createPublicClient, http } from 'viem';
267
+ * import { base } from 'viem/chains';
268
+ *
269
+ * const publicClient = createPublicClient({ chain: base, transport: http() });
270
+ * // publicClient.verifyMessage satisfies EVMMessageVerifier
271
+ * ```
272
+ */
273
+ type EVMMessageVerifier = (args: {
274
+ address: `0x${string}`;
275
+ message: string;
276
+ signature: `0x${string}`;
277
+ }) => Promise<boolean>;
278
+ /**
279
+ * Options for SIWX signature verification
280
+ */
281
+ interface SIWxVerifyOptions {
282
+ /**
283
+ * EVM message verifier for smart wallet support.
284
+ *
285
+ * Pass `publicClient.verifyMessage` from viem to enable verification of:
286
+ * - Smart contract wallets (EIP-1271)
287
+ * - Counterfactual/undeployed smart wallets (EIP-6492)
288
+ *
289
+ * If not provided, only EOA signatures are verified using standalone
290
+ * ECDSA recovery (no RPC calls required).
291
+ */
292
+ evmVerifier?: EVMMessageVerifier;
293
+ }
294
+
295
+ /**
296
+ * Message signing for SIWX extension
297
+ *
298
+ * Client-side helpers for signing SIWX messages.
299
+ * Supports both EVM (viem) and Solana wallet adapters.
300
+ */
301
+ /**
302
+ * Signer interface for EVM SIWX message signing.
303
+ * Compatible with viem WalletClient and PrivateKeyAccount.
304
+ */
305
+ interface EVMSigner {
306
+ /** Sign a message and return hex-encoded signature */
307
+ signMessage: (args: {
308
+ message: string;
309
+ account?: unknown;
310
+ }) => Promise<string>;
311
+ /** Account object (for WalletClient) */
312
+ account?: {
313
+ address: string;
314
+ };
315
+ /** Direct address (for PrivateKeyAccount) */
316
+ address?: string;
317
+ }
318
+ /**
319
+ * Wallet adapter style Solana signer.
320
+ * Compatible with @solana/wallet-adapter, Phantom/Solflare wallet APIs.
321
+ */
322
+ interface WalletAdapterSigner {
323
+ /** Sign a message and return raw signature bytes */
324
+ signMessage: (message: Uint8Array) => Promise<Uint8Array>;
325
+ /** Solana public key (Base58 encoded string or PublicKey-like object) */
326
+ publicKey: string | {
327
+ toBase58: () => string;
328
+ };
329
+ }
330
+ /**
331
+ * Solana Kit KeyPairSigner style.
332
+ * Compatible with createKeyPairSignerFromBytes and generateKeyPairSigner from @solana/kit.
333
+ */
334
+ type SolanaKitSigner = {
335
+ /** Solana address (Base58 encoded string) */
336
+ address: string;
337
+ /** Sign messages - accepts messages with content and signatures */
338
+ signMessages: (messages: Array<{
339
+ content: Uint8Array;
340
+ signatures: Record<string, unknown>;
341
+ }>) => Promise<Array<Record<string, Uint8Array>>>;
342
+ };
343
+ /**
344
+ * Union type for Solana signers - supports both wallet adapter and @solana/kit.
345
+ */
346
+ type SolanaSigner = WalletAdapterSigner | SolanaKitSigner;
347
+ /**
348
+ * Union type for SIWX signers - supports both EVM and Solana wallets.
349
+ */
350
+ type SIWxSigner = EVMSigner | SolanaSigner;
351
+ /**
352
+ * Get address from an EVM signer.
353
+ *
354
+ * @param signer - EVM wallet signer instance
355
+ * @returns The wallet address as a hex string
356
+ */
357
+ declare function getEVMAddress(signer: EVMSigner): string;
358
+ /**
359
+ * Get address from a Solana signer.
360
+ * Supports both wallet adapter (publicKey) and @solana/kit (address) interfaces.
361
+ *
362
+ * @param signer - Solana wallet signer instance
363
+ * @returns The wallet address as a Base58 string
364
+ */
365
+ declare function getSolanaAddress(signer: SolanaSigner): string;
366
+ /**
367
+ * Sign a message with an EVM wallet.
368
+ * Returns hex-encoded signature.
369
+ *
370
+ * @param message - The message to sign
371
+ * @param signer - EVM wallet signer instance
372
+ * @returns Hex-encoded signature
373
+ */
374
+ declare function signEVMMessage(message: string, signer: EVMSigner): Promise<string>;
375
+ /**
376
+ * Sign a message with a Solana wallet.
377
+ * Returns Base58-encoded signature.
378
+ * Supports both wallet adapter (signMessage) and @solana/kit (signMessages) interfaces.
379
+ *
380
+ * @param message - The message to sign
381
+ * @param signer - Solana wallet signer instance
382
+ * @returns Base58-encoded signature
383
+ */
384
+ declare function signSolanaMessage(message: string, signer: SolanaSigner): Promise<string>;
385
+
386
+ /**
387
+ * Complete client flow for SIWX extension
388
+ *
389
+ * Combines message construction, signing, and payload creation.
390
+ * Supports both EVM and Solana wallets.
391
+ */
392
+
393
+ /**
394
+ * Complete SIWX info with chain-specific fields.
395
+ * Used by utility functions that need the selected chain information.
396
+ */
397
+ type CompleteSIWxInfo = SIWxExtensionInfo & {
398
+ chainId: string;
399
+ type: SignatureType;
400
+ signatureScheme?: SignatureScheme;
401
+ };
402
+ /**
403
+ * Create a complete SIWX payload from server extension info with selected chain.
404
+ *
405
+ * Routes to EVM or Solana signing based on the chainId prefix:
406
+ * - `eip155:*` → EVM signing
407
+ * - `solana:*` → Solana signing
408
+ *
409
+ * @param serverExtension - Server extension info with chain selected (includes chainId, type)
410
+ * @param signer - Wallet that can sign messages (EVMSigner or SolanaSigner)
411
+ * @returns Complete SIWX payload with signature
412
+ *
413
+ * @example
414
+ * ```typescript
415
+ * // EVM wallet
416
+ * const completeInfo = { ...extension.info, chainId: "eip155:8453", type: "eip191" };
417
+ * const payload = await createSIWxPayload(completeInfo, evmWallet);
418
+ * ```
419
+ */
420
+ declare function createSIWxPayload(serverExtension: CompleteSIWxInfo, signer: SIWxSigner): Promise<SIWxPayload>;
421
+
422
+ /**
423
+ * Solana Sign-In-With-X (SIWS) support
424
+ *
425
+ * Implements CAIP-122 compliant message format and Ed25519 signature verification
426
+ * for Solana wallets.
427
+ */
428
+
429
+ /**
430
+ * Common Solana network CAIP-2 identifiers.
431
+ * Uses genesis hash as the chain reference per CAIP-30.
432
+ */
433
+ declare const SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
434
+ declare const SOLANA_DEVNET = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
435
+ declare const SOLANA_TESTNET = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
436
+ /**
437
+ * Extract chain reference from CAIP-2 Solana chainId.
438
+ *
439
+ * @param chainId - CAIP-2 format chain ID (e.g., "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")
440
+ * @returns Chain reference (genesis hash)
441
+ *
442
+ * @example
443
+ * ```typescript
444
+ * extractSolanaChainReference("solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp") // "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
445
+ * ```
446
+ */
447
+ declare function extractSolanaChainReference(chainId: string): string;
448
+ /**
449
+ * Format SIWS message following CAIP-122 ABNF specification.
450
+ *
451
+ * The message format is identical to SIWE (EIP-4361) but uses "Solana account"
452
+ * instead of "Ethereum account" in the header line.
453
+ *
454
+ * @param info - Server-provided extension info
455
+ * @param address - Client's Solana wallet address (Base58 encoded public key)
456
+ * @returns Message string ready for signing
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * const message = formatSIWSMessage(serverInfo, "BSmWDgE9ex6dZYbiTsJGcwMEgFp8q4aWh92hdErQPeVW");
461
+ * // Returns:
462
+ * // "api.example.com wants you to sign in with your Solana account:
463
+ * // BSmWDgE9ex6dZYbiTsJGcwMEgFp8q4aWh92hdErQPeVW
464
+ * //
465
+ * // Sign in to access your content
466
+ * //
467
+ * // URI: https://api.example.com/data
468
+ * // Version: 1
469
+ * // Chain ID: mainnet
470
+ * // Nonce: abc123
471
+ * // Issued At: 2024-01-01T00:00:00.000Z"
472
+ * ```
473
+ */
474
+ declare function formatSIWSMessage(info: CompleteSIWxInfo, address: string): string;
475
+ /**
476
+ * Verify Ed25519 signature for SIWS.
477
+ *
478
+ * @param message - The SIWS message that was signed
479
+ * @param signature - Ed25519 signature bytes
480
+ * @param publicKey - Solana public key bytes (32 bytes)
481
+ * @returns true if signature is valid
482
+ *
483
+ * @example
484
+ * ```typescript
485
+ * const messageBytes = new TextEncoder().encode(message);
486
+ * const valid = verifySolanaSignature(message, signatureBytes, publicKeyBytes);
487
+ * ```
488
+ */
489
+ declare function verifySolanaSignature(message: string, signature: Uint8Array, publicKey: Uint8Array): boolean;
490
+ /**
491
+ * Decode Base58 string to bytes.
492
+ *
493
+ * Solana uses Base58 encoding (Bitcoin alphabet) for addresses and signatures.
494
+ *
495
+ * @param encoded - Base58 encoded string
496
+ * @returns Decoded bytes
497
+ * @throws Error if string contains invalid Base58 characters
498
+ *
499
+ * @example
500
+ * ```typescript
501
+ * const publicKeyBytes = decodeBase58("BSmWDgE9ex6dZYbiTsJGcwMEgFp8q4aWh92hdErQPeVW");
502
+ * // Returns Uint8Array of 32 bytes
503
+ * ```
504
+ */
505
+ declare function decodeBase58(encoded: string): Uint8Array;
506
+ /**
507
+ * Encode bytes to Base58 string.
508
+ *
509
+ * @param bytes - Bytes to encode
510
+ * @returns Base58 encoded string
511
+ */
512
+ declare function encodeBase58(bytes: Uint8Array): string;
513
+ /**
514
+ * Detect if a signer is Solana-compatible.
515
+ * Checks for Solana-specific properties that don't exist on EVM signers.
516
+ *
517
+ * @param signer - The signer to check
518
+ * @returns true if the signer is a Solana signer
519
+ */
520
+ declare function isSolanaSigner(signer: SIWxSigner): boolean;
521
+
522
+ /**
523
+ * Server-side declaration helper for SIWX extension
524
+ *
525
+ * Helps servers declare SIWX authentication requirements in PaymentRequired responses.
526
+ */
527
+
528
+ /**
529
+ * Internal type for SIWX declaration with stored options.
530
+ * The _options field is used by enrichPaymentRequiredResponse to derive
531
+ * values from request context.
532
+ */
533
+ interface SIWxDeclaration extends SIWxExtension {
534
+ _options: DeclareSIWxOptions;
535
+ }
536
+ /**
537
+ * Create SIWX extension declaration for PaymentRequired.extensions
538
+ *
539
+ * Most fields are derived automatically from request context when using
540
+ * createSIWxResourceServerExtension:
541
+ * - `network`: From payment requirements (accepts[].network)
542
+ * - `resourceUri`: From request URL
543
+ * - `domain`: Parsed from resourceUri
544
+ *
545
+ * Explicit values in options override automatic derivation.
546
+ *
547
+ * @param options - Configuration options (most are optional)
548
+ * @returns Extension object ready for PaymentRequired.extensions
549
+ *
550
+ * @example
551
+ * ```typescript
552
+ * // Minimal - derives network, domain, resourceUri from context
553
+ * const extensions = declareSIWxExtension({
554
+ * statement: 'Sign in to access your purchased content',
555
+ * });
556
+ *
557
+ * // With explicit network (overrides accepts)
558
+ * const extensions = declareSIWxExtension({
559
+ * network: 'eip155:8453',
560
+ * statement: 'Sign in to access',
561
+ * });
562
+ *
563
+ * // Full explicit config (no derivation)
564
+ * const extensions = declareSIWxExtension({
565
+ * domain: 'api.example.com',
566
+ * resourceUri: 'https://api.example.com/data',
567
+ * network: ['eip155:8453', 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'],
568
+ * statement: 'Sign in to access',
569
+ * expirationSeconds: 300,
570
+ * });
571
+ * ```
572
+ */
573
+ declare function declareSIWxExtension(options?: DeclareSIWxOptions): Record<string, SIWxDeclaration>;
574
+
575
+ /**
576
+ * Storage interface for SIWX payment tracking.
577
+ *
578
+ * Implementations track which addresses have paid for which resources,
579
+ * enabling SIWX authentication to grant access without re-payment.
580
+ *
581
+ * Optionally supports nonce tracking to prevent signature replay attacks.
582
+ */
583
+ interface SIWxStorage {
584
+ /**
585
+ * Check if an address has paid for a resource.
586
+ *
587
+ * @param resource - The resource path (e.g., "/weather")
588
+ * @param address - The wallet address to check
589
+ * @returns True if the address has paid for the resource
590
+ */
591
+ hasPaid(resource: string, address: string): boolean | Promise<boolean>;
592
+ /**
593
+ * Record that an address has paid for a resource.
594
+ *
595
+ * @param resource - The resource path
596
+ * @param address - The wallet address that paid
597
+ */
598
+ recordPayment(resource: string, address: string): void | Promise<void>;
599
+ /**
600
+ * Check if a nonce has already been used (optional).
601
+ *
602
+ * Implementing this method prevents signature replay attacks where
603
+ * an intercepted SIWX header could be reused by an attacker.
604
+ *
605
+ * @param nonce - The nonce from the SIWX payload
606
+ * @returns True if the nonce has been used
607
+ */
608
+ hasUsedNonce?(nonce: string): boolean | Promise<boolean>;
609
+ /**
610
+ * Record that a nonce has been used (optional).
611
+ *
612
+ * Called after successfully granting access via SIWX.
613
+ * Implementations should consider adding expiration to avoid unbounded growth.
614
+ *
615
+ * @param nonce - The nonce to record as used
616
+ */
617
+ recordNonce?(nonce: string): void | Promise<void>;
618
+ }
619
+ /**
620
+ * In-memory implementation of SIWxStorage.
621
+ *
622
+ * Suitable for development and single-instance deployments.
623
+ * For production multi-instance deployments, use a persistent storage implementation.
624
+ */
625
+ declare class InMemorySIWxStorage implements SIWxStorage {
626
+ private paidAddresses;
627
+ /**
628
+ * Check if an address has paid for a resource.
629
+ *
630
+ * @param resource - The resource path
631
+ * @param address - The wallet address to check
632
+ * @returns True if the address has paid
633
+ */
634
+ hasPaid(resource: string, address: string): boolean;
635
+ /**
636
+ * Record that an address has paid for a resource.
637
+ *
638
+ * @param resource - The resource path
639
+ * @param address - The wallet address that paid
640
+ */
641
+ recordPayment(resource: string, address: string): void;
642
+ }
643
+
644
+ /**
645
+ * SIWX Lifecycle Hooks
646
+ *
647
+ * Pre-built hooks for integrating SIWX authentication with x402 servers and clients.
648
+ */
649
+
650
+ /**
651
+ * Options for creating server-side SIWX hooks.
652
+ */
653
+ interface CreateSIWxHookOptions {
654
+ /** Storage for tracking paid addresses */
655
+ storage: SIWxStorage;
656
+ /** Options for signature verification (e.g., EVM smart wallet support) */
657
+ verifyOptions?: SIWxVerifyOptions;
658
+ /** Optional callback for logging/debugging */
659
+ onEvent?: (event: SIWxHookEvent) => void;
660
+ }
661
+ /**
662
+ * Options for creating the SIWX client extension.
663
+ */
664
+ interface CreateSIWxClientExtensionOptions {
665
+ /** Wallet signers to try against the server's supported SIWX chains */
666
+ signers: SIWxSigner[];
667
+ }
668
+ /**
669
+ * Events emitted by SIWX hooks for logging/debugging.
670
+ */
671
+ type SIWxHookEvent = {
672
+ type: "payment_recorded";
673
+ resource: string;
674
+ address: string;
675
+ } | {
676
+ type: "access_granted";
677
+ resource: string;
678
+ address: string;
679
+ } | {
680
+ type: "validation_failed";
681
+ resource: string;
682
+ error?: string;
683
+ } | {
684
+ type: "nonce_reused";
685
+ resource: string;
686
+ nonce: string;
687
+ } | {
688
+ type: "siwx_header_sent";
689
+ resource: string;
690
+ };
691
+ /**
692
+ * Creates an onAfterSettle hook that records payments for SIWX.
693
+ *
694
+ * @param options - Hook configuration
695
+ * @returns Hook function for x402ResourceServer.onAfterSettle()
696
+ *
697
+ * @example
698
+ * ```typescript
699
+ * const storage = new InMemorySIWxStorage();
700
+ * const resourceServer = new x402ResourceServer(facilitator)
701
+ * .onAfterSettle(createSIWxSettleHook({ storage }));
702
+ * ```
703
+ */
704
+ declare function createSIWxSettleHook(options: CreateSIWxHookOptions): (ctx: {
705
+ paymentPayload: {
706
+ payload: unknown;
707
+ resource?: {
708
+ url: string;
709
+ };
710
+ };
711
+ result: {
712
+ success: boolean;
713
+ payer?: string;
714
+ };
715
+ }) => Promise<void>;
716
+ /**
717
+ * Creates an onProtectedRequest hook that validates SIWX auth.
718
+ *
719
+ * For paid routes: grants access when the SIWX signature is valid and the address has paid.
720
+ * For auth-only routes (accepts: []): grants access on valid SIWX signature alone.
721
+ * Auth-only detection uses the routeConfig passed by x402HTTPResourceServer.
722
+ *
723
+ * @param options - Hook configuration
724
+ * @returns Hook function for x402HTTPResourceServer.onProtectedRequest()
725
+ *
726
+ * @example
727
+ * ```typescript
728
+ * const storage = new InMemorySIWxStorage();
729
+ * const httpServer = new x402HTTPResourceServer(resourceServer, routes)
730
+ * .onProtectedRequest(createSIWxRequestHook({ storage }));
731
+ * ```
732
+ */
733
+ declare function createSIWxRequestHook(options: CreateSIWxHookOptions): (context: {
734
+ adapter: {
735
+ getHeader(name: string): string | undefined;
736
+ getUrl(): string;
737
+ };
738
+ path: string;
739
+ }, routeConfig?: {
740
+ accepts?: unknown;
741
+ }) => Promise<void | {
742
+ grantAccess: true;
743
+ }>;
744
+ /**
745
+ * Creates an onPaymentRequired hook for client-side SIWX authentication.
746
+ *
747
+ * Matches the signer type to a compatible chain in supportedChains.
748
+ * For EVM signers: matches any eip191 chain
749
+ * For Solana signers: matches any ed25519 chain
750
+ *
751
+ * @param signer - Wallet signer for creating SIWX proofs
752
+ * @returns Hook function for x402HTTPClient.onPaymentRequired()
753
+ *
754
+ * @example
755
+ * ```typescript
756
+ * const httpClient = new x402HTTPClient(client)
757
+ * .onPaymentRequired(createSIWxClientHook(signer));
758
+ * ```
759
+ */
760
+ declare function createSIWxClientHook(signer: SIWxSigner): (context: {
761
+ paymentRequired: {
762
+ accepts?: Array<{
763
+ network: string;
764
+ }>;
765
+ extensions?: Record<string, unknown>;
766
+ };
767
+ }) => Promise<{
768
+ headers: Record<string, string>;
769
+ } | void>;
770
+ /**
771
+ * Creates a SIWX client extension that signs HTTP SIWX challenges for compatible wallets.
772
+ *
773
+ * @param options - Client extension configuration (signers tried in order until one succeeds)
774
+ * @returns x402 client extension registering HTTP transport hooks for SIWX
775
+ */
776
+ declare function createSIWxClientExtension(options: CreateSIWxClientExtensionOptions): ClientExtension;
777
+
778
+ /**
779
+ * Server-side ResourceServerExtension factory for SIWX.
780
+ *
781
+ * The extension enriches PaymentRequired responses with fresh SIWX challenges,
782
+ * records successful settlements, and validates HTTP SIWX proofs for routes
783
+ * that declare the sign-in-with-x extension.
784
+ */
785
+
786
+ /**
787
+ * Options for creating the SIWX resource server extension.
788
+ *
789
+ * Includes storage for paid wallet tracking, optional signature verification
790
+ * settings, and an optional event callback.
791
+ */
792
+ type CreateSIWxResourceServerExtensionOptions = CreateSIWxHookOptions;
793
+ /**
794
+ * Creates a SIWX server extension that publishes challenges, records payments,
795
+ * and validates HTTP SIWX proofs for declared routes.
796
+ *
797
+ * @param options - Storage, verification, and event callback configuration
798
+ * @returns Resource server extension for registration with x402ResourceServer
799
+ *
800
+ * @example
801
+ * ```typescript
802
+ * const storage = new InMemorySIWxStorage();
803
+ * const resourceServer = new x402ResourceServer(facilitator)
804
+ * .registerExtension(createSIWxResourceServerExtension({ storage }));
805
+ * ```
806
+ */
807
+ declare function createSIWxResourceServerExtension(options: CreateSIWxResourceServerExtensionOptions): ResourceServerExtension;
808
+
809
+ /**
810
+ * Header parsing for SIWX extension
811
+ *
812
+ * Parses the SIGN-IN-WITH-X header from client requests.
813
+ * Requires base64-encoded JSON per x402 v2 spec.
814
+ */
815
+
816
+ /**
817
+ * Parse SIGN-IN-WITH-X header into structured payload.
818
+ *
819
+ * Expects base64-encoded JSON per x402 v2 spec (CHANGELOG-v2.md line 335).
820
+ *
821
+ * @param header - The SIGN-IN-WITH-X header value (base64-encoded JSON)
822
+ * @returns Parsed SIWX payload
823
+ * @throws Error if header is invalid or missing required fields
824
+ *
825
+ * @example
826
+ * ```typescript
827
+ * const header = request.headers.get('SIGN-IN-WITH-X');
828
+ * if (header) {
829
+ * const payload = parseSIWxHeader(header);
830
+ * // payload.address, payload.signature, etc.
831
+ * }
832
+ * ```
833
+ */
834
+ declare function parseSIWxHeader(header: string): SIWxPayload;
835
+
836
+ /**
837
+ * Message validation for SIWX extension
838
+ *
839
+ * Validates SIWX payload fields before cryptographic verification.
840
+ * Per CHANGELOG-v2.md validation rules (lines 318-329).
841
+ */
842
+
843
+ /**
844
+ * Validate SIWX message fields.
845
+ *
846
+ * Performs validation per spec (CHANGELOG-v2.md lines 318-329):
847
+ * - Domain binding: domain MUST match server's domain
848
+ * - URI validation: uri must refer to base url of resource
849
+ * - Temporal validation:
850
+ * - issuedAt MUST be recent (< 5 minutes by default)
851
+ * - expirationTime MUST be in the future
852
+ * - notBefore (if present) MUST be in the past
853
+ * - Nonce: MUST be unique (via optional checkNonce callback)
854
+ *
855
+ * @param message - The SIWX payload to validate
856
+ * @param expectedResourceUri - Expected resource URI (for domain/URI matching)
857
+ * @param options - Validation options
858
+ * @returns Validation result
859
+ *
860
+ * @example
861
+ * ```typescript
862
+ * const payload = parseSIWxHeader(header);
863
+ * const result = await validateSIWxMessage(
864
+ * payload,
865
+ * 'https://api.example.com/data',
866
+ * { checkNonce: (n) => !usedNonces.has(n) }
867
+ * );
868
+ *
869
+ * if (!result.valid) {
870
+ * return { error: result.error };
871
+ * }
872
+ * ```
873
+ */
874
+ declare function validateSIWxMessage(message: SIWxPayload, expectedResourceUri: string, options?: SIWxValidationOptions): Promise<SIWxValidationResult>;
875
+
876
+ /**
877
+ * Signature verification for SIWX extension
878
+ *
879
+ * Routes to chain-specific verification based on chainId namespace:
880
+ * - EVM (eip155:*): EOA by default, smart wallet (EIP-1271/EIP-6492) with verifier
881
+ * - Solana (solana:*): Ed25519 signature verification via tweetnacl
882
+ */
883
+
884
+ /**
885
+ * Verify SIWX signature cryptographically.
886
+ *
887
+ * Routes to the appropriate chain-specific verification based on the
888
+ * chainId namespace prefix:
889
+ * - `eip155:*` → EVM verification (EOA by default, smart wallet with verifier)
890
+ * - `solana:*` → Ed25519 signature verification
891
+ *
892
+ * @param payload - The SIWX payload containing signature
893
+ * @param options - Optional verification options
894
+ * @returns Verification result with recovered address if valid
895
+ *
896
+ * @example
897
+ * ```typescript
898
+ * // EOA-only verification (default)
899
+ * const result = await verifySIWxSignature(payload);
900
+ *
901
+ * // Smart wallet verification
902
+ * import { createPublicClient, http } from 'viem';
903
+ * import { base } from 'viem/chains';
904
+ *
905
+ * const publicClient = createPublicClient({ chain: base, transport: http() });
906
+ * const result = await verifySIWxSignature(payload, {
907
+ * evmVerifier: publicClient.verifyMessage,
908
+ * });
909
+ *
910
+ * if (result.valid) {
911
+ * console.log('Verified wallet:', result.address);
912
+ * } else {
913
+ * console.error('Verification failed:', result.error);
914
+ * }
915
+ * ```
916
+ */
917
+ declare function verifySIWxSignature(payload: SIWxPayload, options?: SIWxVerifyOptions): Promise<SIWxVerifyResult>;
918
+
919
+ /**
920
+ * JSON Schema builder for SIWX extension
921
+ *
922
+ * Per CHANGELOG-v2.md lines 276-292
923
+ */
924
+
925
+ /**
926
+ * Build JSON Schema for SIWX extension validation.
927
+ * This schema validates the client proof payload structure.
928
+ *
929
+ * @returns JSON Schema for validating SIWX client payloads
930
+ */
931
+ declare function buildSIWxSchema(): SIWxExtensionSchema;
932
+
933
+ /**
934
+ * CAIP-122 message construction for SIWX extension
935
+ *
936
+ * Constructs the canonical message string for signing.
937
+ * Routes to chain-specific formatters based on chainId namespace.
938
+ */
939
+
940
+ /**
941
+ * Construct CAIP-122 compliant message string for signing.
942
+ *
943
+ * Routes to the appropriate chain-specific message formatter based on the
944
+ * chainId namespace prefix:
945
+ * - `eip155:*` → SIWE (EIP-4361) format via siwe library
946
+ * - `solana:*` → SIWS format
947
+ *
948
+ * @param serverInfo - Server extension info with chain selected (includes chainId)
949
+ * @param address - Client wallet address
950
+ * @returns Message string ready for signing
951
+ * @throws Error if chainId namespace is not supported
952
+ *
953
+ * @example
954
+ * ```typescript
955
+ * // EVM (Ethereum, Base, etc.)
956
+ * const completeInfo = { ...extension.info, chainId: "eip155:8453", type: "eip191" };
957
+ * const evmMessage = createSIWxMessage(completeInfo, "0x1234...");
958
+ * ```
959
+ */
960
+ declare function createSIWxMessage(serverInfo: CompleteSIWxInfo, address: string): string;
961
+
962
+ /**
963
+ * Header encoding for SIWX extension
964
+ *
965
+ * Encodes SIWX payload for the SIGN-IN-WITH-X HTTP header.
966
+ * Per CHANGELOG-v2.md line 335: header should be base64-encoded.
967
+ */
968
+
969
+ /**
970
+ * Encode SIWX payload for SIGN-IN-WITH-X header.
971
+ *
972
+ * Uses base64 encoding per x402 v2 spec (CHANGELOG-v2.md line 335).
973
+ *
974
+ * @param payload - Complete SIWX payload with signature
975
+ * @returns Base64-encoded JSON string
976
+ *
977
+ * @example
978
+ * ```typescript
979
+ * const payload = await createSIWxPayload(serverInfo, signer);
980
+ * const header = encodeSIWxHeader(payload);
981
+ *
982
+ * fetch(url, {
983
+ * headers: { 'SIGN-IN-WITH-X': header }
984
+ * });
985
+ * ```
986
+ */
987
+ declare function encodeSIWxHeader(payload: SIWxPayload): string;
988
+
989
+ /**
990
+ * Fetch wrapper for SIWX authentication.
991
+ *
992
+ * Provides a convenient wrapper around fetch that automatically handles
993
+ * SIWX authentication when a 402 response includes SIWX extension info.
994
+ */
995
+
996
+ /**
997
+ * Wraps fetch to automatically handle SIWX authentication.
998
+ *
999
+ * When a 402 response is received with a SIWX extension:
1000
+ * 1. Extracts SIWX info from PAYMENT-REQUIRED header
1001
+ * 2. Creates signed SIWX proof using the provided signer
1002
+ * 3. Retries the request with the SIWX header
1003
+ *
1004
+ * If the 402 response doesn't include SIWX extension info, the original
1005
+ * response is returned unchanged (allowing payment handling to proceed).
1006
+ *
1007
+ * @param fetch - The fetch function to wrap (typically globalThis.fetch)
1008
+ * @param signer - Wallet signer (EVMSigner or SolanaSigner)
1009
+ * @returns A wrapped fetch function that handles SIWX authentication
1010
+ *
1011
+ * @example
1012
+ * ```typescript
1013
+ * import { wrapFetchWithSIWx } from '@bankofai/x402-extensions/sign-in-with-x';
1014
+ * import { privateKeyToAccount } from 'viem/accounts';
1015
+ *
1016
+ * const signer = privateKeyToAccount(privateKey);
1017
+ * const fetchWithSIWx = wrapFetchWithSIWx(fetch, signer);
1018
+ *
1019
+ * // Request that may require SIWX auth (for returning paid users)
1020
+ * const response = await fetchWithSIWx('https://api.example.com/data');
1021
+ * ```
1022
+ */
1023
+ declare function wrapFetchWithSIWx(fetch: typeof globalThis.fetch, signer: SIWxSigner): (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
1024
+
1025
+ /**
1026
+ * EVM Sign-In-With-Ethereum (SIWE) support
1027
+ *
1028
+ * Implements EIP-4361 compliant message format and signature verification
1029
+ * for EVM chains (Ethereum, Base, Polygon, etc.)
1030
+ */
1031
+
1032
+ /**
1033
+ * Extract numeric chain ID from CAIP-2 EVM chainId.
1034
+ *
1035
+ * @param chainId - CAIP-2 format chain ID (e.g., "eip155:8453")
1036
+ * @returns Numeric chain ID (e.g., 8453)
1037
+ * @throws Error if chainId format is invalid
1038
+ *
1039
+ * @example
1040
+ * ```typescript
1041
+ * extractEVMChainId("eip155:1") // 1 (Ethereum mainnet)
1042
+ * extractEVMChainId("eip155:8453") // 8453 (Base)
1043
+ * extractEVMChainId("eip155:137") // 137 (Polygon)
1044
+ * ```
1045
+ */
1046
+ declare function extractEVMChainId(chainId: string): number;
1047
+ /**
1048
+ * Format SIWE message following EIP-4361 specification.
1049
+ *
1050
+ * Uses the siwe library to ensure message format matches verification.
1051
+ *
1052
+ * @param info - Server-provided extension info
1053
+ * @param address - Client's EVM wallet address (0x-prefixed)
1054
+ * @returns Message string ready for signing
1055
+ *
1056
+ * @example
1057
+ * ```typescript
1058
+ * const message = formatSIWEMessage(serverInfo, "0x1234...abcd");
1059
+ * // Returns EIP-4361 formatted message:
1060
+ * // "api.example.com wants you to sign in with your Ethereum account:
1061
+ * // 0x1234...abcd
1062
+ * //
1063
+ * // Sign in to access your content
1064
+ * //
1065
+ * // URI: https://api.example.com/data
1066
+ * // Version: 1
1067
+ * // Chain ID: 8453
1068
+ * // Nonce: abc123
1069
+ * // Issued At: 2024-01-01T00:00:00.000Z"
1070
+ * ```
1071
+ */
1072
+ declare function formatSIWEMessage(info: CompleteSIWxInfo, address: string): string;
1073
+ /**
1074
+ * Verify EVM signature.
1075
+ *
1076
+ * Supports:
1077
+ * - EOA signatures (standard ECDSA via EIP-191) - always available
1078
+ * - EIP-1271 (deployed smart contract wallets) - requires verifier
1079
+ * - EIP-6492 (counterfactual/pre-deploy smart wallets) - requires verifier
1080
+ *
1081
+ * @param message - The SIWE message that was signed
1082
+ * @param address - The claimed signer address
1083
+ * @param signature - The signature to verify
1084
+ * @param verifier - Optional message verifier for smart wallet support.
1085
+ * Pass publicClient.verifyMessage for EIP-1271/EIP-6492 support.
1086
+ * Without this, only EOA signatures are verified.
1087
+ * @returns true if signature is valid
1088
+ *
1089
+ * @example
1090
+ * ```typescript
1091
+ * // EOA-only verification (default, no RPC required)
1092
+ * const valid = await verifyEVMSignature(message, address, signature);
1093
+ *
1094
+ * // Smart wallet verification with viem PublicClient
1095
+ * import { createPublicClient, http } from 'viem';
1096
+ * import { base } from 'viem/chains';
1097
+ *
1098
+ * const publicClient = createPublicClient({ chain: base, transport: http() });
1099
+ * const valid = await verifyEVMSignature(
1100
+ * message,
1101
+ * address,
1102
+ * signature,
1103
+ * publicClient.verifyMessage
1104
+ * );
1105
+ * ```
1106
+ */
1107
+ declare function verifyEVMSignature(message: string, address: string, signature: string, verifier?: EVMMessageVerifier): Promise<boolean>;
1108
+ /**
1109
+ * Detect if a signer is EVM-compatible.
1110
+ * Checks for EVM-specific properties.
1111
+ *
1112
+ * @param signer - The signer to check
1113
+ * @returns true if the signer is an EVM signer
1114
+ */
1115
+ declare function isEVMSigner(signer: SIWxSigner): boolean;
1116
+
1117
+ export { type CompleteSIWxInfo, type CreateSIWxClientExtensionOptions, type CreateSIWxHookOptions, type CreateSIWxResourceServerExtensionOptions, type DeclareSIWxOptions, type EVMMessageVerifier, type EVMSigner, InMemorySIWxStorage, SIGN_IN_WITH_X, type SIWxExtension, type SIWxExtensionInfo, type SIWxExtensionSchema, type SIWxHookEvent, type SIWxPayload, SIWxPayloadSchema, type SIWxSigner, type SIWxStorage, type SIWxValidationOptions, type SIWxValidationResult, type SIWxVerifyOptions, type SIWxVerifyResult, SOLANA_DEVNET, SOLANA_MAINNET, SOLANA_TESTNET, type SignatureScheme, type SignatureType, type SolanaSigner, type SupportedChain, buildSIWxSchema, createSIWxClientExtension, createSIWxClientHook, createSIWxMessage, createSIWxPayload, createSIWxRequestHook, createSIWxResourceServerExtension, createSIWxSettleHook, declareSIWxExtension, decodeBase58, encodeBase58, encodeSIWxHeader, extractEVMChainId, extractSolanaChainReference, formatSIWEMessage, formatSIWSMessage, getEVMAddress, getSolanaAddress, isEVMSigner, isSolanaSigner, parseSIWxHeader, signEVMMessage, signSolanaMessage, validateSIWxMessage, verifyEVMSignature, verifySIWxSignature, verifySolanaSignature, wrapFetchWithSIWx };