From 57e7cf30040958ca43082296183621165cf0a65f Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 6 Jul 2025 16:56:54 -0400 Subject: [PATCH] Verify Nostr snapshot retrieval --- scripts/generate_test_profile.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/generate_test_profile.py b/scripts/generate_test_profile.py index 1f5212b..736bd62 100644 --- a/scripts/generate_test_profile.py +++ b/scripts/generate_test_profile.py @@ -32,6 +32,7 @@ from password_manager.entry_management import EntryManager from nostr.client import NostrClient from utils.fingerprint import generate_fingerprint import asyncio +import gzip DEFAULT_PASSWORD = "testpassword" @@ -143,6 +144,21 @@ def main() -> None: ) asyncio.run(client.publish_snapshot(encrypted)) print("[+] Data synchronized to Nostr.") + try: + result = asyncio.run(client.fetch_latest_snapshot()) + if result: + _, chunks = result + retrieved = gzip.decompress(b"".join(chunks)) + if retrieved == encrypted: + print("[+] Verified snapshot retrieval.") + else: + print( + f"[!] Retrieval failed: {client.last_error or 'data mismatch'}" + ) + else: + print(f"[!] Retrieval failed: {client.last_error or 'data mismatch'}") + except Exception as e: + print(f"[!] Retrieval failed: {e}") else: print("[-] No encrypted index found to sync.")