Daeseon Yoo
Back to project
·Update·1 min

Two-factor authentication (TOTP) with recovery codes

Added TOTP-based 2FA implemented from the RFC primitives (HMAC-based one-time codes), a QR setup flow, a second login step, and recovery codes.

Reconstructed from commit 9b9f322 (2026-04-01).

For a tool that holds sensitive monitoring data, a password alone is thin. So admins get TOTP two-factor auth — the 6-digit code from an authenticator app (Google Authenticator, 1Password, etc.).

Built from the primitives, not a black box

internal/auth/totp.go (~113 lines) implements the standard directly:

A dedicated totp_test.go (~139 lines) pins the behavior against known vectors and time windows.

The flow

A later hardening pass encrypted the stored TOTP secret at rest (AES-GCM under the master key) — but the factor itself landed here.