Skip to content

feat(backend): SIWS wallet auth with JWT + Socket.IO middleware - #2

Merged
codebestia merged 10 commits into
mainfrom
feat/orm-setup
May 12, 2026
Merged

feat(backend): SIWS wallet auth with JWT + Socket.IO middleware#2
codebestia merged 10 commits into
mainfrom
feat/orm-setup

Conversation

@codebestia

Copy link
Copy Markdown
Owner

Summary

  • Installed @stellar/stellar-sdk and jsonwebtoken for Stellar signature verification and session tokens
  • POST /auth/challenge — generates a signed message + nonce (5-min TTL) for a given wallet address
  • POST /auth/verify — verifies Stellar keypair signature, upserts user + wallet in DB, returns a JWT
  • src/lib/jwt.ts — typed signToken / verifyToken helpers (7-day expiry)
  • src/lib/nonce.ts — in-memory nonce store with 5-minute expiry and single-use consumption
  • src/middleware/auth.tsrequireAuth Express middleware that reads Authorization: Bearer <token>
  • src/middleware/socketAuth.ts — Socket.IO middleware that reads socket.handshake.auth.token
  • Added GET /me as a protected route example
  • Added JWT_SECRET to .env.example

@codebestia
codebestia merged commit c94a0a8 into main May 12, 2026
1 check failed
codebestia added a commit that referenced this pull request Jun 26, 2026
feat(backend): SIWS wallet auth with JWT + Socket.IO middleware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant