Skip to main content

Regenerate OTP URIs and 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.1.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.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reotp-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3b2eda0e2dbd8a398f60dad925519afa4716cb183ae8a72da013869f1dfcbb9f
MD5 328b4d0ab0861ed6c2f08771a941e154
BLAKE2b-256 715aea4c49f559b996a631a54b163a1c3b2e76b1ac1db6fc800bae279087b0c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reotp-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a5c1067176ae5da2a785fd19df40b0ae241c804accab03b54c599121599f9d1
MD5 f008c1e0967e1164ec9e48d3906b8e0b
BLAKE2b-256 445347485fd650dbac0a77d48a7067f683a134ed5c889e2a47b2fc9b35bca3af

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