# TOTP Generator

> A one-time-password generator that runs entirely in your browser.

- **Type:** Open source
- **Role:** Author
- **Period:** 2026
- **Focus:** Frontend
- **Stack:** React, TypeScript, Vite, Tailwind CSS, shadcn/ui, Web Crypto API, Vitest
- **Open the app:** https://totp.mychaelgo.com/
- **View on GitHub:** https://github.com/mychaelgo/totp
- **Page:** https://mychaelgo.com/projects/totp-generator

## Problem

Generating a two-factor code from a raw secret usually means pasting that secret into a site you have to trust, or installing an app.

## What Mychael did

- Implemented TOTP (RFC 6238) with the Web Crypto API: Base32 decoding, HMAC-SHA1 and dynamic truncation, so the secret never leaves the browser and is never stored.
- Built a mobile-friendly UI in React with Tailwind CSS and shadcn/ui: configurable digits and time window, a countdown bar and one-tap copy.
- Tested the algorithm against the official RFC 6238 test vectors with Vitest and React Testing Library.

## Screenshots

- The live app with the public example secret JBSWY3DPEHPK3PXP. (https://mychaelgo.com/projects/totp-generator/generator.webp): TOTP Generator showing code 724963 for the example secret JBSWY3DPEHPK3PXP, with digits 6, a 30-second window and a countdown
- The core: Base32 decoding and HMAC-based code generation with Web Crypto. (https://mychaelgo.com/projects/totp-generator/totp-ts.webp): totp.ts on GitHub with base32Decode and generateTotp using crypto.subtle HMAC-SHA1
