wallet: optional seed-offset passphrase on import
Monero's `restore_deterministic_wallet` takes a `seed_offset`: a second spend secret mixed into the 25 words at restore time, so the same words with a different offset open a different wallet. It is not the wallet-file passphrase and must never be sealed, stored, logged or put on an argv. - `Wallet::restore_wallet` gains `seed_offset: Option<&str>`: None, empty or whitespace-only leaves the field out of the JSON entirely; otherwise the ends are trimmed and it is sent beside the seed. - `Node::wallet_restore` passes it through and still seals only the file passphrase. - SDK: `import_wallet` keeps its signature (None) and `import_wallet_with_offset` is added (Kotlin `importWalletWithOffset`). - TUI: a new `ImportOffset` step between the seed and the file passphrase (blank Enter skips, a real one is confirmed, a mismatch never dials), and `ImportOffsetSeen` after a successful import that used one -- Esc cannot leave it, only SEEN, and the offset is not drawn anywhere. - Docs: WALLET.md, THREAT_MODEL.md, TUI.md, one README sentence.
This commit is contained in:
parent
6d815b0fe8
commit
f6a7daf892
9 changed files with 623 additions and 34 deletions
|
|
@ -764,9 +764,43 @@ impl Wire {
|
|||
/// Import a wallet from an existing 25-word seed. This is the only path
|
||||
/// that takes a user-supplied secret. Like a create, the core records the
|
||||
/// imported wallet in its catalogue.
|
||||
///
|
||||
/// This is the plain import: the request carries no seed offset. Use
|
||||
/// [`Wire::import_wallet_with_offset`] when the words were mixed with a
|
||||
/// seed-offset passphrase.
|
||||
pub async fn import_wallet(&self, password: String, seed: String) -> WResult<()> {
|
||||
self.node()?
|
||||
.wallet_restore(&password, &seed)
|
||||
.wallet_restore(&password, &seed, None)
|
||||
.await
|
||||
.map_err(WireError::new)
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
/// Import a wallet from an existing 25-word seed plus its optional seed
|
||||
/// offset passphrase (`restore_deterministic_wallet`'s `seed_offset`).
|
||||
///
|
||||
/// The offset is **not** the wallet-file passphrase: it is a second spend
|
||||
/// secret mixed into the seed at restore time, so the same words with a
|
||||
/// different offset open a different wallet. It is never logged, never
|
||||
/// stored and never sealed, and a wrong offset does not fail — the RPC
|
||||
/// succeeds and the wallet is simply a different one.
|
||||
///
|
||||
/// Blank or whitespace-only `seed_offset` behaves exactly like
|
||||
/// [`Wire::import_wallet`]: the request carries no `seed_offset` field.
|
||||
pub async fn import_wallet_with_offset(
|
||||
&self,
|
||||
password: String,
|
||||
seed: String,
|
||||
seed_offset: String,
|
||||
) -> WResult<()> {
|
||||
let offset = seed_offset.trim();
|
||||
let offset = if offset.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(offset)
|
||||
};
|
||||
self.node()?
|
||||
.wallet_restore(&password, &seed, offset)
|
||||
.await
|
||||
.map_err(WireError::new)
|
||||
.map(|_| ())
|
||||
|
|
|
|||
Loading…
Reference in a new issue