android: optional seed-offset passphrase on wallet import #157

Owner

Android half of the optional seed-offset passphrase. Core parent: #156 (import_wallet_with_offset). This PR is based on that branch, not on main.

Import card

  • New optional field offset passphrase (optional), PasswordVisualTransformation, plus re-type offset passphrase. One quiet outlined field and its re-type under the seed; the existing wallet-file passphrase field is untouched.
  • Helper is visible text (bodySmall / onSurfaceVariant), not a placeholder: Not the wallet file passphrase. Leave blank if this seed has none. A wrong offset does not fail — it opens a different wallet.
  • Blank or whitespace offset -> the existing importWallet(password, seed). Same success path as before.
  • Non-empty offset -> the re-type must match before any RPC. Mismatch clears both offset fields and shows offset passphrases do not match on the card.
  • Match -> importWalletWithOffset(password, seed, offset), the UniFFI name for import_wallet_with_offset, confirmed against the generated binding (sdk/build/generated/uniffi/uniffi/onionwire_sdk/onionwire_sdk.kt:1778 and :2499).
  • The offset is never logged, never put in an error string, never copied, and is dropped when the card closes.

Offset was not saved

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 does not call setWalletSeedConfirmed(...Imported) on the offset path. It sets a new pending flag instead.
  • Persisted under a new key in the existing SEED_BACKUP_PREFS: offset_pending, not backed_up. Not a store column, not SDK state. A process kill before the acknowledgement still shows the card.
  • Blocking card, no secret on it: this offset was not saved. write it down. a later seed backup is a different 25 words that open this wallet without the offset.
  • Confirm word is SeedBackupGate.CONFIRM_WORD (SEEN), case-insensitive. No second word. Before it, the card is the whole body and Done is dead.
  • After SEEN: clear pending, then mark the seed confirmed as an import. A wrong word changes neither flag and cannot un-confirm a confirmed wallet.
  • Until the acknowledgement, the receive address is hidden — through SeedBackupGate.receiveAddressVisible(..., offsetPending), not a remember flag.
  • The create-seed warning string is unchanged. The offset card carries its own text (OFFSET_WARNING), because the create-seed words are the wrong fact here.

Decisions in SeedBackupGate (pure Kotlin)

  • card(confirmed, walletReadable, offsetPending) is now the single place that says which blocking card the screen is under (None / UnbackedSeed / OffsetNotSaved).
  • receiveAddressVisible(...) takes offsetPending and delegates to card(...).
  • offsetPendingAfterImport(offset) is the blank-means-no rule.
  • offsetAck(typed, pending, confirmed) is the confirm step, returning both flags — null stays null, so nothing is written for an install that never stored a value.

Visual

One quiet outlined field plus its re-type, no new filled button. The card's Done is an OutlinedButton, deliberately quieter than the seed card's filled Done — the card is the block, not the button. Import stays the existing Import action; no restyle of the screen.

Verify

android-ci.yml does not run Kotlin unit tests, so a green Android check is not evidence.

$ export ANDROID_HOME=~/Android/Sdk CARGO_TARGET_DIR=~/.cache/ow-target-t_a6258883
$ ./gradlew --no-daemon :app:testDebugUnitTest --tests '*SeedBackupGateTest*' --rerun
> Task :app:testDebugUnitTest
BUILD SUCCESSFUL in 8s
43 actionable tasks: 3 executed, 40 up-to-date
suite: com.siriusdevops.onionwire.ui.SeedBackupGateTest tests=24 failures=0 errors=0 skipped=0

24/24, including the seven new cases: only_a_real_offset_leaves_an_acknowledgement_pending, an_unacknowledged_offset_hides_the_receive_address, a_pending_offset_is_the_card_the_screen_is_under, the_right_word_clears_the_pending_flag_and_backs_the_import_up, a_wrong_word_changes_neither_flag, the_offset_card_does_not_reuse_the_seed_warnings_words, plus the untouched create/import cases. (The full run also cross-compiled the SDK for arm64-v8a and generated the bindings: cargoBuildAndroid + uniffiBindgen + verifyDynamicLibc all green.)

Not verified on a device. No release cut.

