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

# mise
mise use -g pipx:otpa

# pipx
pipx install otpa

# pip
pip install otpa

CLI

# -> otpauth-migration:// link(s)
otpa cm "otpauth-migration://offline?data=..."
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=..."
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://totp/Example?secret=JBSWY3DPEHPK3PXP"
otpa i "otpauth-migration://offline?data=..."

-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.
otpauth_links = 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).
migration_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))

Metadata

Release files for otpa 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for otpa 0.0.3
File Size Uploaded Provenance Actions
otpa-0.0.3.tar.gz 13.4 kB Without provenance Details for otpa-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for otpa 0.0.3
File Interpreter ABI Platform Actions
otpa-0.0.3-py3-none-any.whl Python 3 none any Details for otpa-0.0.3-py3-none-any.whl

Total release size: 28.6 kB

Release files / otpa-0.0.3.tar.gz

Download URL otpa-0.0.3.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
13278a2d1aa714fd60e33e1008d465a58f0a66241fae4d3e81e03e4527c280d6
BLAKE2b-256 checksum
How to use checksums
ae4a211bc3412789d86f9717f3e9b881e554c73e6de211aa5e51edce8012f5ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / otpa-0.0.3-py3-none-any.whl

Download URL otpa-0.0.3-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4180215a076b19a22b1bb2331757867a9ae3a2dbaaa6f96d9bd4cf6a666396c
BLAKE2b-256 checksum
How to use checksums
39d9c9d6d7e544f33b757778099e6da1687a6d4cd054b9dab6d4b70b74092457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for otpa 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page