<!-- ghit#filepath: ../issues/roadmap/learnault-api/PHASE-1.md --> ## Description Persist email verification, password reset, refresh sessions, and login attempts securely. ## File Location `learnault-api/prisma/schema.prisma`, migration, and `learnault-api/src/domain/auth/` ## Design Reference API Roadmap Phase 1: Add Auth Token and Session Persistence Models. ## Dependencies - **Status:** Blocked - **Blocked by:** #65 (Introduce Typed Status Enums and Transition Guards) — done; #124 (Add Auditable Data Lifecycle and Archive Policy) - **Blocks:** #77 (Implement Email Verification and Resend API) — done; #78 (Implement Password Recovery and Reset API) — done; #130 (Implement Refresh Rotation and Logout API); #131 (Expose Session and Device Management API) ## Tasks - [ ] Add hashed verification/reset token records with purpose, expiry, use, and revocation - [ ] Add refresh session with token family, device metadata, expiry, last use, and revocation - [ ] Add safe login-attempt records - [ ] Add lookup/cleanup indexes and retention rules - [ ] Generate cryptographically random raw tokens returned only once - [ ] Test hashing, expiry, uniqueness, cleanup, and migration ## Acceptance Criteria - Only token hashes are persisted - Purpose, expiry, one-time use, and revocation are enforceable - Sessions are queryable without exposing tokens - Indexes support lookup/cleanup - Tests pass ## Verification Evidence - [ ] Attach schema/migration and token hashing/expiry tests ## Difficulty Advanced
Description
Persist email verification, password reset, refresh sessions, and login attempts securely.
File Location
learnault-api/prisma/schema.prisma, migration, andlearnault-api/src/domain/auth/Design Reference
API Roadmap Phase 1: Add Auth Token and Session Persistence Models.
Dependencies
Tasks
Acceptance Criteria
Verification Evidence
Difficulty
Advanced