@exodus/siwx
v1.0.0
Published
SIWX (Sign In with X) enables blockchain wallet-based authentication across multiple chains using a standardized signed message format.
Readme
@exodus/siwx
SIWX (Sign In with X) enables blockchain wallet-based authentication using a standardized signed message format.
Note: This feature currently only supports Solana. Additional networks may be added in the future.
Install
yarn add @exodus/siwxUsage
This feature is designed to be used together with @exodus/headless. See using the sdk.
API Side
See using the sdk for more details on how features plug into the SDK.
const result = await exodus.siwx.signIn({
serverConfig: {
baseUrl: 'https://api.example.com',
requestNonce: async ({ address, assetName }) => {
// Request a nonce and SIWX message from your server
const response = await fetch('https://api.example.com/auth/nonce', {
method: 'POST',
body: JSON.stringify({ address, assetName }),
})
return response.json() // { nonce: string, message: string }
},
requestVerify: async ({ message, signature, address, assetName }) => {
// Send signed message to your server for verification
const response = await fetch('https://api.example.com/auth/verify', {
method: 'POST',
body: JSON.stringify({ message, signature, address, assetName }),
})
return response.json() // Your server's response (e.g., JWT token)
},
},
assetName: 'solana', // or 'solanadevnet', 'solanatestnet'
walletAccountName: 'exodus_0', // optional, defaults to 'exodus_0'
})How It Works
- The client requests a nonce and SIWX message from the server
- The module validates the server's message (domain, address, chainId, nonce)
- The user signs the message with their wallet
- The signed message is sent to the server for verification
- The server verifies the signature and returns an authentication token
Supported Assets
| Asset Name | Network | CAIP-2 Chain ID | | ------------- | ------- | --------------------------------------- | | solana | Mainnet | solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp | | solanadevnet | Devnet | solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 | | solanatestnet | Testnet | solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z |
