android: saved-wallets screen (list, select, back up the open wallet) #147

Merged
sirius merged 1 commit from onionwire/t_cf7e07f9-android-saved-wallets-screen-list-select into main 2026-09-22 12:09:18 +00:00
Owner

The app could hold several wallets and show none of them. This adds the screen that lists the store's catalogue, marks the one the wallet child has open, switches to another on a tap, and — for the open one only — shows its recovery phrase and private keys.

What the screen decides

Everything secret here belongs to the file the child currently has open: query_key is answered by that file and no other, so the seed card and the keys card hang off active_wallet_filename(), not off a row. On a row that is not the open one both actions are dead and say why (open this wallet to view its backup) instead of opening it under the user — switching wallets is a deliberate tap, because open_wallet stops and restarts a running child.

  • Phrase: the wallet screen's own SeedBackupCard, widened from private to internal rather than copied, so the gate constants are still the one SeedBackupGate (WARNING, CONFIRM_WORD, confirmEnabled) and their values are untouched.
  • Keys: the view key always, the spend key when there is one. A view-only wallet says view-only wallet — no spend key in words, because spend_key == null is the wallet's own answer and not a failure. Both values are read on an explicit tap, never logged, never persisted, never in a testTag/contentDescription/saved state, and dropped on dispose.
  • List: re-read on entry and on Refresh, never cached from app start, so a wallet created after the screen was first opened appears without a restart. No saved wallets yet (empty catalogue) and could not read the wallet catalogue + the core's text (read failure) are rendered as the two different states they are.
  • Select: a tap calls open_wallet(filename), then reloads, so the in use marker moves. The core's refusal is shown verbatim.

Files

  • new ui/WalletManagerScreen.kt (584 lines) — screen + the pure rules it renders from
  • new test/.../ui/WalletManagerTest.kt (153 lines, 17 cases)
  • ui/WalletScreen.kt — Wallets action in the existing TopAppBar, new onOpenWallets parameter, SeedBackupCard private → internal (3 changes, 14 lines)
  • WireViewModel.kt — wallets(), activeWalletFilename(), openWallet(filename), walletKeys(), all Result-returning in the file's existing style
  • MainActivity.kt — the wallets route and the WalletScreen wiring

No dependency added; build.gradle.kts untouched. The roster's action row is untouched.

Verified

  • ./gradlew :app:testDebugUnitTest --tests '*WalletManagerTest*' --rerun → BUILD SUCCESSFUL, 17 tests / 0 failures / 0 errors (TEST-com.siriusdevops.onionwire.ui.WalletManagerTest.xml). Run with the x86_64 slice, which is what the emulator needs.
  • :app:assembleDebug and :app:assembleRelease both green with -Ponionwire.abis=x86_64.
  • On device (AVD ow35, x86_64, API 35, emulator-5560): the Wallets action on the wallet screen's app bar opens the screen, which renders Saved wallets with Refresh and Back; an empty catalogue renders No saved wallets yet with its own way back; Create or import a wallet returns to the wallet screen. uiautomator dumps are in the task card.

Not verified on device

The list-with-rows / select / phrase / keys paths could not be exercised on the emulator: the wallet child needs monero-wallet-rpc, this repo ships it arm64-v8a only (android/MONERO_BINARIES.md: "-Ponionwire.abis=x86_64 produces an APK with no wallet binary in it"), and every AVD here is x86_64. With no binary the child cannot start, wallet_create/wallet_restore both refuse with wallet not configured — open F7 to set it up, or set ONIONWIRE_WALLET_RPC, and the catalogue therefore cannot be given a row from the device. So: no row, no select, and no secret read against a running wallet child were exercised; the list path that was exercised is the real empty-catalogue read.

