aboutsummaryrefslogtreecommitdiffhomepage
path: root/pkgs/server/src/routes/auth.ts
AgeCommit message (Collapse)Author
2025-12-04refactor(auth): introduce repository pattern for database accessnsfisis
Add repository types and implementations to abstract database operations, improving testability and separation of concerns. The auth routes now use dependency injection with UserRepository and RefreshTokenRepository interfaces, making tests simpler by mocking interfaces instead of Drizzle query builders. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04feat(auth): add refresh token endpointnsfisis
Implement refresh token functionality for authentication: - Add refresh_tokens table to database schema with user reference - Generate migration for the new table - Login endpoint now returns both access token and refresh token - Add POST /api/auth/refresh endpoint with token rotation - Refresh tokens are hashed (SHA256) before storage for security - Tokens expire after 7 days, access tokens after 15 minutes - Update tests to cover new functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04feat(auth): add login endpoint with JWTnsfisis
Implement POST /api/auth/login endpoint that validates credentials and returns a JWT access token on successful authentication. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04feat(auth): add user registration endpointnsfisis
Implement POST /api/auth/register endpoint with: - Argon2 password hashing - Zod validation for username (1-255 chars) and password (8-255 chars) - Duplicate username check (returns 409 Conflict) - Returns created user with id, username, and createdAt 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>