store: a wallet catalogue in the encrypted db
Wallets were only ever a file in $ONIONWIRE_HOME/wallet plus the single-row wallet_child config for the one the child is currently pointed at, so a created wallet was not remembered and a second create had nowhere to go. Add a 'wallets' table (id, name, identity_pubkey, onion_locator, wallet_filename, created_at) and CRUD on Store: create_wallet, get_wallet_by_id, list_wallets, delete_wallet. wallet_filename is UNIQUE so a second wallet cannot silently reuse the first one's file, and identity_pubkey is deliberately not unique (identity is the roster key, a wallet is a file; the locator may rotate or be empty). No new crate: the store is already rusqlite + SQLCipher with a raw PRAGMA key, and sqlx has no SQLCipher path, so a second pool would be a second unencrypted way in. Tests: 5 store cases in tests/store.rs (round-trip, coexistence across a reopen, duplicate filename, delete, blank label/filename) plus the at_rest upgrade case in src/store.rs.
This commit is contained in:
parent
3769bd9a42
commit
467510f096
3 changed files with 309 additions and 2 deletions
|
|
@ -20,6 +20,6 @@ pub mod wallet;
|
|||
pub mod wallet_child;
|
||||
|
||||
pub use store::{
|
||||
Friend, FriendProfile, Message, Payment, PaymentWrite, SelfIdentity, Store,
|
||||
resolve_store_passphrase,
|
||||
Friend, FriendProfile, Message, NewWallet, Payment, PaymentWrite, SelfIdentity, Store,
|
||||
WalletRecord, resolve_store_passphrase,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue