feat(import): import Google Authenticator via otpauth-migration URIs#674
Merged
Conversation
The previous --google-authenticator flow relied on gauth.py extracting the app's SQLite database, which requires root on the device. Google Authenticator's actual export path is the "Export accounts" feature, which produces QR codes encoding otpauth-migration:// URIs. Add a native importer (src/importers/google_authenticator.rs) that reads a file of one or more otpauth-migration:// URIs, base64-decodes the data payload and decodes the MigrationPayload protobuf with prost (hand-declared message structs, no protoc build step), mapping each entry to an OTPElement. Route --google-authenticator to it and update the help text and README accordingly. Also document the Conventional Commits convention and semantic-release versioning in CLAUDE.md.
replydev
force-pushed
the
fix/import-from-google-authenticator
branch
from
July 22, 2026 18:50
f18bbac to
e82ac01
Compare
Rust 1.97 clippy flags a useless_borrows_in_formatting lint in interface/app.rs; remove the redundant references so `cargo clippy -D warnings` (the CI gate, which tracks latest stable) passes. Also document in CLAUDE.md that clippy must be run exactly as CI does before finishing any work.
Pin the toolchain in rust-toolchain.toml (channel 1.97.1 + rustfmt/clippy)
so local and CI builds are coherent, and bump every dependency to its latest
release via `cargo upgrade --incompatible`.
The RustCrypto bumps (hmac 0.13, sha1/sha2 0.11, aes-gcm 0.11,
chacha20poly1305 0.11, scrypt 0.12, md-5 0.11) carry breaking API changes,
migrated here:
- generic-array is replaced by hybrid-array; build Key/Nonce values with
new_from_slice / TryFrom / From instead of GenericArray::{from,clone_from}_slice.
- hmac 0.13 collapses the HMAC generic bounds to a single `D: EagerHash`,
removing the CoreProxy/BlockSizeUser/IsLess<U256> machinery in the HOTP and
Yandex generators; hotp_hash now returns an owned Vec<u8>.
- scrypt 0.12 Params::new drops the output-length argument.
The on-disk formats are unchanged (same Argon2id + XChaCha20Poly1305 envelope
and AES-GCM Aegis handling); verified a database written by the previous
crypto stack still decrypts and generates correct codes.
|
🎉 This PR is included in version 1.10.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
--google-authenticatorimport relied onconverters/gauth.pyextracting the app's SQLite database (/data/data/com.google.android.apps.authenticator2/databases/databases), which requires root on the device. Those README/--helpinstructions are outdated — Google Authenticator's real export path is the "Export accounts" feature, which generates QR codes encodingotpauth-migration://offline?data=<base64 protobuf>URIs.Closes the request to import from the migration URI / exported QR codes.
Changes
src/importers/google_authenticator.rs:otpauth-migration://URIs (one per exported QR code, whitespace/newline separated).datapayload and decodes Google'sMigrationPayloadprotobuf using a small, dependency-free in-crate protobuf reader (varints + length-delimited fields, fully bounds-checked — nounsafe, no new crates; reuses existingbase64/data-encoding).OTPElement: raw secret →BASE32_NOPAD, algorithm (SHA1/256/512/MD5), digit count (6/8), TOTP/HOTP type, HOTP counter.--google-authenticatorto the new importer and refresh its help text.CLAUDE.md.Scope note
URI text is accepted directly (extract it from the QR with any scanner). In-app QR image decoding was intentionally left out to avoid pulling in heavy image-decoding dependencies.
converters/gauth.pyis left in place for rooted users who still prefer SQLite extraction.Testing
cargo test --locked(debug + release),cargo clippy -D warnings,cargo fmt --check.cotpbinary, confirming the account listed and generated a live code.