This project demonstrates a simple Time-based One-Time Password (TOTP) authentication flow using Go, Gin, and QR code generation.
- Register endpoint to generate a TOTP secret and QR code
- Verify endpoint to validate user-provided OTPs
- Debug endpoint to view the current valid OTP (for testing)
- GET
/register
- Generates a new TOTP secret and saves a QR code as
totp-qr.png
. - Response includes the secret and otpauth URL.
- POST
/verify
- Request body:
{ "otp": "<6-digit code>" }
- Validates the provided OTP against the current secret.
- GET
/debug-otp
- Returns the current valid OTP for the secret (for testing only).
- Start the server:
go run main/main.go