Skip to main content

Crate siwx_evm

Crate siwx_evm 

Source
Expand description

§siwx-evm — Ethereum verification for Sign-In with X

Implements the CAIP-122 namespace profile for EIP-155 chains:

  • EIP-191 (personal_sign) — ECDSA recovery-based verification
  • EIP-1271 — smart-contract isValidSignature verification (requires RPC)

§Quick start

use siwx::{SiwxMessage, Verifier};
use siwx_evm::Eip191Verifier;

let message = SiwxMessage::new(
    "example.com",
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "https://example.com/login",
    "1",
    "1",
)?;
let text = Eip191Verifier::format_message(&message);
// let signature_bytes: [u8; 65] = ...; // from wallet
// Eip191Verifier.verify(&message, &signature_bytes).await?;

Structs§

Eip191Verifier
EIP-191 personal_sign verifier.
Eip1271Verifier
EIP-1271 smart-contract signature verifier.
EvmVerifier
Auto-detecting verifier that tries EIP-191 first; if the recovered address does not match message.address, falls back to EIP-1271.

Constants§

CHAIN_NAME
Human-readable chain label embedded in the CAIP-122 preamble.

Functions§

validate_address
Validate that address is a well-formed 0x-prefixed, 40-hex-char Ethereum address.