Spruce
  • Home
Subscribe
Sign-In with Ethereum

Sign-In with Ethereum - Elixir Library Release

In our continued updates on additional language support to help bolster the adoption of Sign-In with Ethereum, we're happy to announce the alpha release of our Elixir library.

  • Spruce

Spruce

Jan 12, 2022 • 2 min read
Sign-In with Ethereum - Elixir Library Release

In our continued updates on additional language support to help bolster the adoption of Sign-In with Ethereum, we're happy to announce the alpha release of our Elixir library:

GitHub - spruceid/siwe-ex: Sign-In with Ethereum Implementation for Elixir
Sign-In with Ethereum Implementation for Elixir. Contribute to spruceid/siwe-ex development by creating an account on GitHub.
GitHubspruceid

Sign-In with Ethereum can now be found and used as a hex, and be installed in your Elixir project by including it in your list of dependencies in mix.exs:

def deps do
  [
    {:siwe, "~> 0.3"}
  ]
end

This Elixir library was created by leveraging the existing work on our Sign-In with Ethereum Rust library. Our Rust library is called by this library for signature verification and message format validation. The repository has been dual-licensed under Apache-2.0 and MIT, making it as flexible and simple as possible for developers to use in their projects.


Using the Library

To see how this works in iex, clone the repository and run:

$ mix deps.get

Then create two files, message.txt and signature.txt:

./message.txt should contain:

login.xyz wants you to sign in with your Ethereum account:
0xfA151B5453CE69ABf60f0dbdE71F6C9C5868800E

Sign-In With Ethereum Example Statement

URI: https://login.xyz
Version: 1
Chain ID: 1
Nonce: ToTaLLyRanDOM
Issued At: 2021-12-17T00:38:39.834Z

./signature.txt should contain:

0x8d1327a1abbdf172875e5be41706c50fc3bede8af363b67aefbb543d6d082fb76a22057d7cb6d668ceba883f7d70ab7f1dc015b76b51d226af9d610fa20360ad1c

and then run:

$ iex -S mix

Once in iex, you can then run the following in the REPL to see the result:

iex> {:ok, msg} = File.read("./message.txt")
...
iex> {:ok, sig} = File.read("./signature.txt")
...
iex> Siwe.parse_if_valid(String.trim(msg), String.trim(sig))
{:ok, %{
  __struct__: Siwe,
  address: "0xfA151B5453CE69ABf60f0dbdE71F6C9C5868800E",
  chain_id: "1",
  domain: "login.xyz",
  expiration_time: nil,
  issued_at: "2021-12-17T00:38:39.834Z",
  nonce: "ToTaLLyRanDOM",
  not_before: nil,
  request_id: nil,
  resources: [],
  statement: "Sign-In With Ethereum Example Statement",
  uri: "https://login.xyz",
  version: "1"
}}

Any valid Sign-In with Ethereum message and signature pair can be substituted. The functions described below can also be tested with msg, sig, or a value set to the result Siwe.parse_if_valid.


Maturity disclaimer: Our Elixir library for Sign-In with Ethereum has not yet undergone a formal security audit. We welcome continued feedback on the usability, architecture, and security of this implementation.


If you're interested in integrating Sign-In with Ethereum into your dapp, app, or service, we are more than happy to help and provide any support we can. As we continue our work supporting Sign-In with Ethereum, we especially welcome implementers who already have users relying on similar workflows, authors of related EIPs, and wallet vendors who would like to do more to support user-owned identities to join us.

If you are interested in being involved, please join our Discord server:

Sign up for more like this.

Enter your email
Subscribe
Spruce At Graph Hack 2022

Spruce At Graph Hack 2022

Earlier this month, The Graph hosted Graph Hack at the Palace of Fine Arts in San Francisco. Graph Hack was a three-day hackathon, bringing together developers to kickstart the latest dapps and ideas featuring a mix of on and off-chain data via a variety of impactful use-cases.

  • Rocco
Rocco Jun 17, 2022 • 3 min read
Spruce Developer Update #20

Spruce Developer Update #20

At Spruce, we’re letting users control their identity and data across the web. Here’s the latest from our development efforts: Sign-In with EthereumWe have released our streamlined SIWE Core packages across all supported programming languages to have unified handling of message creation, parsing, and verification. Additionally, we released

  • Spruce
Spruce Jun 1, 2022 • 3 min read
Why Sign-In with Ethereum is a Game-Changer Part 2

Why Sign-In with Ethereum is a Game-Changer Part 2

Sign-In with Ethereum opens a path where large corporations can no longer strip a user's ability to access services or spy on their actions. It opens the door for a massive amount of impact in web2 apps and services.

  • Rocco
Rocco May 27, 2022 • 6 min read
Spruce © 2022
Powered by Ghost