Hi! I'm Ethan

Hard learning. Hardworking. Hard playing. Ready for what's next.

Project SNA Thumbnail

Self-Hosted TOTP Authenticator

A desktop-based 2FA solution for managing multiple TOTP authenticator codes without reaching for your phone.

View on GitHub

Built With

Node.js Badge Express Badge SQLite Badge JavaScript Badge HTML5 Badge CSS3 Badge Docker Badge

This project arose from my daily workflow as a cloud computing tutor. Marking hundreds of student environments requires setting up 2FA repeatedly, which became tedious with constant phone usage. While Linux oathtool helped, forgetting to note down secret keys meant repeatedly setting up the same accounts, tedious part 2.

The Self-Hosted Authenticator is a desktop-based TOTP (Time-based One-Time Password) solution that eliminates the need to reach for your phone, running locally in a Docker container. It supports adding unlimited accounts and provides a clean, simple interface for managing 2FA codes.

Screenshots

Dark Interface

Dark Interface

Light Interface

Light Interface

Key Features

Development Challenges

During development, I encountered and overcame several technical challenges:

Challenge #1: Database Selection

Initially, I chose NeDB since it provides a MongoDB-like API for JavaScript. I wanted something flexible that could be embedded directly in the app. However, after implementation began, I encountered issues with permissions and security alerts - NeDB is no longer maintained and has some lingering bugs.

Solution: Switched to SQLite for better reliability, broader community support, and stronger persistence guarantees.

Challenge #2: Parsing TOTP URIs

When adding a TOTP URI containing an email address, characters were being incorrectly parsed or dropped entirely, breaking the authentication. The issue was in the parseOTPAuthURI function, where Node's URL parser was struggling with the custom otpauth:// URI scheme.

Solution: Created a custom parser that:

Challenge #3: QR Code Scanning Integration

Initially tried to use Canvas dependencies for QR code scanning, but ran into version incompatibility issues in the containerized environment.

Solution: Switched to jsQR library, which provided more reliable QR code detection with fewer dependencies.

Security Considerations

This project is designed for personal use and implemented with basic security measures:

It's important to note that this tool lacks enterprise-grade security features like proper authentication for the web interface, advanced database encryption, audit logging, or intrusion detection. It's suitable for personal use but would need significant security enhancements for any production environment.

For the full code and documentation, visit the GitHub repository.