wallet: create/import in-app (no key paste on create) + opt-in spend
/ wallet create generates a wallet on the RPC and shows the 25-word seed once for backup; /wallet import is the only path that takes an existing seed, and it is collected on a dedicated screen so it never reaches the composer line or chat history. Threat model now states the real policy: payments are opt-in, default is no spend key, spend is a local authority at create/restore, and the chain source is the user's choice (spawned local monerod or a daemon address they supply). WALLET.md and README follow. Tests: canned-RPC create/restore, slash parse, help overlay.
This commit is contained in:
parent
7ad3679b51
commit
cf0a517cd2
12 changed files with 758 additions and 48 deletions
23
src/node.rs
23
src/node.rs
|
|
@ -684,6 +684,29 @@ impl Node {
|
|||
Ok(rows.into_iter().take(cap).collect())
|
||||
}
|
||||
|
||||
/// Create a new spend-capable wallet. Returns the seed once for backup.
|
||||
/// The user never pastes a key on this path.
|
||||
pub async fn wallet_create(&self, password: &str) -> Result<String, String> {
|
||||
if !self.wallet.configured() {
|
||||
return Err("wallet not connected — set ONIONWIRE_WALLET_RPC".into());
|
||||
}
|
||||
self.wallet
|
||||
.create_wallet(wallet::DEFAULT_WALLET_FILENAME, password)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Import a wallet from an existing 25-word seed. This is the only path
|
||||
/// that takes a user-supplied secret.
|
||||
pub async fn wallet_restore(&self, password: &str, seed: &str) -> Result<(), String> {
|
||||
if !self.wallet.configured() {
|
||||
return Err("wallet not connected — set ONIONWIRE_WALLET_RPC".into());
|
||||
}
|
||||
self.wallet
|
||||
.restore_wallet(wallet::DEFAULT_WALLET_FILENAME, password, seed)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
async fn send_once(&self, friend_pk: &[u8], plaintext: &[u8]) -> Result<(), String> {
|
||||
self.ensure_running()?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue