Skip to content

Feature: Add Auth Token and Session Persistence Models #129

Description

@3m1n3nc3

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions