{"id":21392468,"url":"https://github.com/0xC0A1/web3-auth","last_synced_at":"2025-07-13T18:31:22.714Z","repository":{"id":98719728,"uuid":"497281636","full_name":"0xC0A1/web3-auth","owner":"0xC0A1","description":"An example on how to use Solana Wallet Adapter as a Web Authentication Method.","archived":true,"fork":false,"pushed_at":"2022-05-31T17:07:18.000Z","size":165,"stargazers_count":29,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T15:17:52.849Z","etag":null,"topics":["adapter","auth","authentication","express","react","solana","tweetnacl-js","typescript","wallet"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xC0A1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-28T10:12:07.000Z","updated_at":"2025-04-09T04:56:19.000Z","dependencies_parsed_at":"2023-05-27T17:45:46.448Z","dependency_job_id":null,"html_url":"https://github.com/0xC0A1/web3-auth","commit_stats":null,"previous_names":["0xc0a1/web3-auth","kevinrodriguez-io/web3-auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0xC0A1/web3-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xC0A1%2Fweb3-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xC0A1%2Fweb3-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xC0A1%2Fweb3-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xC0A1%2Fweb3-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xC0A1","download_url":"https://codeload.github.com/0xC0A1/web3-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xC0A1%2Fweb3-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265186595,"owners_count":23724702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter","auth","authentication","express","react","solana","tweetnacl-js","typescript","wallet"],"created_at":"2024-11-22T13:40:55.194Z","updated_at":"2025-07-13T18:31:22.709Z","avatar_url":"https://github.com/0xC0A1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solana Wallet Auth: A FullStack example\n\nThis example uses Solana's wallet adapter to sign messages and verifies\ntheir signatures on the backend, allowing for a lean way to authenticate\nusers without the need for web2 credentials like email/password combinations\nor social providers, in this scenario all you have to do is connect your wallet\nand sign interaction messages to be properly authenticated.\n\n## How to run\n\nBackend\n\n```bash\ncd wallet-backend\nyarn \u0026\u0026 yarn dev\n```\n\nFrontend\n\n```bash\ncd wallet-frontend\nyarn \u0026\u0026 yarn dev\n```\n\n## Technology stack for this example\n\nMost of the technologies used in this example are production ready,\nhowever, be sure to check them and remember to switch LowDB for a\nproper database.\n\n### Backend\n\n- NodeJS, Express, Typescript, LowDB (Local JSON file, only for testing), TweetNaCL.\n- GraphQL example coming soon.\n\n### Frontend\n\n- React, Typescript, Vite, Solana-Wallet-Adapter, Tailwind.\n\n## Notes\n\nValidation on the backend happens using the library `tweetnacl`,\nbut some additional checks were added, like `action` and `message expiration`.\n\nThe files you want to check are:\n\n- `@wallet-backend/src/middleware/web3Auth.ts`\n- `@wallet-frontend/src/lib/api/web3Posts.ts`\n\nWhere `web3Auth.ts` defines a simple, yet powerful authorization middleware that\nextracts the authorization headers and validates, then parses the message to perform\nsome additional checks and the `web3Posts.ts` axios client exemplifies a good set\nof UX patterns, like reusing a token for `\"skip\"` requests (Requests that skip action checks).\n\n## Here's a diagram of how simplified is this authentication method\n\n![arch](https://user-images.githubusercontent.com/6248571/170860443-52f07799-d3e4-4f5f-a78e-2b09b8dc4d58.png)\n\n## Reference read\n\n- [Solana Wallet Adapter - How can I sign and verify messages?](https://github.com/solana-labs/wallet-adapter/blob/master/FAQ.md#how-can-i-sign-and-verify-messages)\n- [Phantom Wallet - Signing a Message](https://docs.phantom.app/integrating/extension-and-mobile-browser/signing-a-message)\n- [TweetNaCL - Verfiy message signature](https://github.com/dchest/tweetnacl-js/blob/master/README.md#naclsigndetachedverifymessage-signature-publickey)\n- [Improve user authentication with Web3 wallets](https://blog.logrocket.com/improve-user-authentication-web3-wallets/)\n- [Build a Web3 authentication flow with React, Ether.js, and Ceramic](https://blog.logrocket.com/build-web3-authentication-flow-react-ether-js-ceramic/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xC0A1%2Fweb3-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xC0A1%2Fweb3-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xC0A1%2Fweb3-auth/lists"}