πRuby
A Ruby implementation of EIP-4361: Sign In With Ethereum.
Getting started
The Ruby implementation of Sign-In with Ethereum can be found here:
Installation
Dependencies
Additional packages may be required to install the gem:
After installing any required dependencies SIWE can be easily installed with:
Usage
SIWE provides a Message class which implements EIP-4361.
Creating a SIWE Message
Parsing a SIWE Message
To parse from EIP-4361 you have to use Siwe::Message.from_message
Messages can be parsed to and from JSON strings, using Siwe::Message.from_json_string and Siwe::Message.to_json_string respectively:
Verifying and Authenticating a SIWE Message
Verification and authentication is performed via EIP-191, using the address field of the SiweMessage as the expected signer. The validate method checks message structural integrity, signature address validity, and time-based validity attributes.
Serialization of a SIWE Message
Siwe::Message instances can also be serialized as their EIP-4361 string representations via the Siwe::Message.prepare_message method:
Example
Parsing and verifying a Siwe::Message:
Last updated
