Skip to main content

A cli based TOTP app.

Project description

version on pypi licence

totp-cli is a simple command line application to generate OTP tokens for two factor authentication using RFC6238.

These are compatible with many popular services such as Facebook, GitHub, Google, eve-online,, etc.

totp-cli fetches your shared key (aka: code) from pass, generates the token, outputs it to stdout and copies it to your CLIPBOARD X selection. Default X selection can be overridden with the PASSWORD_STORE_X_SELECTION environment variable.

Shared keys should be stored in your pass storage under 2fa/SERVICE/code, for example 2fa/github/code. The -a flag (or alternatively the add subcommand) can be used to add this less painfully.




For example:

$ totp github

You don’t need to run totp from the command line if you just want to paste the code; you can run it from dmenu, or whatever your application launcher is.

To offset the clock by a number of seconds:


For example:

$ totp -s +60 github
$ totp -s -90 github

To add a service:

totp -a SERVICE
# OR
totp add SERVICE

For example:

$ totp -a github
Token length [6]: 6
Shared key: KEY

Note that if the service already exists, it will be overwritten without warning.

About pass entries

Pass entries are expected to have the TOTP secret in their first line (as provided by the third party). The amount of digits token must have (for example, uses 8), must be provided in a separate line, with a format like:

Digits: 8

For the moment, only customizing the token length is possible.


There are also some platform-specific requirements for copying code into the clipboard:

  • xclip for Xorg (Linux/BSD).


Installation is quite simple:

$ pip install totp

There is also an AUR package available for ArchLinux users.

You can also configure shell completion for totp-cli:


totp-cli is distrbuted under the terms of the ISC licence. See LICENCE for details.

Copyright (c) 2014-2017 Hugo Osvaldo Barrera <>

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for totp, version 1.3.0
Filename, size File type Python version Upload date Hashes
Filename, size totp-1.3.0-py3-none-any.whl (6.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size totp-1.3.0.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page