Skip to main content

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 ~/.config that 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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for totp-authenticator-cli 0.1.2
File Size Uploaded Provenance Actions
totp_authenticator_cli-0.1.2.tar.gz 45.6 kB With provenance Details for totp_authenticator_cli-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for totp-authenticator-cli 0.1.2
File Interpreter ABI Platform Actions
totp_authenticator_cli-0.1.2-py3-none-any.whl Python 3 none any Details for totp_authenticator_cli-0.1.2-py3-none-any.whl

Total release size: 81.8 kB

Release files / totp_authenticator_cli-0.1.2.tar.gz

Download URL totp_authenticator_cli-0.1.2.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c7c6d570d22becbec2448542ab5ce6d1363a2850356769bfef564b3ce9c258d7
BLAKE2b-256 checksum
How to use checksums
f6741bb74f4e323056ba775bd921179cd05af336fde9aafd2b5b163b05cc2a1e
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 log

Release files / totp_authenticator_cli-0.1.2-py3-none-any.whl

Download URL totp_authenticator_cli-0.1.2-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cae3bf71b274ba23d96f87d26d9ac7c1e318c0f076ba94d3273049b38b87c8e4
BLAKE2b-256 checksum
How to use checksums
43803b7728ee6fa647f87b2a86c7c1812b90ccc0f6d6f3eab9547e0997c33730
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 log

Security for totp-authenticator-cli 0.1.2

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.

Select from 2 files

Attestation for totp_authenticator_cli-0.1.2.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 log

A 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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page