From ec355dd236cf664405007310dee61fe84dc0f13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Wed, 6 Apr 2022 17:01:05 +0200 Subject: [PATCH] wallet: add try_decrypt_all --- nym-wallet/src-tauri/src/wallet_storage/account_data.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nym-wallet/src-tauri/src/wallet_storage/account_data.rs b/nym-wallet/src-tauri/src/wallet_storage/account_data.rs index 79daa7e111..dddb114cbb 100644 --- a/nym-wallet/src-tauri/src/wallet_storage/account_data.rs +++ b/nym-wallet/src-tauri/src/wallet_storage/account_data.rs @@ -99,6 +99,14 @@ impl StoredWallet { pub fn password_can_decrypt_all(&self, password: &UserPassword) -> bool { self.decrypt_all(password).is_ok() } + + pub fn try_decrypt_all(&self, password: &UserPassword) -> Vec { + self + .accounts + .iter() + .filter_map(|account| account.account.decrypt_struct(password).ok()) + .collect() + } } impl Default for StoredWallet {