sdk: expose the wallet catalogue, the open wallet's keys, and the self profile
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:
parent
a9117b8991
commit
5f19a56be3
7 changed files with 784 additions and 3 deletions
|
|
@ -104,6 +104,24 @@ val msgs: List<ChatMessage> = wire.messages(friend.pubkeyHex)
|
|||
// 5. Locator rotation. Do NOT wire this to a single tap — the app that embeds
|
||||
// the SDK owns the typed confirmation.
|
||||
val out: RotateOutcome = wire.rotateOnion() // out.notified / out.friends
|
||||
|
||||
// 6. Saved wallets, and which one is open.
|
||||
val wallets: List<WalletRow> = wire.wallets() // a store read: never dials
|
||||
val active: String? = wire.activeWalletFilename() // the open file, or null
|
||||
val open = wallets.firstOrNull { it.walletFilename == active }
|
||||
wire.openWallet("onionwire-2") // may restart a running wallet child; a name
|
||||
// outside the catalogue is refused
|
||||
val keys: WalletKeys = wire.walletKeys() // the OPEN wallet's private keys
|
||||
// keys.spendKey == null -> a view-only wallet (the RPC's -29 watch-only answer).
|
||||
// That is not an error. The seed (`walletSeed()`) and these keys always belong
|
||||
// to `activeWalletFilename()`: to show another wallet's backup, open it first.
|
||||
// Both are spend secrets — show them from an explicit user action only, never
|
||||
// log them, never persist them.
|
||||
|
||||
// 7. Your own profile (nickname, bio, Monero address).
|
||||
val me: SelfProfile = wire.selfProfile()
|
||||
wire.setSelfProfile("ada", "on the wire", "4AdUnd...") // validated on write
|
||||
wire.pushSelfProfile(friend.pubkeyHex) // signed `prf`, one-shot and fail-closed
|
||||
```
|
||||
|
||||
All peer references are lowercase hex strings so nothing Rust-shaped leaks into
|
||||
|
|
|
|||
Loading…
Reference in a new issue