Skip to main content

totp-cli

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, battle.net, 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.

Usage

Usage:

totp SERVICE

For example:

$ totp github
621787

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:

totp -s SECONDS SERVICE

For example:

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

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, battle.net 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.

Requirements

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

  • xclip for Xorg (Linux/BSD).

Installation

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:

License

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

Copyright (c) 2014-2017 Hugo Osvaldo Barrera <hugo@barrera.io>

Metadata

Release files for totp 1.3.0

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 1.3.0
File Size Uploaded
totp-1.3.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for totp 1.3.0
File Interpreter ABI Platform
totp-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / totp-1.3.0.tar.gz

Download URL totp-1.3.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ade5afde91f535a3bbc0a02de246dfadec0a4ba465a59147e0db186f66a2e372
BLAKE2b-256 checksum
How to use checksums
fdaca05d9dcefe55ebaeb7f35537db3fdf6d33b5f7f56237e8ee46918c9b9aa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

Release files / totp-1.3.0-py3-none-any.whl

Download URL totp-1.3.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cc013217d1d9662e93a9e8dd911010045ea2d68539e620577ceea5ac1ab3b81
BLAKE2b-256 checksum
How to use checksums
6f23c736aed4e94365231045722dd49df0194d234aadd8d26aa211b86bc34a84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

1 release file

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