A lightweight, command-line utility written in Python to manage TOTP (Time-based One-Time Password) secrets securely on macOS using the native Keychain.
- 🔒 Secure storage using macOS Keychain
- 🧾 Add, delete, rename TOTP secrets
- 🔎 Search and list stored accounts
- 🔢 Generate and copy one-time passwords (OTPs)
- 📱 Display QR codes for account setup
- 📤 Export / 📥 Import secrets
- 🎨 Colorized output and clipboard integration
- macOS
- Python 3.13+
- pykeychain
- qrcode
pipx install pytotp-client
# account name - can be any string, no restrictions here
totp add <account> <secret>
# Example:
totp add google.com BBBBDDDD
totp get <pattenr>
# Example:
totp get google.com
# OTP will be printed and copied to clipboard
# you can use a search pattern here
totp get goo
# OTP for google.com will be printed here
totp delete <account>
# Example:
totp delete google.com
totp rename <old_account> <new_account>
# Example:
totp rename google.com gmail.personal
totp search <pattern>
# Example:
totp search goog
# List of accounts with substring goog will be printed
totp list
totp qr <email> <account>
# Example:
totp qr [email protected] google.com
# QR code will be shown using the system viewer
totp export > backup.txt
totp import < backup.txt
totp --version
In the macOS default Keychain:
- Service name: pytotp_client
- Type: Application password
- The first OTP shown by get is also copied to your clipboard.
- Use export and import to backup/restore secrets between systems.
- The app exits with a non-zero status code on failure, allowing scripting/integration.