Sign-In with Ethereum (SIWE) plugin for ElizaOS, enabling secure wallet-based authentication.
- ✅ SIWE message creation and verification
- ✅ Ethereum address validation
- ✅ Configurable verification settings
- ✅ Protected action support
- ✅ Status checking
pnpm add @elizaos-plugins/plugin-siwe
Required settings:
// Domain settings
SIWE_DOMAIN=your.domain.xyz
SIWE_URI=https://your.domain.xyz
SIWE_STATEMENT="Sign in with Ethereum to verify ownership of this address"
SIWE_VERIFICATION_EXPIRY=600000 // 10 minutes in milliseconds
The plugin provides several actions that can be used through text commands:
Creates a Sign-In with Ethereum message for wallet verification.
Example inputs:
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Verifies the signed message to authenticate the wallet owner.
Example inputs:
0x78cfc5e0180e30fd66c48cb0711127e25fb0ab749e53d229c885e15e86b8ed715b6402e0b8de1a1845217d922ea216fcfe13f6c358d6f4e2a2ebe8cd93e7f8f41b
Checks the verification status of an Ethereum address.
Example inputs:
status 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Example of an action that requires prior SIWE verification.
Example inputs:
protected action
A utility function to easily check SIWE verification status and implement allowlists:
import { checkSiweVerification } from "@elizaos-plugins/plugin-siwe";
const ALLOWED_ADDRESSES = [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
];
export const myProtectedHandler: Handler = async (runtime, message) => {
const check = await checkSiweVerification(runtime, message, ALLOWED_ADDRESSES);
if (!check.isValid) {
return {
text: check.error,
success: false
};
}
// User is verified and in allowlist
return {
text: `Protected action executed by ${check.address}`,
success: true
};
};
The utility handles:
- Verification status checking
- Expiration checking and cleanup
- Optional allowlist validation
- Type-safe error handling
# Install dependencies
pnpm install
# Run tests
pnpm test
MIT