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
isValidSignatureverification (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§
- Eip191
Verifier - EIP-191
personal_signverifier. - Eip1271
Verifier - 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
SiwxMessageinto the EIP-4361 signing string. - validate_
address - Validate that
addressis a well-formed 0x-prefixed, 40-hex-char Ethereum address.