This is a Fastify plugin that utilises Sign in with Ethereum by allowing to generate new nonce and handles authentication using signatures generated by Metamask. 1. The frontend requests a nonce from the backend server. The nonce must be generated and verified on the backend to protect against replay attacks. 2. The dapp signs the message with user's wallet and saves the signed message locally. 3. An Authentication header is included in every request with the signed message. See more in Readme

Sign In with Ethereum plugin for Fastify showcase

How it's made

This project is a typescript library published to NPM. It can be reused to add authentication using Sign in with Ethereum to Fastify backends. The library includes a plugin that adds a middleware that authenticates every request containing "Authentication" header. The header must contain the signed message in the SIWE format. Every authenticated request will contain a session object that exposes the autheticated user's address for authorization.