Solana Wallet Auth: A FullStack example

Overview

Solana Wallet Auth: A FullStack example

This example uses Solana's wallet adapter to sign messages and verifies their signatures on the backend, allowing for a lean way to authenticate users without the need for web2 credentials like email/password combinations or social providers, in this scenario all you have to do is connect your wallet and sign interaction messages to be properly authenticated.

How to run

Backend

cd wallet-backend
yarn && yarn dev

Frontend

cd wallet-frontend
yarn && yarn dev

Technology stack for this example

Most of the technologies used in this example are production ready, however, be sure to check them and remember to switch LowDB for a proper database.

Backend

  • NodeJS, Express, Typescript, LowDB (Local JSON file, only for testing), TweetNaCL.
  • GraphQL example coming soon.

Frontend

  • React, Typescript, Vite, Solana-Wallet-Adapter, Tailwind.

Notes

Validation on the backend happens using the library tweetnacl, but some additional checks were added, like action and message expiration.

The files you want to check are:

  • @wallet-backend/src/middleware/web3Auth.ts
  • @wallet-frontend/src/lib/api/web3Posts.ts

Where web3Auth.ts defines a simple, yet powerful authorization middleware that extracts the authorization headers and validates, then parses the message to perform some additional checks and the web3Posts.ts axios client exemplifies a good set of UX patterns, like reusing a token for "skip" requests (Requests that skip action checks).

Here's a diagram of how simplified is this authentication method

arch

Reference read

You might also like...
Lightweight auth library based on oidc-client for React single page applications (SPA). Support for hooks and higher-order components (HOC).

Lightweight auth library based on oidc-client for React single page applications (SPA). Support for hooks and higher-order components (HOC).

Auth model created by Using nodeJs for backend & reactJs for frontend with the help of TailwindCss in styling
Auth model created by Using nodeJs for backend & reactJs for frontend with the help of TailwindCss in styling

The Universal Auth System Using The MERN Stack Including Mysql -- The project is divded to two separte projects 1- The Client side - containing the

This is used for minting NFTs and getting metadata , token owner, wallet address assigned to an NFT, just check it out and enjoy

nft-minter A Heroku web server to easily mint non-fungible tokens via an API Example Configuration: Blockchain: Ethereum Testnet: Rinkeby Contract: ER

WYSIWG paper wallet generator
WYSIWG paper wallet generator

Hello Wallet Try it. Have you ever wanted to make a paper wallet but they all look like this? Using the latest graphic design technology it is possibl

The Fullstack Tutorial for GraphQL
The Fullstack Tutorial for GraphQL

How to GraphQL is a fullstack tutorial website to learn all about GraphQL! It was built by Prisma and many amazing contributors. All content on the site is completely free and open-source.

Youtube Tutorial showcasing how to create a fullstack NFT mingint dapp.
Youtube Tutorial showcasing how to create a fullstack NFT mingint dapp.

Emoji Faces NFT Minting dApp This a complete example of fullstack NFT minting dApp. EmojiFaces is built with the purpose of providing an entry point f

An example using universal client/server routing and data in React with AWS DynamoDB

react-server-routing-example A simple (no compile) example of how to do universal server/browser rendering, routing and data fetching with React and A

An example of a Kanban Project Board with Ionic React
An example of a Kanban Project Board with Ionic React

An example of a Kanban Project Board with Ionic React

A plugin example for writing reactions with the Figma plugin API
A plugin example for writing reactions with the Figma plugin API

🍜 figma-plugin-example-prototype-write The ability to write protoype interactions in the Figma plugin API has landed! This update allows plugins to c

Owner
Kevin Rodríguez
"We fear singularity the same way early man used to fear the night"
Kevin Rodríguez
Auth Service sample source. It supports Solana and EVM-compatiable chains

This repository is Auth Service sample source. It supports Solana and EVM-compatiable chains, more chains and more features coming soon! Learn more visit Particle Network.

Particle Network 7 Aug 20, 2022
Shows how to use phan-wallet-mock to test wallet functionality of a react app with Cypress.

Cypress Starter Kit A no-nonsense Cypress template for copying into new or existing projects, with some sensible defaults and useful helper functions.

Thorsten Lorenz 5 Dec 5, 2022
a offcial wallet provider for DexMask wallet

wallet-provider a offcial wallet provider for DexMask wallet Useage install connector package yarn add dex-wallet-connector use connector in compon

null 1 Nov 22, 2021
⛵️ A React library for Solana account management and transaction processing.

sail ⛵️ A React library for Solana account management and transaction handling. Usage import { SailProvider } from "@saberhq/sail";

Saber 77 Dec 30, 2022
Code examples for the blog post titled The Complete Guide to Full Stack Solana Development with React, Anchor, Rust, and Phantom

The Complete Guide to Full Stack Solana Development with React, Anchor, Rust, and Phantom Code examples to go with the blog post available here Prereq

Nader Dabit 436 Dec 31, 2022
A simple Solana program to vote for your favorite type of peanut butter. Built with Anchor and React.

Cruchy vs Smooth V2 A simple Solana program to vote for your favorite type of peanut butter. Built with Anchor and React. This is a follow up to a pre

Brian Friel 45 Oct 12, 2022
_buildspace - web3 Read/Write Solana Blockchain Project

_buildspace - web3 Read/Write Solana Blockchain Project

Benny 2 Aug 28, 2022
Gif Portal build using solana, anchor, web3 and react

Features of the dapp View Popular Dance Moves Gifs Vote for your favorite Gifs Add link of your favorite dance gif on the portal All the data includin

Anshul Goel 5 Oct 27, 2022
A web application that allows you to create and share wall of gifs! Built on top of solana blockchain.

Wall of gif with Solana A web application that allows you to create and share wall of gifs! Built on top of solana blockchain. Installation and Usage

Sunrit Jana 4 Jan 1, 2022
This is a proof of concept of an NFT vending machine built using Solana Pay, Metaplex, Phantom Mobile, and Next.js

Solana NFT Vending Machine This is a proof of concept of an NFT vending machine built using Solana Pay, Metaplex, Phantom Mobile, and Next.js. This wa

Matt Rosenzweig 55 Dec 15, 2022