otpa
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.0.tar.gz
(13.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
otpa-0.0.0-py3-none-any.whl
(15.1 kB
view details)
File details
Details for the file otpa-0.0.0.tar.gz.
File metadata
- Download URL: otpa-0.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7ec2798c410d2a22b7275da8c7f5a33884435b5bb4de0c3e2b08b0e5f14f6f7
|
|
| MD5 |
ce82affd70990fb3250ae8af0d318ae2
|
|
| BLAKE2b-256 |
39c50a2e0d55648ecf972016af1f0fb77f4225395796c9023e5dfecec76b7260
|
File details
Details for the file otpa-0.0.0-py3-none-any.whl.
File metadata
- Download URL: otpa-0.0.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88fc95a7824c9d44ab1fa3049a7ff9ba36c3b153b319b6e605e09b96d09de7af
|
|
| MD5 |
fa2f3145062a26d1e4fc6e5f16d5e224
|
|
| BLAKE2b-256 |
54d5e8d4c4506e7389645e87248729cc4c39d507e0ef623eb8abbad2c5e368de
|