android: optional seed-offset passphrase on wallet import #157
Merged
sirius
merged 1 commit from 2026-09-26 00:55:02 +00:00
onionwire/t_a6258883-onionwire-android-seed-offset-field-on-w into onionwire/t_dc9b74a6-onionwire-wallet-optional-seed-offset-pa 2026-09-25
android: optional seed-offset passphrase on wallet import
All checks were successful
android-ci / android (pull_request) Successful in 12m44s
The Rust core grew `import_wallet_with_offset` (t_dc9b74a6); this is the phone half. Import gets one more optional field, and an import that used a real offset gets a blocking card instead of the create-seed warning. Import card: `offset passphrase (optional)`, masked with `PasswordVisualTransformation`, plus a re-type. The helper is visible text, not a placeholder — it has to still be on screen while the user types, because a wrong offset does not fail: it opens a different wallet. A blank or whitespace offset takes the existing `importWallet(password, seed)` path unchanged. A non-empty one requires the re-type before any RPC; on a mismatch both offset fields are cleared and the card says `offset passphrases do not match`. On a match the call is `importWalletWithOffset(password, seed, offset)` — the UniFFI name for `import_wallet_with_offset`, checked against the generated binding. The offset is never logged, never put in an error string, never copied, and dies with the import card. The offset is not sealed and never stored, so an offset import is not an ordinary import that is already backed up: a later "Back up seed" returns the derived mnemonic, which opens this wallet only without the offset. `WireViewModel.importWallet` therefore leaves the seed flag alone for that path and sets `walletOffsetPending` instead — a new key in the existing `SEED_BACKUP_PREFS` prefs (`offset_pending`, not `backed_up`), so a process kill before the acknowledgement still shows the card. The card's own SEEN (same `SeedBackupGate.CONFIRM_WORD`, no second word) clears pending and marks the import backed up; a wrong word changes neither flag and cannot un-confirm a confirmed wallet. Both decisions live in `SeedBackupGate` as pure Kotlin: `card()` is now the one place that says which blocking card the screen is under, `receiveAddressVisible` takes `offsetPending` and so hides the address for an unacknowledged offset the same way it hides it for an unwritten seed, `offsetPendingAfterImport` is the blank-means-no rule, and `offsetAck` is the confirm step. The create-seed warning string is untouched, and the offset card carries its own text — the seed card's words are the wrong fact here.