The app could hold several wallets and show none of them. This adds the screen that lists the store's catalogue, marks the one the wallet child has open, switches to another on a tap, and — for the open one only — shows its recovery phrase and private keys. ## What the screen decides Everything secret here belongs to the file the child currently has **open**: `query_key` is answered by that file and no other, so the seed card and the keys card hang off `active_wallet_filename()`, not off a row. On a row that is not the open one both actions are dead and say why (`open this wallet to view its backup`) instead of opening it under the user — switching wallets is a deliberate tap, because `open_wallet` stops and restarts a running child. - **Phrase**: the wallet screen's own `SeedBackupCard`, widened from `private` to `internal` rather than copied, so the gate constants are still the one `SeedBackupGate` (`WARNING`, `CONFIRM_WORD`, `confirmEnabled`) and their values are untouched. - **Keys**: the view key always, the spend key when there is one. A view-only wallet says `view-only wallet — no spend key` in words, because `spend_key == null` is the wallet's own answer and not a failure. Both values are read on an explicit tap, never logged, never persisted, never in a `testTag`/`contentDescription`/saved state, and dropped on dispose. - **List**: re-read on entry and on Refresh, never cached from app start, so a wallet created after the screen was first opened appears without a restart. `No saved wallets yet` (empty catalogue) and `could not read the wallet catalogue` + the core's text (read failure) are rendered as the two different states they are. - **Select**: a tap calls `open_wallet(filename)`, then reloads, so the `in use` marker moves. The core's refusal is shown verbatim. ## Files - new `ui/WalletManagerScreen.kt` (584 lines) — screen + the pure rules it renders from - new `test/.../ui/WalletManagerTest.kt` (153 lines, 17 cases) - `ui/WalletScreen.kt` — `Wallets` action in the existing `TopAppBar`, new `onOpenWallets` parameter, `SeedBackupCard` `private` → `internal` (3 changes, 14 lines) - `WireViewModel.kt` — `wallets()`, `activeWalletFilename()`, `openWallet(filename)`, `walletKeys()`, all `Result`-returning in the file's existing style - `MainActivity.kt` — the `wallets` route and the `WalletScreen` wiring No dependency added; `build.gradle.kts` untouched. The roster's action row is untouched. ## Verified - `./gradlew :app:testDebugUnitTest --tests '*WalletManagerTest*' --rerun` → `BUILD SUCCESSFUL`, 17 tests / 0 failures / 0 errors (`TEST-com.siriusdevops.onionwire.ui.WalletManagerTest.xml`). Run with the x86_64 slice, which is what the emulator needs. - `:app:assembleDebug` and `:app:assembleRelease` both green with `-Ponionwire.abis=x86_64`. - On device (AVD `ow35`, x86_64, API 35, `emulator-5560`): the `Wallets` action on the wallet screen's app bar opens the screen, which renders `Saved wallets` with `Refresh` and `Back`; an empty catalogue renders `No saved wallets yet` with its own way back; `Create or import a wallet` returns to the wallet screen. `uiautomator` dumps are in the task card. ## Not verified on device The **list-with-rows / select / phrase / keys** paths could not be exercised on the emulator: the wallet child needs `monero-wallet-rpc`, this repo ships it **arm64-v8a only** (`android/MONERO_BINARIES.md`: "`-Ponionwire.abis=x86_64` produces an APK with no wallet binary in it"), and every AVD here is x86_64. With no binary the child cannot start, `wallet_create`/`wallet_restore` both refuse with `wallet not configured — open F7 to set it up, or set ONIONWIRE_WALLET_RPC`, and the catalogue therefore cannot be given a row from the device. So: no row, no select, and no secret read against a running wallet child were exercised; the list path that *was* exercised is the real empty-catalogue read.
android: saved-wallets screen (list, select, back up the open wallet)
All checks were successful
android-ci / android (pull_request) Successful in 10m37s
812c259f46
The app could hold several wallets and show none of them. Add the screen
that lists the store's catalogue, marks the one the wallet child has open,
switches to another on a tap, and — for the open one only — shows its
recovery phrase and private keys.

Everything secret here belongs to the file the child currently has open:
`query_key` is answered by that file and no other, so the seed card and the
keys card hang off `active_wallet_filename()`, not off a row. On a row that
is not the open one both actions are dead and say why ("open this wallet to
view its backup") instead of opening it under the user — switching wallets
is a deliberate tap, because `open_wallet` stops and restarts a running
child.

The phrase keeps the existing treatment: the wallet screen's own
`SeedBackupCard`, widened from `private` to `internal` rather than copied,
so the gate constants are still the one `SeedBackupGate`. The keys card
shows the view key always and the spend key when there is one; a view-only
wallet says "view-only wallet — no spend key" in words, because `null` is
the wallet's own answer and not a failure. Neither value is logged,
persisted, tagged, or held in saved state, and both are dropped on dispose.

The catalogue is re-read on entry and on Refresh, never cached from app
start, so a wallet created on the wallet screen after this one was first
opened shows up without restarting the app. An empty catalogue ("No saved
wallets yet") and a read failure ("could not read the wallet catalogue" +
the core's text) are rendered as the two different states they are.

The gate is pure Kotlin in the new file and `WalletManagerTest` covers it on
the JVM (17 cases): the row label's name/blank/whitespace fallback, which
child states count as readable, and whether the secret actions are offered
for a row.
sirius merged commit 460a5afb12 into main 2026-09-22 12:09:18 +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!147
No description provided.