Authentication on ethereum.world

Authentication on ethereum.world

By Marius Darila

·

February 28, 2020

The release of ethereum.world v0.1 will include a lot of improvements in terms of UX when compared with the current beta.akasha.world application. This will be possible because of specialized web services that handle complex tasks which previously were executed only on the client-side (e.g. search indexing).

Some of these services will require user authentication. One example would be a service that stores the user's preferences on a database which is synchronized afterwards on all the devices used to access ethereum.world.

For v0.1 of ethereum.world all the visitors will be able to authenticate using only their Ethereum key without having the need to go through the process of registration or having to remember a username/password combination.

The way it works:

  • the user's Ethereum key is used to create a signature from an authentication message;
// signer https://docs.ethers.io/ethers.js/html/api-wallet.html#signer-api
// the message can be something like
// 'authenticate on ethereum.world on 2020/02/29'
 const sig = signer.signMessage(AUTH_MESSAGE)
  • the signature sig is sent afterwards to a web service which validates it and generates a JWT
  • the JWT is used to store claims, for v0.1 of ethereum.world we're using the standard claims
  • the web service uses also an Ethereum key to sign the JWT and is saved as the Issuer in the standard claims list
{
 Issuer: "0x0A93720048a3E25cD72346bD802DeF4Dc7316b5" // ewa.akasha.eth
 Subject: "0x0A93720048a3E25cD72346bD802DeF4Dc7316b2" // user's public eth address
 Audience: "ethereum.world"
...
}
  • the user receives a token that can be used for 24h to authenticate on all web services that ethereum.world uses, this must be specified in the bearer authorization format on the request header , e.g.: Authorization: Bearer eyJhbGciOiJFUzI1.eyJzaWciOiI.-CYOci_mOfR

Keep in the loop.

Subscribe to our newsletter.