Skip to main content

Module wallet_auth

Module wallet_auth 

Source
Expand description

Authentication middleware for ChainStream API.

Supports three modes:

  • API Key: X-API-KEY header (via ApiKeyAuthMiddleware)
  • Wallet signature: X-Wallet-* headers for x402 (via WalletAuthMiddleware)
  • Bearer token: Authorization: Bearer header (via BearerAuthMiddleware in tests)

Structs§

ApiKeyAuthMiddleware
Middleware for reqwest that adds X-API-KEY header.
SiwxAuthMiddleware
Middleware for reqwest that adds Authorization: SIWX header. Uses SIWX token (sign once, reuse for 1h) instead of per-request X-Wallet-* headers.
WalletAuthHeaders
Wallet auth headers for HTTP requests.
WalletAuthMiddleware
Legacy middleware for reqwest that adds X-Wallet-* headers (deprecated).

Traits§

WalletSigner
Trait for wallet signers (EVM or Solana).

Functions§

build_sign_message
Build the message that must be signed for wallet auth.
build_siwx_message
Build a SIWX (EIP-4361) message for authentication.
create_wallet_auth_headers
Generate X-Wallet-* headers for a request.