sdk: expose the wallet catalogue, the open wallet's keys, and the self profile
Some checks failed
ci / test (pull_request) Successful in 5m59s
ci / sdk (pull_request) Successful in 1m35s
android-ci / android (pull_request) Successful in 12m42s
ci / fuzz (pull_request) Has been cancelled

The Android wallet/profile screens had nothing to call: the core could list
wallets, switch the child onto one, read its keys and read/write the self
profile, but none of it crossed UniFFI.

Core:
- Wallet::keys() -> WalletKeys { view_key, spend_key: Option<String> }: two
  query_key calls against the file the RPC has open. A view-only wallet's -29
  is spend_key: None, not an error. WalletKeys' Debug redacts both halves.
- Node::wallet_keys() mirrors wallet_create/wallet_seed; refuses locally when
  no wallet is configured.
- Node::active_wallet_filename() -> Option<String>: the file the child is
  pointed at, None until wallet-child settings exist, so a client can mark the
  open row.

SDK (UniFFI):
- records WalletRow / WalletKeys / SelfProfile, and Wire::{wallets,
  open_wallet, active_wallet_filename, wallet_keys, self_profile,
  set_self_profile, push_self_profile}.
- The rule the clients must express is in the docs: the seed and the private
  keys come from the OPEN wallet, so there is deliberately no accessor that
  reads another saved wallet's secrets without opening it.

docs/WALLET.md (catalogue + 'secrets belong to the open wallet'),
docs/THREAT_MODEL.md (the new on-demand-display exposure surface) and the SDK
README are updated in the same commit.
This commit is contained in:
sirius 2026-09-22 00:25:33 -04:00
commit 5f19a56be3
No known key found for this signature in database
7 changed files with 784 additions and 3 deletions

View file

@ -203,6 +203,36 @@ launches the node *and* the wallet child. `wallet_status()` carries
Monero ships **no Android binaries**. Any vendored blob's provenance doc must
say so. Cross-compiled is not device-proven. See `android/MONERO_BINARIES.md`.
### The wallet catalogue, and which wallet is open
`wallets()` lists every wallet this install remembers (oldest first), each row
carrying the `wallet_filename` the child opens, its label, the owning identity
pubkey as hex, and the locator. `active_wallet_filename()` returns the file the
child is **currently pointed at** (or `None` on a fresh install), so a picker can
mark the open row. `open_wallet(filename)` switches to a catalogue row: a
running child is stopped and restarted onto the new file, an idle one is only
re-pointed (the change applies at the next `start_wallet_child`), and a file the
catalogue does not hold is refused — the catalogue is the only directory this app
keeps wallets in.
## Secrets belong to the open wallet
The seed (`wallet_seed()`, `query_key mnemonic`) and the private keys
(`wallet_keys()` → `query_key view_key` / `query_key spend_key`) are answered by
the wallet file the child has **open**, so they always belong to the row
`active_wallet_filename()` names. There is deliberately no accessor that reads
another saved wallet's seed or keys without opening it: show a backups screen,
then `open_wallet(...)` the row — the UI must say *which* wallet it is showing.
`WalletKeys.spend_key` is `None` for a view-only wallet (the RPC's `-29`), which
is an answer, not an error.
Both values are spend secrets. They are displayable on demand in the TUI and in
the Android app, are never logged, never written to the store or to disk, and
never put into an error string (the core's `WalletKeys` `Debug` redacts them).
The exposure this creates is enumerated in
[THREAT_MODEL.md](THREAT_MODEL.md), "The recovery phrase and the private keys
are displayable on demand".
## Create vs import
`/wallet create` (`F6` then `c`) → `create_wallet`, then seed **once**
@ -263,6 +293,8 @@ Restore from a height at or before the first incoming transaction.
| Profile `xmr_addr` fallback when RPC is down | works | works |
| `/tip <xmr>` (`transfer`) | **cannot work** | works |
| OnionWire copies your spend key into its own process | never | never (it stays in the wallet file / RPC) |
| Show the backup (seed via `query_key mnemonic`) | **no seed to show** (the RPC answers `-29`) | works |
| Show the private keys (`wallet_keys`) | view key only, `spend_key` is `None` | view + spend key |
`ONIONWIRE_WALLET_NO_SPEND=1` refuses `/tip` before RPC with: