Skip to main content

Crate siwx_evm

Crate siwx_evm 

Source
Expand description

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

Implements 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;
use siwx_evm::{Eip191Verifier, CHAIN_NAME};
use siwx::Verifier;

let message = SiwxMessage::new(
    "example.com",
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "https://example.com/login",
    "1",
    "1",
)?;
let text = siwx_evm::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 name for the EIP-155 namespace, used in the CAIP-122 preamble line.
SIG_TYPE_EIP191
CAIP-122 signature type for EIP-191 personal_sign.
SIG_TYPE_EIP1271
CAIP-122 signature type for EIP-1271 contract signatures.

Functions§

format_message
Convenience: format a SiwxMessage into the EIP-4361 signing string.
validate_address
Validate that address is a well-formed 0x-prefixed, 40-hex-char Ethereum address.