Merge pull request #328 from PR0M3TH3AN/codex/sync-data-to-nostr-after-adding-100-entries

Add Nostr sync to test profile script
This commit is contained in:
thePR0M3TH3AN
2025-07-06 16:24:14 -04:00
committed by GitHub
2 changed files with 16 additions and 0 deletions

View File

@@ -364,6 +364,8 @@ python scripts/generate_test_profile.py --profile my_profile --count 100
``` ```
This command creates `~/.seedpass/my_profile` if needed and adds 100 example entries. This command creates `~/.seedpass/my_profile` if needed and adds 100 example entries.
After populating the vault, the script now automatically publishes the encrypted
index to Nostr so the data can be retrieved on other devices.
### Automatically Updating the Script Checksum ### Automatically Updating the Script Checksum

View File

@@ -29,6 +29,8 @@ from password_manager.vault import Vault
from password_manager.config_manager import ConfigManager from password_manager.config_manager import ConfigManager
from password_manager.backup import BackupManager from password_manager.backup import BackupManager
from password_manager.entry_management import EntryManager from password_manager.entry_management import EntryManager
from nostr.client import NostrClient
import asyncio
DEFAULT_PASSWORD = "testpassword" DEFAULT_PASSWORD = "testpassword"
@@ -128,6 +130,18 @@ def main() -> None:
populate(entry_mgr, seed, args.count) populate(entry_mgr, seed, args.count)
print(f"Added {args.count} entries.") print(f"Added {args.count} entries.")
encrypted = entry_mgr.vault.get_encrypted_index()
if encrypted:
client = NostrClient(
entry_mgr.vault.encryption_manager,
dir_path.name,
parent_seed=seed,
)
asyncio.run(client.publish_snapshot(encrypted))
print("[+] Data synchronized to Nostr.")
else:
print("[-] No encrypted index found to sync.")
if __name__ == "__main__": if __name__ == "__main__":
main() main()