Android half of the optional seed-offset passphrase. Core parent: #156 (`import_wallet_with_offset`). This PR is based on that branch, not on `main`. ## Import card - New optional field `offset passphrase (optional)`, `PasswordVisualTransformation`, plus `re-type offset passphrase`. One quiet outlined field and its re-type under the seed; the existing wallet-file passphrase field is untouched. - Helper is visible text (`bodySmall` / `onSurfaceVariant`), not a placeholder: `Not the wallet file passphrase. Leave blank if this seed has none. A wrong offset does not fail — it opens a different wallet.` - Blank or whitespace offset -> the existing `importWallet(password, seed)`. Same success path as before. - Non-empty offset -> the re-type must match before any RPC. Mismatch clears both offset fields and shows `offset passphrases do not match` on the card. - Match -> `importWalletWithOffset(password, seed, offset)`, the UniFFI name for `import_wallet_with_offset`, confirmed against the generated binding (`sdk/build/generated/uniffi/uniffi/onionwire_sdk/onionwire_sdk.kt:1778` and `:2499`). - The offset is never logged, never put in an error string, never copied, and is dropped when the card closes. ## Offset was not saved 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` does not call `setWalletSeedConfirmed(...Imported)` on the offset path. It sets a new pending flag instead. - Persisted under a new key in the existing `SEED_BACKUP_PREFS`: `offset_pending`, not `backed_up`. Not a store column, not SDK state. A process kill before the acknowledgement still shows the card. - Blocking card, no secret on it: `this offset was not saved. write it down. a later seed backup is a different 25 words that open this wallet without the offset.` - Confirm word is `SeedBackupGate.CONFIRM_WORD` (`SEEN`), case-insensitive. No second word. Before it, the card is the whole body and Done is dead. - After `SEEN`: clear pending, then mark the seed confirmed as an import. A wrong word changes neither flag and cannot un-confirm a confirmed wallet. - Until the acknowledgement, the receive address is hidden — through `SeedBackupGate.receiveAddressVisible(..., offsetPending)`, not a `remember` flag. - The create-seed warning string is unchanged. The offset card carries its own text (`OFFSET_WARNING`), because the create-seed words are the wrong fact here. ## Decisions in `SeedBackupGate` (pure Kotlin) - `card(confirmed, walletReadable, offsetPending)` is now the single place that says which blocking card the screen is under (`None` / `UnbackedSeed` / `OffsetNotSaved`). - `receiveAddressVisible(...)` takes `offsetPending` and delegates to `card(...)`. - `offsetPendingAfterImport(offset)` is the blank-means-no rule. - `offsetAck(typed, pending, confirmed)` is the confirm step, returning both flags — `null` stays `null`, so nothing is written for an install that never stored a value. ## Visual One quiet outlined field plus its re-type, no new filled button. The card's Done is an `OutlinedButton`, deliberately quieter than the seed card's filled `Done` — the card is the block, not the button. Import stays the existing Import action; no restyle of the screen. ## Verify `android-ci.yml` does not run Kotlin unit tests, so a green Android check is not evidence. ``` $ export ANDROID_HOME=~/Android/Sdk CARGO_TARGET_DIR=~/.cache/ow-target-t_a6258883 $ ./gradlew --no-daemon :app:testDebugUnitTest --tests '*SeedBackupGateTest*' --rerun > Task :app:testDebugUnitTest BUILD SUCCESSFUL in 8s 43 actionable tasks: 3 executed, 40 up-to-date ``` ``` suite: com.siriusdevops.onionwire.ui.SeedBackupGateTest tests=24 failures=0 errors=0 skipped=0 ``` 24/24, including the seven new cases: `only_a_real_offset_leaves_an_acknowledgement_pending`, `an_unacknowledged_offset_hides_the_receive_address`, `a_pending_offset_is_the_card_the_screen_is_under`, `the_right_word_clears_the_pending_flag_and_backs_the_import_up`, `a_wrong_word_changes_neither_flag`, `the_offset_card_does_not_reuse_the_seed_warnings_words`, plus the untouched create/import cases. (The full run also cross-compiled the SDK for `arm64-v8a` and generated the bindings: `cargoBuildAndroid` + `uniffiBindgen` + `verifyDynamicLibc` all green.) Not verified on a device. No release cut.
android: optional seed-offset passphrase on wallet import
All checks were successful
android-ci / android (pull_request) Successful in 12m44s
cd09139e77
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.
sirius merged commit 24d9e43c1c into onionwire/t_dc9b74a6-onionwire-wallet-optional-seed-offset-pa 2026-09-26 00:55:02 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!157
No description provided.