android: block the wallet screen on an unbacked seed, and let it be re-shown #139
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_9b2544a7-wallet-screen-block-on-an-unbacked-seed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Make the seed backup impossible to miss on Android, and make it recoverable afterwards.
A created wallet's seed was two lines of small text at the bottom of the wallet page, dismissed by one tap, gone for good once the screen was left. A real user created a wallet, never saw the seed, and the app had no way to show it again.
Changes
ui/SeedBackupGate.kt(new) — the gate as pure Kotlin: the confirm word isSEEN, matched case-insensitively and trimmed, mirroringsrc/tui.rsWalletSetup::CreateSeed(eq_ignore_ascii_case("SEEN")) rather than inventing a second word. Create starts unbacked, import is backed up without the gate, and only a correct word can confirm — a wrong word can never un-confirm.ui/WalletScreen.kt— the seed card is the whole body of the screen until the word is typed and Done is tapped: no Cancel, and Done is dead until the word matches. No copy button, on purpose: the Android clipboard is readable by every other app (and by clipboard history on 13+), which would hand the spend key to whoever asks for it next.Back up seedre-reads the seed through the parent card'sWire::wallet_seed()(WireViewModel.walletSeed()), so a seed missed the first time is not lost. The strip carries the button while the seed is unconfirmed, the actions row carries it afterwards, so exactly one is ever on screen. A failed read is shown next to the button rather than at the bottom of a long scroll.Show QRare hidden: XMR received into a wallet whose 25 words were never written down is unrecoverable.WireViewModel.kt— the flag lives in app-local prefs (wallet_seed_backup, a plain boolean; not the Keystore-wrapped store, which holds the passphrase only).createWalletresets it to unbacked itself, so no caller can forget.importWalletmarks backed up.Decisions a reviewer should see
falsemeans this install created a wallet and nobody has confirmed the seed, so the strip is up whether or not the balance reads.nullmeans nothing is stored — an install that predates the flag, or one that has never created a wallet here — and there the strip waits forwallet_balanceto return a real amount, the core's own evidence that the child has a wallet open. Without that distinction, a first-run user who had configured a chain source but not yet created a wallet would be warned about a seed they do not have:wallet_balancereturns"err"for a configured chain whose child has no wallet open, and the daemon card's Save is enough to reach that state.Backstill leaves the screen. That is the TUI'sEsc, and it costs nothing now: leaving no longer loses the seed. The wallet stays unbacked — strip up, address hidden — untilBack up seedputs the card back on screen. The card itself is what cannot be dismissed: it has no Cancel and its Done is dead untilSEEN.String, so it cannot be wiped in place the way the TUI'sZeroizing<String>is. Dropping the reference is the strongest thing available; it is never persisted and never logged.Scope
Only the four files the card allows. No
build.gradle.ktschange, no new dependency, nothing undersrc/,crates/,android/sdk/,docs/or.forgejo/.Base
main. This started stacked on #138 (wallet: expose an on-demand seed accessor over core + UniFFI), because:appcould not compile againstwalletSeed()until that landed; #138 is now merged (94d29b8), and this branch has been rebased ontomain, so the diff is the four files below and nothing else.Verification
cd android && ./gradlew :app:testDebugUnitTest— 135 tests, 0 failures (SeedBackupGateTest: 18), run with-x :sdk:cargoBuildAndroid -x :sdk:cargoHostLib -x :sdk:uniffiBindgen -x :sdk:verifyDynamicLibcafter:sdk:uniffiBindgenhad generated the Kotlin for this branch.android-ci.ymlmatchesandroid/**, so this PR builds the debug-signed APK + AAR; the run URL is in the task thread.3431a9eda93bcbe3556c3bcbe3556c118191c541