Minimal TOTP 2FA code generator with clipboard copy and global hotkey support
Project description
openauth-totp
Minimal TOTP 2FA code generator. One command copies your current code to the clipboard. Bind it to a global hotkey for two-keystroke 2FA from any app.
Install
pip install openauth-totp
Or install from source:
git clone https://github.com/rhakim/openauth-totp.git
cd openauth-totp
pip install .
Quick start
# 1. Save your Base32 secret (one-time)
openauth --setup
# 2. Copy current code to clipboard
openauth
That's it. Run openauth whenever you need a code, then paste it.
Requirements
- Python 3.10+ (only the standard library — zero pip dependencies)
- A clipboard tool (built-in on macOS and Windows):
- macOS:
pbcopy(pre-installed) - Windows:
clip(pre-installed) - Linux:
xcliporxsel(sudo apt install xclip)
- macOS:
- A browser (optional, only for
--guimode):- Chrome or Chromium gives a clean app-style window (no tabs/URL bar)
- Any other browser works too, just opens as a normal tab
Usage
| Command | Description |
|---|---|
openauth |
Generate code, copy to clipboard, show notification |
openauth --setup |
Save your Base32 secret key |
openauth --print |
Print code to stdout (no clipboard, no notification) |
openauth --next |
Copy the next code (one 30s period ahead) |
openauth --gui |
Open the browser-based visual interface |
Global hotkey setup
The real power is binding openauth to a keyboard shortcut so you can copy a 2FA code from any app without switching windows.
macOS (Shortcuts app — no extra software)
- Open Shortcuts.app
- Create a new shortcut
- Add a Run Shell Script action
- Set the command to the full path (find it with
which openauth):/path/to/openauth - Click the shortcut name at the top → click ⓘ (info) → Add Keyboard Shortcut
- Press your desired key combo (e.g.
Ctrl+Shift+O)
Now from any app: press your hotkey, then Cmd+V to paste.
Windows (AutoHotkey)
Install AutoHotkey, then create a script:
^+o:: ; Ctrl+Shift+O
Run, openauth, , Hide
return
Linux (GNOME / KDE / etc.)
Add a custom keyboard shortcut in your desktop environment's settings:
- Command:
openauth - Shortcut: your choice (e.g.
Ctrl+Shift+O)
GUI mode
openauth --gui
Opens a small browser-based interface showing the live code with a countdown. Keyboard shortcuts work when the window is focused:
| Key | Action |
|---|---|
C or Cmd/Ctrl+C |
Copy code to clipboard |
N |
Toggle next code |
Esc |
Back to settings |
| Double-click code | Copy to clipboard |
Chrome/Chromium opens this as a standalone window (no tabs or URL bar). Other browsers open it as a regular tab — functionally identical.
How it works
Standard TOTP (RFC 6238):
- HMAC-SHA1 with a 30-second time step
- 6-digit codes
- Base32-encoded secret key
- Compatible with Google Authenticator, Duo, 1Password, and any TOTP-based 2FA
Where the secret is stored
CLI mode: ~/.config/openauth/secret with chmod 600 permissions. This is a plain file — similar to how ~/.ssh/ stores keys. Protect your machine, and the secret is safe.
GUI mode: Encrypted with AES-256-GCM in the browser's localStorage. The decryption key is a non-extractable CryptoKey in IndexedDB (cannot be exported via JavaScript). The secret is never stored in plaintext in the browser.
Attribution
This codebase was largely vibecoded using Claude Code with Opus 4.6
Other
If you are using this for the Harvard FAS cluster. Visit this site to request your setup token: https://docs.rc.fas.harvard.edu/kb/openauth/.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openauth_totp-0.1.0.tar.gz.
File metadata
- Download URL: openauth_totp-0.1.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e46873c2f2cae9ca339e762e5fa88c9ba8194e7c1ef30b603070c09cdcd501f7
|
|
| MD5 |
774ce7c0a6e679246a6953d4bb666ec9
|
|
| BLAKE2b-256 |
5afb3a98d53ffe447cc417781913aff5ea4f09aaa7fa5a33b0d3aceb0755117c
|
Provenance
The following attestation bundles were made for openauth_totp-0.1.0.tar.gz:
Publisher:
pypi_release.yml on RichieHakim/openauth-totp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openauth_totp-0.1.0.tar.gz -
Subject digest:
e46873c2f2cae9ca339e762e5fa88c9ba8194e7c1ef30b603070c09cdcd501f7 - Sigstore transparency entry: 1034176926
- Sigstore integration time:
-
Permalink:
RichieHakim/openauth-totp@a7c3e8cabddccc9164efa155b07a277d084825bb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RichieHakim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_release.yml@a7c3e8cabddccc9164efa155b07a277d084825bb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file openauth_totp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openauth_totp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a08a94ae58bba735060f8d78eefea476c5af26ac1e4ea2532844f812ace4d887
|
|
| MD5 |
e3fe38e2f85abae5c228cd690c11b106
|
|
| BLAKE2b-256 |
b9094ff7a43baaf251404aee12d693afee597e4aea5c5ee4de6d6b5655486fd1
|
Provenance
The following attestation bundles were made for openauth_totp-0.1.0-py3-none-any.whl:
Publisher:
pypi_release.yml on RichieHakim/openauth-totp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openauth_totp-0.1.0-py3-none-any.whl -
Subject digest:
a08a94ae58bba735060f8d78eefea476c5af26ac1e4ea2532844f812ace4d887 - Sigstore transparency entry: 1034176994
- Sigstore integration time:
-
Permalink:
RichieHakim/openauth-totp@a7c3e8cabddccc9164efa155b07a277d084825bb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RichieHakim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_release.yml@a7c3e8cabddccc9164efa155b07a277d084825bb -
Trigger Event:
workflow_dispatch
-
Statement type: