One-Click Auth / SIWE
Sign In With Ethereum
AppKit provides a simple solution for integrating with “Sign In With Ethereum” (SIWE), a new form of authentication that enables users to control their digital identity with their Ethereum account. SIWE is a standard also known as EIP-4361.
One-Click Auth
One-Click Auth represents a key advancement within WalletConnect v2, streamlining the user authentication process in AppKit by enabling them to seamlessly connect with a wallet and sign a SIWE message with just one click.
Connecting a wallet, proving control of an address with an off-chain signature, authorizing specific actions. These are the kinds of authorizations that can be encoded as “ReCaps”. ReCaps are permissions for a specific website or dapp that can be compactly encoded as a long string in the message you sign and translated by any wallet into a straight-forward one-sentence summary. WalletConnect uses permissions expressed as ReCaps to enable a One-Click Authentication.
Pre-requisites
For 1-CA + SIWE to function properly, a backend for communication is required. This backend will be used to generate a nonce, verify messages and handle sessions. More info here
This feature is compatible only with EVM blockchains. Therefore, including non-EVM blockchains will result in the internal disabling of the 1-CA + SIWE mechanism.
If you are willing to give support just to EVM blockchains you should disabled Solana support from AppKit by calling ReownAppKitModalNetworks.removeSupportedNetworks('solana');
right before your ReownAppKitModal()
definition.
Configure your SIWEConfig object
Initialize ReownAppKitModal with your siweConfig
Add the siwe configuration in ReownAppKitModal
initialization
SIWEConfig reference
Not configuring siweConfig
object has the same effect as setting false
on siweConfig.enable
parameter.
Exported functions
generateNonce
Simple method to generate a timestamp-based nonce
formatMessage
Creates EIP-4361 message based on input arguments.
verifySignature
Verify a SIWE signature. Internally it calls your backend verification method.
getChainIdFromMessage
Get the chain ID from the SIWE message.
getAddressFromMessage
Get the address from the SIWE message.
Basic usage example
This basic configuration is enough to try the feature out without a backend