Professional multi-factor authentication system supporting TOTP, HOTP, and Challenge-Response OTP protocols
In today's digital landscape, password-based authentication alone is insufficient to protect sensitive user accounts and enterprise systems from sophisticated cyber attacks, credential theft, and unauthorized access. Organizations face increasing regulatory requirements for multi-factor authentication (MFA) while users demand seamless security experiences. Traditional authentication methods lack flexibility, often requiring separate systems for different security levels and failing to provide appropriate protection for varying transaction risks.
There is a critical need for a comprehensive, standards-compliant authentication system that supports multiple OTP protocols—including TOTP (Time-based), HOTP (Counter-based), and Challenge-Response mechanisms—while maintaining ease of use, mobile compatibility, and enterprise-grade security. This project addresses these challenges by creating a production-ready authentication platform that implements RFC-compliant OTP generation, secure secret management with AES-256 encryption, JWT-based session handling, and an intuitive web interface, enabling organizations to deploy appropriate authentication strength based on transaction risk levels while providing users with a seamless multi-factor authentication experience.
The system is built on Next.js 15 with TypeScript, implementing three distinct OTP protocols: TOTP (RFC 6238) for time-based authentication with 30-second windows, HOTP (RFC 4226) for counter-based generation, and Challenge-Response OTP for enterprise-level transaction security. The architecture uses the speakeasy library for RFC-compliant OTP generation, bcryptjs for password hashing, and jsonwebtoken for stateless authentication with HTTP-only cookies.
The security layer implements AES-256 encryption for secret storage, ensuring OTP seeds are never stored in plaintext. User passwords undergo bcrypt hashing with automatic salt generation. The Challenge-Response system generates cryptographically random 8-character hex challenges with 5-minute expiration windows and single-use enforcement. JWT tokens are stored in HTTP-only cookies with secure flags, preventing XSS attacks while maintaining session state.
The application features a modern, responsive interface built with Tailwind CSS, offering dedicated pages for registration, login, OTP verification, and challenge-response authentication. RESTful API endpoints handle user management, OTP generation/verification, challenge lifecycle management, and QR code generation for mobile authenticator apps. The system supports Google Authenticator, Microsoft Authenticator, Authy, and any TOTP/HOTP-compatible mobile application through standards-compliant QR code provisioning.