mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 07:18:47 +00:00
Verify Nostr snapshot retrieval
This commit is contained in:
@@ -32,6 +32,7 @@ from password_manager.entry_management import EntryManager
|
|||||||
from nostr.client import NostrClient
|
from nostr.client import NostrClient
|
||||||
from utils.fingerprint import generate_fingerprint
|
from utils.fingerprint import generate_fingerprint
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import gzip
|
||||||
|
|
||||||
DEFAULT_PASSWORD = "testpassword"
|
DEFAULT_PASSWORD = "testpassword"
|
||||||
|
|
||||||
@@ -143,6 +144,21 @@ def main() -> None:
|
|||||||
)
|
)
|
||||||
asyncio.run(client.publish_snapshot(encrypted))
|
asyncio.run(client.publish_snapshot(encrypted))
|
||||||
print("[+] Data synchronized to Nostr.")
|
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:
|
else:
|
||||||
print("[-] No encrypted index found to sync.")
|
print("[-] No encrypted index found to sync.")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user