A complete Node.js server implementation converted from the browser extension, featuring user authentication, QR code processing, and real-time OTP generation.
- User Authentication: JWT-based registration and login system
- QR Code Processing: Upload and process QR code images to extract OTP data
- Real-time OTP Generation: Live TOTP codes with countdown timers
- MongoDB Integration: Persistent storage for users and OTP entries
- Modern Web Interface: Responsive frontend with authentication
- Multiple OTP Types: Support for TOTP, HOTP, Steam, and Battle.net codes
-
Install Dependencies:
npm install
-
Environment Configuration:
cp env.example .env # Edit .env file with your MongoDB connection and secrets -
Start MongoDB (optional - server works without it):
- Install MongoDB locally, or
- Use MongoDB Atlas cloud service
- Update
MONGODB_URIin .env file
-
Run the Server:
npm start # or for development npm run dev
Navigate to http://localhost:3000 to access the web interface.
- Register: Create a new account to save OTP codes permanently
- Guest Mode: Use without registration for temporary QR processing
- Upload QR code images via:
- File upload
- Camera capture
- Clipboard paste
- Get live OTP codes with countdown timers
- Save codes to your collection (authenticated users)
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profile
POST /api/otp/upload- Upload QR and save to collectionGET /api/otp- Get user's saved OTP entriesPOST /api/otp/:id/generate- Generate code for saved entryDELETE /api/otp/:id- Delete OTP entry
POST /api/qr/upload- Process QR without savingPOST /api/qr/base64- Process base64 QR image
GET /health- Health checkGET /api- API information
# Server
PORT=3000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/otp-authenticator
# Security
JWT_SECRET=your-super-secret-jwt-key
SESSION_SECRET=your-super-secret-session-key
# File Upload
MAX_FILE_SIZE=10MB
UPLOAD_PATH=./uploadsnpm start- Start production servernpm run dev- Start development server with nodemonnpm test- Run tests
├── server.js # Main server file
├── package.json # Dependencies and scripts
├── .env # Environment configuration
├── config/ # Database configuration
├── middleware/ # Authentication middleware
├── models/ # MongoDB models
├── routes/ # API routes
├── services/ # Business logic services
├── public/ # Static web files
├── lib/ # Shared libraries
└── uploads/ # QR code image storage
- JWT token-based authentication
- Password hashing with bcrypt
- Rate limiting on auth endpoints
- Input validation and sanitization
- Secure file upload handling
- CORS and security headers
- TOTP (Time-based): Google Authenticator, Microsoft Authenticator
- HOTP (Counter-based): Hardware tokens
- Steam: Steam Guard codes
- Battle.net: Blizzard Authenticator
- Server Architecture: Express.js instead of browser APIs
- User Management: Multi-user support with authentication
- Persistent Storage: MongoDB instead of browser storage
- Web Interface: Modern responsive UI instead of popup
- File Handling: Server-side image processing with Jimp
- Real-time Updates: Live OTP codes with countdown timers
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details
For issues and questions:
- Check the server logs for errors
- Verify MongoDB connection
- Ensure all environment variables are set
- Check the browser console for frontend errors
For production deployment:
- Set
NODE_ENV=production - Use a process manager like PM2
- Set up reverse proxy with Nginx
- Use MongoDB Atlas for database
- Configure proper SSL certificates