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 existing OTPs to a 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.2.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.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reotp-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 29b129fc844be85137d50a8ef154056c73b330a09e1bec490ca4bd72c0e2b221
MD5 46b4ff0efbfd66666a2debe20575c60b
BLAKE2b-256 65cd68062c033cd5f4e22d3146ceb019444a9bb906a998cb54831a073d80e867

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reotp-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ece4f529e7521b3d653f707f7d320d9ba241c743cecb9672976bf24bb853d37a
MD5 73252c6e7936d04f5bc0a34eeb994282
BLAKE2b-256 b25e1b73e8dc355bfed4738fc29732bdca27df05da5b58b20fe554359cf2c247

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