Skip to main content

Recreate TOTP QR Codes

Project description

reotp

This project is a One Time Passcode (OTP) Regenerator that you can use to regenerate OTP provisioning URIs and QR codes. Useful for transitioning and existing OTP to an new service or app, like Google Authenticator.

Features

  • Create and display or save QR codes for your existing OTPs.
  • Support for both Time (TOTP) and Counter (HOTP) based OTPs.
  • Advanced parameters for OTPs that use non-standard algothms, length, or periods.

Installation

Install using pip, or your preferred python package manager, from pypi:

pip install reotp

If you want to download and tinker, just clone or fork the repo:

git clone https://github.com/cbinckly/reotp.git

Usage

The python package installs a shim, so you can run it from the command line:

$ reotp --help
usage: reotp [-h] -i ISSUER [-s SECRET] [-u USER] [-q] [-f PATH] [-c CURRENT_COUNT]
             [-d DIGITS] [-a ALGORITHM] [-p PERIOD]

Regenerate an existing OTP.

options:
  -h, --help            show this help message and exit
  -i ISSUER, --issuer ISSUER
                        Issuer for TOTP. This is the name that will appear in your app.
  -s SECRET, --secret SECRET
                        Secret for the TOTP. If not provided, requested interactively so
                        you don't leak the secret in shell history.
  -u USER, --user USER  Username for the OTP. If not provided library defaults to
                        'Secret'.
  -q, --qrcode          Display a QR code for the OTP.
  -f PATH, --qrcode-png PATH
                        Write the QR code for the OTP to a file.

Advanced:
  Advanced options that you probably do not need.

  -c CURRENT_COUNT, --counter CURRENT_COUNT
                        Counter based OTP with current count.
  -d {6,8}, --digits {6,8}
                        Number of digits.
  -a ALGORITHM, --algorithm ALGORITHM
                        Hashing algorithm.
  -p PERIOD, --period PERIOD
                        Refresh period in seconds.
reotp -i YourIssuer -s YourSecret -u YourUsername -q -f path/to/your/qr_code.png

Command Line Arguments

  • -i or --issuer: (Required) Issuer for the TOTP.
  • -s or --secret: (Optional) Secret for the TOTP.
  • -u or --user: (Optional) Username for the service.
  • -q or --qrcode: (Optional) Display a QR code for the TOTP.
  • -f or --qrcode-png: (Optional) Write the QR code to a specified file.
  • Advanced options (Optional):
    • -d or --digits: Number of digits for this OTP.
    • -c or --counter: Counter-based OTP.
    • -a or --algorithm: Hashing algorithm.
    • -p or --period: Refresh period.

Examples

To generate a TOTP provisioning URI and display a QR code, you would run:

reotp -i ExampleIssuer -s JBSWY3DPEHPK3PXP -u exampleuser -q

To generate an HOTP (counter based) with a current count of 100, using sha256 and a length of seven:

reotp -i MyIssuer -s JBSWY3DPEHPK3PXP -q -a sha256 -l 7 -c 100

Contributing

Contributions are welcome! If you have suggestions for improvements, feel free to fork the repository, make your changes, and submit a pull request.

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature and more details regarding the change').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

reotp-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reotp-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file reotp-0.1.0.tar.gz.

File metadata

  • Download URL: reotp-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for reotp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b172738590ee045a30cea7bc96cf5a664578e6be7bda65e53e44ae1a23207280
MD5 ac29d58580ae4ed3b7998eab2d45989d
BLAKE2b-256 2a2d691e72ad0046da09aebd0b886f26f6326a064e700c4197a56e170dbcce95

See more details on using hashes here.

File details

Details for the file reotp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: reotp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for reotp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59047ea0640f42d31ceaf53f9aef64fbae70ee8f7767ec3bead2516f98f693a5
MD5 587d3bec99956e671d7f5ad6901a1445
BLAKE2b-256 fbe14e63e3a6f2cb64fbf731415c92c2ac73ef0001d5a0880ca8c9f39099af1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page