totp
The two-factor half of a login, for autonomous agents. Accounts are imported once from Google Authenticator and stored encrypted; each call hands an agent the code it needs, with a guaranteed minimum of the step still ahead of it — so the code it types is never one that expires under its fingers.
It is the second half of a pair with use-computer, which types the password from its secret store. The two compose in one line, and the digits go from the store to the keystrokes without passing through the agent's context:
use-computer type --text "$(totp code github)"
Install
pip install totp-authenticator-cli
The distribution is totp-authenticator-cli because totp-cli and totp are both taken on
PyPI by unrelated projects. The command it installs is totp, and the package it imports is
totp_cli. There are no optional extras: the whole tool is pure Python over the standard
library plus five wheels-everywhere dependencies.
Use
totp add github --issuer GitHub # the seed, pasted or typed on stdin — never an argument
totp code github # six digits on stdout, with ≥5s of validity guaranteed
totp github # `code` is the default command
totp import # the Google Authenticator export, pasted on stdin
totp list # names and parameters; never a seed
totp skill install # the agent skill, into this project's skills directory
add prints the current code as it stores the account — the one moment the phone is open next
to the terminal, and the only verification the enrollment has.
code refuses to hand over a code with under --min-validity seconds left (default 5): it
waits for the next step and says so on stderr. --no-wait takes whatever is left. A wait of up
to one step is normal; killing it and retrying is the one way to make the tool wrong.
stdout is the digits and nothing else — no trailing newline, so a pipe receives the exact
bytes. Diagnostics go to stderr. Exit codes: 0 success, 1 failure, 2 bad usage.
--format json exists on code and list for programs.
Importing from Google Authenticator
The phone's Settings → Transfer accounts → Export accounts shows QR codes whose payload is an
otpauth-migration://offline?data=… URI — every account in one string. Read it with any QR
reader that shows text (the camera app on a Mac, an online decoder, a phone that displays what
it scanned) and paste the URI into totp import. Single accounts arrive the same way, as the
otpauth://totp/… URI behind the "can't scan?" screen most services offer.
HOTP accounts are skipped: an exported counter desyncs from the phone the moment it is used, which would break the login the import was meant to complete.
Where the seeds live
~/.config/totp-cli/accounts.toml— the store, Fernet-encrypted, mode 0600.~/.local/share/totp-cli/account.key— the key, mode 0600, deliberately not beside the ciphertext: a~/.configthat gets synced, committed or pasted carries nothing usable.
The key file location is overridable with TOTP_CLI_KEY_FILE; an account can be supplied
directly with TOTP_CLI_ACCOUNT_<NAME> for a headless machine (plaintext, by design — the
environment is what the environment is; what it buys is a machine where the seed never touches
disk).
The seed never enters the agent's context. It is read from stdin, encrypted at rest, and
no command prints it — list shows names, errors show remedies. A code is fine to print: it
is worth one login and thirty seconds, which is the whole product.
The agent skill
The instructions the calling agent reads ship inside the package and match the installed version:
totp skill install --scope project # .agents/skills/totp/ (or .claude/skills/, if that is there)
totp skill install --scope user # the home directory
totp skill status
Nothing is ever written to or removed from a directory that does not carry this skill's frontmatter marker.
Development
cd code
uv venv && uv pip install -e ".[dev]"
uv run pytest # the RFC 6238 vectors, a fake clock, an isolated XDG home
uv run ruff check .
uv run mypy
Tests never wait a real thirty seconds and never read a real store: the clock is a fixture and the XDG home is a temporary directory.
License
MIT.
Metadata
Release files for totp-authenticator-cli 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| totp_authenticator_cli-0.1.1.tar.gz | 43.6 kB | With provenance | Details for totp_authenticator_cli-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| totp_authenticator_cli-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for totp_authenticator_cli-0.1.1-py3-none-any.whl |
Total release size: 78.8 kB
Release files / totp_authenticator_cli-0.1.1.tar.gz
| Download URL | totp_authenticator_cli-0.1.1.tar.gz |
|---|---|
| Size | 43.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
071f8c89bbf09ee30abbc39c724c9b430793af0f048800f8735d4d90bf832a62
|
|
BLAKE2b-256 checksum How to use checksums |
239165009cd0c0ad5520918305d640f18b1de26835fd7c5e9316aa33b35e41f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / totp_authenticator_cli-0.1.1-py3-none-any.whl
| Download URL | totp_authenticator_cli-0.1.1-py3-none-any.whl |
|---|---|
| Size | 35.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1952fe9cef60067e25d685903ef6518ae621c84f18861c0ef1af22e495851d28
|
|
BLAKE2b-256 checksum How to use checksums |
5d76c46d429a58ba8762b2a8a76f6bdbc201afdaa9f92cc5c4692badff0887e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for totp-authenticator-cli 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for totp_authenticator_cli-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.