{"id":13473713,"url":"https://github.com/susam/mintotp","last_synced_at":"2025-05-14T23:15:50.641Z","repository":{"id":39707402,"uuid":"201277584","full_name":"susam/mintotp","owner":"susam","description":"Minimal TOTP generator in 20 lines of Python","archived":false,"fork":false,"pushed_at":"2024-01-21T01:42:02.000Z","size":40,"stargazers_count":1365,"open_issues_count":3,"forks_count":88,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-28T00:34:58.952Z","etag":null,"topics":["2fa","cryptography","hotp","minimalist","python3","security","totp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/susam.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-08T14:40:10.000Z","updated_at":"2025-04-19T17:40:44.000Z","dependencies_parsed_at":"2024-10-30T04:31:41.998Z","dependency_job_id":null,"html_url":"https://github.com/susam/mintotp","commit_stats":{"total_commits":31,"total_committers":4,"mean_commits":7.75,"dds":0.09677419354838712,"last_synced_commit":"b96dce1a1879d71efc300cd7c8b6c178a52fafec"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susam%2Fmintotp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susam%2Fmintotp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susam%2Fmintotp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susam%2Fmintotp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/susam","download_url":"https://codeload.github.com/susam/mintotp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243313,"owners_count":22038048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fa","cryptography","hotp","minimalist","python3","security","totp"],"created_at":"2024-07-31T16:01:06.189Z","updated_at":"2025-05-14T23:15:50.603Z","avatar_url":"https://github.com/susam.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"MinTOTP\n=======\n\nMinTOTP is a minimal TOTP generator written in Python.\n\n[![View Source][Source SVG]][src]\n[![PyPI Package][PyPI SVG]][pypi]\n[![PyPI Hits][Hits SVG]][pypi]\n[![MIT License][License SVG]][L]\n\n\n[Source SVG]: https://img.shields.io/badge/view-source-brightgreen.svg\n[src]: mintotp.py\n[PyPI SVG]: https://img.shields.io/pypi/v/mintotp.svg\n[Hits SVG]: https://img.shields.io/pypi/dm/mintotp\n[License SVG]: https://img.shields.io/badge/license-MIT-blue.svg\n\n\nContents\n--------\n\n* [Introduction](#introduction)\n* [Source Code](#source-code)\n* [Install](#install)\n  * [From PyPI](#from-pypi)\n  * [From GitHub](#from-github)\n* [Get Started](#get-started)\n  * [With Base32 Key](#with-base32-key)\n  * [With QR Code](#with-qr-code)\n* [Protect Key with GPG](#protect-key-with-gpg)\n  * [Install GPG](#install-gpg)\n  * [Encrypt Base32 Key With GPG](#encrypt-base32-key-with-gpg)\n  * [Encrypt QR Code With GPG](#encrypt-qr-code-with-gpg)\n* [Usage](#usage)\n  * [Multiple Keys](#multiple-keys)\n  * [Command Line Arguments](#command-line-arguments)\n* [Tradeoff](#tradeoff)\n* [Alternative: OATH Toolkit](#alternative-oath-toolkit)\n* [Resources](#resources)\n* [License](#license)\n* [Thanks](#thanks)\n\n\nIntroduction\n------------\n\nTOTP stands for Time-Based One-Time Password. Many websites and services\nrequire two-factor authentication (2FA) or multi-factor authentication\n(MFA) where the user is required to present two or more pieces of\nevidence:\n\n  - Something only the user knows, e.g., password, passphrase, etc.\n  - Something only the user has, e.g., hardware token, mobile phone, etc.\n  - Something only the user is, e.g., biometrics.\n\nA TOTP value serves as the second factor, i.e., it proves that the user\nhas a device (e.g., mobile phone) that contains a TOTP\nsecret key from which the TOTP value is generated. Usually the service\nprovider that provides a user's account also issues a secret key encoded\neither as a Base32 string or as a QR code. This secret key is added to\nan authenticator app (e.g., Google Authenticator) on a mobile device.\nThe app can then generate TOTP values based on the current time.\nBy default, it generates a new TOTP value every 30 seconds.\n\nMinTOTP is a Python tool that can be used to generate TOTP values from a\nsecret key. Additionally, it exposes its functionality as module-level\nfunctions for Python developers. It can be used on any system with\nPython 3.4 or later installed on it.\n\n\nSource Code\n-----------\n\nAt the heart of the TOTP algorithm lies the HOTP algorithm. HOTP stands\nfor HMAC-based One-Time Password. HMAC stands for Hash-based Message\nAuthentication Code. Here are the relevant RFCs to learn more about\nthese algorithms:\n\n  - [RFC 2104]: HMAC: Keyed-Hashing for Message Authentication\n  - [RFC 4226]: HOTP: An HMAC-Based One-Time Password Algorithm\n  - [RFC 6238]: TOTP: Time-Based One-Time Password Algorithm\n\n[RFC 2104]: https://tools.ietf.org/html/rfc2104\n[RFC 4226]: https://tools.ietf.org/html/rfc4226\n[RFC 6238]: https://tools.ietf.org/html/rfc6238\n\nThe source code in [`mintotp.py`][src] generates TOTP values from a\nsecret key and current time. It's just 30 lines of code (actually 20\nlines if we ignore the shebang and blank lines). There are no comments\nin the code, so a brief description of the code is presented in this\nsection. Here is the entire code presented once again for convenience:\n\n```python\n#!/usr/bin/env python3\n\nimport base64\nimport hmac\nimport struct\nimport sys\nimport time\n\n\ndef hotp(key, counter, digits=6, digest='sha1'):\n    key = base64.b32decode(key.upper() + '=' * ((8 - len(key)) % 8))\n    counter = struct.pack('\u003eQ', counter)\n    mac = hmac.new(key, counter, digest).digest()\n    offset = mac[-1] \u0026 0x0f\n    binary = struct.unpack('\u003eL', mac[offset:offset+4])[0] \u0026 0x7fffffff\n    return str(binary)[-digits:].zfill(digits)\n\n\ndef totp(key, time_step=30, digits=6, digest='sha1'):\n    return hotp(key, int(time.time() / time_step), digits, digest)\n\n\ndef main():\n    args = [int(x) if x.isdigit() else x for x in sys.argv[1:]]\n    for key in sys.stdin:\n        print(totp(key.strip(), *args))\n\n\nif __name__ == '__main__':\n    main()\n```\n\nIn the code above, we use the `hmac` module available in the Python\nstandard library to implement HOTP. The implementation can be found in\nthe `hotp()` function. It is a pretty straightforward implementation of\n[RFC 2104: Section 5: HOTP Algorithm][RFC 2104-5]. It takes a\nBase32-encoded secret key and a counter as input. It returns a 6-digit\nHOTP value as output.\n\nThe `totp()` function implements the TOTP algorithm. It is a thin\nwrapper around the HOTP algorithm. The TOTP value is obtained by\ninvoking the HOTP function with the secret key and the number of time\nintervals (30-second intervals by default) that have elapsed since Unix\nepoch (1970-01-01 00:00:00 UTC).\n\n[RFC 2104-5]: https://tools.ietf.org/html/rfc4226#section-5\n\n\nInstall\n-------\n\nMinTOTP requires Python 3.4 or later. If Python 3.4 or later is present\non your system, follow one of the two sections below to get MinTOTP on\nyour system.\n\n\n### From PyPI\n\nIf you want to install the MinTOTP package from [PyPI][pypi] as a Python\nmodule on your system, then follow the steps provided below. Doing so\nmakes MinTOTP available as the `mintotp` command that you can run on the\nterminal. A module named `mintotp` also becomes available that you can\n`import` in your own Python code.\n\n 1. Enter the following command to install MinTOTP on your system:\n\n    ```shell\n    pip3 install mintotp\n    ```\n\n 2. Test that MinTOTP works fine as a command:\n\n    ```shell\n    mintotp \u003c\u003c\u003c ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n    A 6-digit TOTP value should appear as the output.\n\n 3. Test that MinTOTP can be used as a library module:\n\n    ```pycon\n    $ python3\n    \u003e\u003e\u003e import mintotp\n    \u003e\u003e\u003e mintotp.totp('ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS')\n    \u003e\u003e\u003e mintotp.hotp('ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS', 42)\n    ```\n\n    The `totp()` function call should return a 6-digit TOTP value based\n    on the current time. The `hotp()` call should return the following\n    HOTP value: `626854`.\n\n\n### From GitHub\n\nIf you do not want to install MinTOTP to your system as a command but\nyou want to work with the [`mintotp.py`][src] source file directly\nclone the GitHub repository of this project.\n\n 1. Clone GitHub repository of this project and enter its top-level\n    directory.\n\n    ```shell\n    git clone https://github.com/susam/mintotp.git\n    cd mintotp\n    ```\n\n 2. Test that [`mintotp.py`][src] works fine:\n\n    ```shell\n    python3 mintotp.py \u003c\u003c\u003c ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n    A 6-digit TOTP value should appear as the output.\n\n 3. Test that [`mintotp.py`][src] can be imported as a module:\n\n    ```pycon\n    $ python3\n    \u003e\u003e\u003e import mintotp\n    \u003e\u003e\u003e mintotp.totp('ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS')\n    \u003e\u003e\u003e mintotp.hotp('ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS', 42)\n    ```\n\n    The `totp()` function call should return a 6-digit TOTP value based\n    on the current time. The `hotp()` call should return the following\n    HOTP value: `626854`.\n\nAll examples provided in the sections below assume that MinTOTP has been\ninstalled from PyPI. If you choose to use MinTOTP from GitHub instead,\nreplace all occurrences of `mintotp` in the example commands below with\n`python3 mintotp.py`.\n\n\nGet Started\n-----------\n\nThis section presents a few examples to quickly get started with\nMinTOTP.\n\nNote that this section uses a few example secret keys and QR codes. They\nare merely examples that come with this project for you to quickly test\nthe program with. They should not be used for any real account that\nrequires TOTP-based two-factor authentication. Usually, the issuer of a\nreal account (such as an account on a website or an organization) would\nalso issue a secret key or a secret QR code to you which you must use to\ngenerate TOTP values for the purpose of logging into that account.\n\n\n### With Base32 Key\n\n 1. Enter this command:\n\n    ```shell\n    mintotp \u003c\u003c\u003c ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n    The output should be a 6-digit TOTP value.\n\n 2. Add the following key to a TOTP-based authenticator app:\n\n    ```\n    ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n    For example, if you have Google Authenticator on your mobile phone,\n    open it, tap the button with plus sign, select \"Enter a provided\n    key\", enter any account name and \"Time-based\" and enter the\n    above key. Set the dropdown menu to \"Time-based\" and tap the \"Add\"\n    button. A 6-digit TOTP value should appear for the new key.\n\n 3. Run the command in step 1 again and verify that the TOTP value\n    printed by the Python program matches the TOTP value that appears in\n    the authenticator app.\n\n\n### With QR Code\n\n 1. Install `zbarimg` to scan QR codes:\n\n    ```shell\n    # On macOS\n    brew install zbar\n\n    # On Debian, Ubuntu, etc.\n    apt-get install zbar-tools\n    ```\n\n 2. Download and save the following QR code on your system:\\\n    [![QR code for TOTP secret key](secret1.png)](secret1.png)\\\n    The QR code above can also be found in this file:\n    [secret1.png](secret1.png).\n\n 3. Enter this command to read the data in the QR code:\n\n    ```shell\n    zbarimg -q secret1.png\n    ```\n\n    The output should be:\n\n    ```\n    QR-Code:otpauth://totp/alice:bob?secret=ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n    Note that the secret key in the URI is the same as the secret key we\n    used in the previous sections.\n\n 4. Now enter this command to extract the secret key from the QR code\n    and feed it to MinTOTP.\n\n    ```shell\n    zbarimg -q secret1.png | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | mintotp\n    ```\n\n 5. Scan the QR code shown above in step 3 with a TOTP-based\n    authenticator app. For example, if you have Google Authenticator on\n    your mobile phone, open it, tap the button with plus sign, select\n    \"Scan a barcode\", and scan the QR code shown above in step 3. A\n    6-digit TOTP value should appear for the new key.\n\n 6. Run the command in step 4 again and verify that the TOTP value\n    printed by MinTOTP matches the TOTP value that appears in the\n    authenticator app.\n\n\nProtect Key with GPG\n--------------------\n\nThe previous sections use an example key and QR code to show how this\ntool works. If you use this tool to generate TOTP values from a real\nsecret key for a real account, you must encrypt your secret key to keep\nit safe. The next two subsections explain how to protect the key with\nGNU Privacy Guard (also known as GnuPG or GPG).\n\n\n### Install GPG\n\n 1. Install GNU Privacy Guard:\n\n    ```shell\n    # On macOS\n    brew install gnupg\n\n    # On Debian, Ubuntu, etc.\n    apt-get update\n    apt-get install gnupg\n    ```\n\n 2. Enter the following command to ensure that GPG is installed.\n\n    ```shell\n    gpg --version\n    ```\n\n    If GPG is installed properly, the command above should print its\n    version, license details, and cipher details.\n\n\n### Encrypt Base32 Key With GPG\n\nThe steps below show the usage of GPG to encrypt our example secret key.\nYou would have to replace this example secret key with a real secret key\nthat you want to use to generate TOTP values.\n\n 1. Encrypt the secret key using GPG. First enter this command:\n\n    ```shell\n    gpg -c -o secret.gpg\n    ```\n\n    Then enter a [strong passphrase] when it prompts for it. Re-enter\n    the passphrase to confirm it. Then paste the following key as input:\n\n    ```\n    ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n    Press \u003ckbd\u003eenter\u003c/kbd\u003e to end the line. Press \u003ckbd\u003ectrl\u003c/kbd\u003e +\n    \u003ckbd\u003ed\u003c/kbd\u003e to end input. The encrypted secret key would be saved\n    in a file named `secret.gpg`.\n\n 2. Generate TOTP value from the encrypted key:\n\n    ```shell\n    gpg -q -o - secret.gpg | mintotp\n    ```\n\n 3. You can also generate TOTP value and copy it to system clipboard:\n\n    ```shell\n    # On macOS\n    gpg -q -o - secret.gpg | mintotp | tr -d '\\n' | pbcopy\n\n    # On Linux\n    gpg -q -o - secret.gpg | mintotp | tr -d '\\n' | xclip\n    ```\n\n    Now you can easily paste the TOTP value to any login form that\n    requires it. On Linux, of course, you need to have `xclip` installed\n    to use it. On Debian, Ubuntu, etc. it can be installed with the\n    `apt-get install xclip` command. To paste the value copied into the\n    clipboard by `xclip`, middle-click on your mouse.\n\n 4. In case you want to see the TOTP value on the terminal while it is\n    also copied to the system clipboard, use one of these commands:\n\n    ```shell\n    # On macOS\n    gpg -q -o - secret.gpg | mintotp | tee /dev/stderr | tr -d '\\n' | pbcopy\n\n    # On Linux\n    gpg -q -o - secret.gpg | mintotp | tee /dev/stderr | tr -d '\\n' | xclip\n    ```\n\n[strong passphrase]: https://www.gnupg.org/faq/gnupg-faq.html#strong_passphrase\n\n\n### Encrypt QR Code With GPG\n\nThe steps below show the usage of GPG to encrypt our example QR code.\nYou would have to replace the example QR code with a real QR code that\nyou want to use to generate TOTP values.\n\n 1. Encrypt the QR code using GPG. First enter this command:\n\n    ```shell\n    gpg -c secret1.png\n    ```\n\n    Then enter a [strong passphrase] when it prompts for it. Re-enter\n    the passphrase to confirm it. The encrypted QR code would be saved in\n    a file named `secret1.png.gpg`.\n\n 2. Delete the unencrypted QR code file securely:\n\n    ```shell\n    # On macOS\n    rm -P secret1.png\n\n    # On Linux\n    shred -u secret1.png\n    ```\n\n 3. Generate TOTP value from the encrypted QR code file:\n\n    ```shell\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | mintotp\n    ```\n\n 4. You can also generate the TOTP value and copy it to system clipboard:\n\n    ```shell\n    # On macOS\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | mintotp | tr -d '\\n' | pbcopy\n\n    # On Linux\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | mintotp | tr -d '\\n' | xclip\n    ```\n\n 5. In case you want to see the TOTP value on the terminal while it is\n    also copied to the system clipboard, use one of these commands:\n\n    ```shell\n    # On macOS\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | mintotp | tee /dev/stderr | tr -d '\\n' | pbcopy\n\n    # On Linux\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | mintotp | tee /dev/stderr | tr -d '\\n' | xclip\n    ```\n\n\nUsage\n-----\n\n### Multiple Keys\n\nThis tool accepts one or more Base32 secret keys as standard input. Each\nkey must occur in its own line.\n\n 1. Generate multiple TOTP values, one for each of multiple Base32 keys:\n\n    ```shell\n    mintotp \u003c\u003ceof\n    ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    PW4YAYYZVDE5RK2AOLKUATNZIKAFQLZO\n    eof\n    ```\n\n 2. Generate TOTP values for multiple keys in multiple QR codes:\n\n    ```shell\n    zbarimg -q *.png | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | mintotp\n    ```\n\n\n### Command Line Arguments\n\nTo keep this tool as minimal as possible, it does not come with\nany command line options. In fact, it does not even have the `--help`\noption. It does support a few command line arguments though. Since there\nis no help output from the tool, this section describes the command line\narguments for this tool.\n\nHere is a synopsis of the command line arguments supported by this tool:\n\n```\nmintotp [TIME_STEP [DIGITS [DIGEST]]]\n```\n\nHere is a description of each argument:\n\n  - `TIME_STEP`\n\n    TOTP time-step duration (in seconds) during which a TOTP value is\n    valid. A new TOTP value is generated after time-step duration\n    elapses. (Default: `30`)\n\n  - `DIGITS`\n\n    Number of digits in TOTP value. (Default: `6`)\n\n  - `DIGEST`\n\n    Cryptographic hash algorithm to use while generating TOTP value.\n    (Default: `sha1`)\n\n    Possible values are `sha1`, `sha224`, `sha256`, `sha384`, and\n    `sha512`.\n\nHere are some usage examples of these command line arguments:\n\n 1. Generate TOTP value with a time-step size of 60 seconds:\n\n    ```shell\n    mintotp 60 \u003c\u003c\u003c ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n 2. Generate 8-digit TOTP value:\n\n    ```shell\n    mintotp 60 8 \u003c\u003c\u003c ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n 3. Use SHA-256 hash algorithm to generate TOTP value:\n\n    ```shell\n    mintotp 60 6 sha256 \u003c\u003c\u003c ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\nThe behaviour of the tool is undefined if it is used in any way other\nthan what is described above. For example, although surplus command line\narguments are ignored currently, this behaviour may change in the future, so\nwhat should happen in case of surplus arguments is left undefined in\nthis document.\n\n\nTradeoff\n--------\n\nIf you use this tool to generate TOTP values on a desktop/laptop device\nwhile logging into a website that requires TOTP-based two-factor (2FA)\nor multi-factor authentication (MFA) from the same device, you should be\naware that doing so trades off some security for convenience.\n\n2FA or MFA relies on the user presenting at least two pieces of evidence\n(factors) to an authentication system: something only the user knows and\nsomething only the user has.\n\nIf this tool is run to generate TOTP values on the same desktop/laptop\ndevice that you are using to log into a website, then you should\nconsider that if your desktop/laptop device is compromised, then both\nauthentication factors can be compromised. The attacker can steal the\nfirst authentication factor that only you should know (e.g., password)\nby running a key logger on the compromised device. The attacker can also\nsteal the second authentication factor that only you should have (e.g.,\nTOTP secret key) because it would be read by this tool on the same\ncompromised device; if this tool can read the TOTP secret key on the\ncompromised device, so can the attacker.\n\nIn other words, for higher security, it is good to generate TOTP values\non a separate device. However, if the inconvenience of getting a\nseparate device prevents you from using 2FA or MFA altogether, then you\nmight find this tool helpful. It allows to trade off some security for\nconvenience which is still more secure than not having 2FA or MFA at\nall. Whether trading some security for convenience is acceptable to you\nor not is something you need to decide for yourself.\n\n\nAlternative: OATH Toolkit\n-------------------------\n\nThere is an `oathtool` command available in OATH Toolkit that can also\ngenerate TOTP values from TOTP secret keys. This section presents some\nexamples that show how `oathtool` can be used to do what MinTOTP does.\n\n 1. Install OATH Toolkit:\n\n    ```shell\n    # On macOS\n    brew install oath-toolkit\n\n    # On Debian, Ubuntu, etc.\n    apt-get update\n    apt-get install oathtool\n    ```\n\n 2. Generate TOTP from a Base32 key:\n\n    ```shell\n    oathtool --totp -b - \u003c\u003c\u003c ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS\n    ```\n\n 3. Generate TOTP from an encrypted Base32 key:\n\n    ```shell\n    gpg -q -o - secret.gpg | oathtool --totp -b -\n    ```\n\n    Section [Encrypt Base32 Key With GPG](#encrypt-base32-key-with-gpg)\n    explains how to create the encrypted key (`secret.gpg`) with GPG.\n\n 4. Generate TOTP from a QR code:\n\n    ```shell\n    zbarimg -q secret1.png | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | oathtool --totp -b -\n    ```\n\n 5. Generate TOTP from an encrypted QR code:\n\n    ```shell\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | oathtool --totp -b -\n    ```\n\n    Section [Encrypt QR Code With GPG](#encrypt-qr-code-with-gpg) explains\n    how to create the encrypted QR code (`secret1.png.gpg`) with GPG.\n\n 6. Generate TOTP value and copy it to system clipboard:\n\n    ```shell\n    # On macOS\n    gpg -q -o - secret.gpg | oathtool --totp -b - | tr -d '\\n' | pbcopy\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | oathtool --totp -b - | tr -d '\\n' | pbcopy\n\n    # On Linux\n    gpg -q -o - secret.gpg | oathtool --totp -b - | tr -d '\\n' | xclip\n    zbarimg -q \u003c(gpg -q -o - secret1.png.gpg) | sed 's/.*secret=\\([^\u0026]*\\).*/\\1/' | oathtool --totp -b - | tr -d '\\n' | xclip\n    ```\n\n\nResources\n---------\n\nHere is a list of useful links about this project:\n\n  - [Documentation](https://github.com/susam/mintotp#readme)\n  - [Latest release][pypi]\n  - [Changelog](https://github.com/susam/mintotp/blob/main/CHANGES.md)\n  - [Issue tracker](https://github.com/susam/mintotp/issues)\n  - [Source code](https://github.com/susam/mintotp)\n\n[pypi]: https://pypi.org/project/mintotp/\n\n\nLicense\n-------\n\nThis is free and open source software. You can use, copy, modify,\nmerge, publish, distribute, sublicense, and/or sell copies of it,\nunder the terms of the MIT License. See [LICENSE.md][L] for details.\n\nThis software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nexpress or implied. See [LICENSE.md][L] for details.\n\n[L]: LICENSE.md\n\n\nSupport\n-------\n\nTo report bugs, suggest improvements, or ask questions, please create a\nnew issue at \u003chttp://github.com/susam/mintotp/issues\u003e.\n\n\nThanks\n------\n\nThanks to [Prateek Nischal][PN] for getting me involved with TOTP. I\nreferred to his TOTP implementation at\n[prateeknischal/qry/util/totp.py][PNTOTP] while writing my own.\n\n[PN]: https://github.com/prateeknischal\n[PNTOTP]: https://github.com/prateeknischal/qry/blob/master/util/totp.py\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusam%2Fmintotp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsusam%2Fmintotp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusam%2Fmintotp/lists"}