Skip to main content

otpa

PyPI version CI

Convert between plain otpauth:// links and Google Authenticator otpauth-migration://offline?data=... export links.

Inspired by dim13/otpauth.

Install

pipx install otpa
# or
pip install otpa

CLI

# -> otpauth-migration:// link(s)
otpa cm "otpauth-migration://offline?data=..." "otpauth://totp/ACME:alice?secret=JBSWY3DPEHPK3PXP&issuer=ACME"
otpa cm -f otpauth-links.txt             # read links from a file
otpa cm -f otpauth-links.txt -n 5        # same as --batch-size 5 (cm only)
otpa cm -f a.txt -f b.txt link1 link2    # -f may repeat, combined with positional links

# -> otpauth:// links
otpa ca "otpauth-migration://offline?data=..." ["otpauth-migration://..." ...]
otpa ca -f migration-links.txt

# interactively resolve accounts sharing the same secret/issuer
otpa cm -d "otpauth-migration://offline?data=..." ...
otpa ca -d "otpauth-migration://offline?data=..." ...

# open each output link as a QR code in your browser instead of printing them
otpa cm --qr "otpauth://totp/ACME:alice?secret=JBSWY3DPEHPK3PXP&issuer=ACME"
otpa ca --qr "otpauth-migration://offline?data=..."

# inspect either kind of link
otpa i "otpauth-migration://offline?data=..."
otpa i "otpauth://totp/Example?secret=JBSWY3DPEHPK3PXP"

-f/--file reads one link per line; blank lines and # comments are ignored.

Example

$ otpa ca "otpauth-migration://offline?data=CjEKCkhlbGxvId6tvu8SGEV4YW1wbGU6YWxpY2VAZ29vZ2xlLmNvbRoHRXhhbXBsZTAC"
otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example&period=30

Library

from otpa import migration

# Expand a migration batch into otpauth:// links.
urls = migration.migration_to_otpauth("otpauth-migration://offline?data=...")

# Bundle otpauth:// links into one or more migration links
# (split across links when count > batch_size, default 10).
links = migration.otpauth_to_migration([
    "otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example",
], batch_size=10)

# Lower-level access to the decoded protobuf payload.
payload = migration.migration_link_to_payload("otpauth-migration://offline?data=...")
for op in payload.otp_parameters:
    print(op.name, op.issuer, migration.encode_secret(op.secret))

Download files

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

Source Distribution

otpa-0.0.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

otpa-0.0.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file otpa-0.0.1.tar.gz.

File metadata

  • Download URL: otpa-0.0.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for otpa-0.0.1.tar.gz
Algorithm Hash digest
SHA256 953d63da19f5e877f27038c006851d65c0d9c3aee22e309d3d3ce16dda5b533c
MD5 389c6ca44fcbf3d74eab1a473b8d5774
BLAKE2b-256 fcddbc97441a0f92db8d2e444ec063a3b98ec70af8e7b6d568dbfd7a8c2c39e6

See more details on using hashes here.

File details

Details for the file otpa-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: otpa-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for otpa-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3efb56367cd230cb63853b143bb56557fc0b2df5848f548e8cd2a7dbd6dcbd9
MD5 ad13582f8a75fec549666180c137a8f6
BLAKE2b-256 f7c18a86a399d62b7aa73504e76ce38be9d3b9c36a61f41bb6af68d29ecaed50

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