Authenticate users with their Web3 accounts instead of relying on custodial OAuth providers. Users sign a standard message with any Web3-compatible wallet, keeping full control of their identity and data.
Sign-In with Web3 uses a standard message format compliant with CAIP-74, parameterized by scope, session details, and security mechanisms (e.g., a nonce).
- Ethereum — EIP-4361 with EIP-1271/6492 smart contract signature support
- Solana — SIP-99 with ed25519 signature verification
npm install @web3auth/sign-in-with-web3Strategies are not auto-registered. Register the chains you need before using SIWWeb3:
import { SIWWeb3, ethereumStrategy, solanaStrategy } from "@web3auth/sign-in-with-web3";
SIWWeb3.registerStrategy(ethereumStrategy);
SIWWeb3.registerStrategy(solanaStrategy);// Parse a signed message string (chain is detected automatically)
const msg = new SIWWeb3(messageString);
// Or construct from fields (chain is required)
const msg = new SIWWeb3({
chain: "ethereum", // or "solana"
payload: {
domain: "example.com",
address: "0x...",
statement: "Sign in with Ethereum to the app.",
uri: "https://example.com",
version: "1",
chainId: 1,
nonce: "32891757",
issuedAt: new Date().toISOString(),
},
});
// Generate the EIP-4361 message to sign
const messageToSign = msg.prepareMessage();
// Verify a signature
const { success, error } = await msg.verify(msg.payload, signature);import { SIWE, SIWS } from "@web3auth/sign-in-with-web3";
const ethMsg = new SIWE({ header, payload, signature });
const solMsg = new SIWS(messageString);import { SIWWeb3 } from "@web3auth/sign-in-with-web3";
SIWWeb3.registerStrategy({
chain: "mychain",
parse: (msg) => new MyChainSIW(msg),
create: (params) => new MyChainSIW(params),
});src/
client.ts — SIWWeb3 (main entry, strategy registry)
strategies/
base.ts — SIWBase (abstract base class)
ethereum.ts — SIWE + EIP-1271/6492 verifier
solana.ts — SIWS + ed25519 verifier
regex.ts — Shared message parsing
types.ts — Shared types
| Export | Description |
|---|---|
SIWWeb3 |
Main class with chain auto-detection and strategy registry |
SIWBase |
Abstract base class for building custom chain strategies |
SIWE |
Ethereum sign-in (EIP-4361) |
SIWS |
Solana sign-in (SIP-99) |
ethereumStrategy |
Ethereum strategy for registry |
solanaStrategy |
Solana strategy for registry |
eipVerifyMessage |
EIP-1271/6492 signature verification utility |
These packages have been deprecated and consolidated into this package.
- import { SIWEthereum } from "@web3auth/sign-in-with-ethereum";
- import { SIWS } from "@web3auth/sign-in-with-solana";
+ import { SIWWeb3, ethereumStrategy, solanaStrategy, SIWE, SIWS } from "@web3auth/sign-in-with-web3";
+ SIWWeb3.registerStrategy(ethereumStrategy);
+ SIWWeb3.registerStrategy(solanaStrategy);Key changes from previous versions:
SIWEthereumhas been renamed toSIWEnetworkproperty has been renamed tochainchainis now required when constructing from an object- Strategies must be registered manually (no longer auto-registered)