mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-17 03:29:23 +00:00
Handle decryption failures when syncing index
This commit is contained in:
@@ -1103,8 +1103,10 @@ class PasswordManager:
|
||||
encrypted = deltas[-1]
|
||||
current = self.vault.get_encrypted_index()
|
||||
if current != encrypted:
|
||||
self.vault.decrypt_and_save_index_from_nostr(encrypted)
|
||||
logger.info("Local database synchronized from Nostr.")
|
||||
if self.vault.decrypt_and_save_index_from_nostr(
|
||||
encrypted, strict=False
|
||||
):
|
||||
logger.info("Local database synchronized from Nostr.")
|
||||
except Exception as e:
|
||||
logger.warning(f"Unable to sync index from Nostr: {e}")
|
||||
finally:
|
||||
@@ -1195,14 +1197,12 @@ class PasswordManager:
|
||||
deltas = asyncio.run(self.nostr_client.fetch_deltas_since(version))
|
||||
if deltas:
|
||||
encrypted = deltas[-1]
|
||||
try:
|
||||
self.vault.decrypt_and_save_index_from_nostr(encrypted)
|
||||
success = self.vault.decrypt_and_save_index_from_nostr(
|
||||
encrypted, strict=False
|
||||
)
|
||||
if success:
|
||||
logger.info("Initialized local database from Nostr.")
|
||||
have_data = True
|
||||
except Exception as err:
|
||||
logger.warning(
|
||||
f"Failed to decrypt Nostr data: {err}; treating as new account."
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(f"Unable to sync index from Nostr: {e}")
|
||||
|
||||
|
Reference in New Issue
Block a user