-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Set up the auth module to support wallet-based authentication. Users should log in by signing a message with their wallet (MetaMask, WalletConnect, etc.), and the backend will verify the signature. A JWT will be returned to maintain the session.
Tasks:
Install ethers.js (or viem) for signature verification.
Create AuthController with endpoints:
POST /auth/request-message → returns nonce for signature.
POST /auth/verify → verifies signed message, returns JWT.
Store nonces temporarily in Redis to prevent replay attacks.
Configure JWT strategy in NestJS (Passport + JWT).
Protect routes using AuthGuard.
Acceptance Criteria:
✅ Users can log in by signing a message.
✅ Server verifies ownership of wallet address.
✅ JWT is issued and used to access protected routes.
Attach a sample request to the test on pr submit