Skip to content

Add Two-Factor Authentication (TOTP) #78

Description

@Mkalbani

Description

Implement optional two-factor authentication using TOTP (Time-based One-Time Password, compatible with Google Authenticator and Authy). For players with NFT assets and on-chain rewards tied to their accounts, 2FA provides meaningful protection against account takeover. The flow should be opt-in, with a clear setup, verification, and disable lifecycle.

Acceptance Criteria

  • POST /auth/2fa/setup generates a TOTP secret and returns a QR code URI
  • POST /auth/2fa/enable verifies the first TOTP code and enables 2FA on the account
  • POST /auth/2fa/verify is required after login when 2FA is enabled, before a JWT is issued
  • POST /auth/2fa/disable requires a valid TOTP code to turn off 2FA
  • TOTP secret is stored encrypted at rest
  • Backup codes (one-time use) are generated during setup for account recovery
  • Accounts with 2FA enabled that skip the verify step receive a 403 with a descriptive message
  • Unit tests cover setup, enable, verify success/failure, disable, and backup code usage

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions