Files
Shadowbroker/backend/scripts/repair_wormhole_secure_storage.py
anoracleofra-code 668ce16dc7 v0.9.6: InfoNet hashchain, Wormhole gate encryption, mesh reputation, 16 community contributors
Gate messages now propagate via the Infonet hashchain as encrypted blobs — every node syncs them
through normal chain sync while only Gate members with MLS keys can decrypt. Added mesh reputation
system, peer push workers, voluntary Wormhole opt-in for node participation, fork recovery,
killwormhole scripts, obfuscated terminology, and hardened the self-updater to protect encryption
keys and chain state during updates.

New features: Shodan search, train tracking, Sentinel Hub imagery, 8 new intelligence layers,
CCTV expansion to 11,000+ cameras across 6 countries, Mesh Terminal CLI, prediction markets,
desktop-shell scaffold, and comprehensive mesh test suite (215 frontend + backend tests passing).

Community contributors: @wa1id, @AlborzNazari, @adust09, @Xpirix, @imqdcr, @csysp, @suranyami,
@chr0n1x, @johan-martensson, @singularfailure, @smithbh, @OrfeoTerkuci, @deuza, @tm-const,
@Elhard1, @ttulttul
2026-03-26 05:58:04 -06:00

49 lines
1.7 KiB
Python

from __future__ import annotations
import json
from pathlib import Path
from services.mesh import mesh_secure_storage
from services.mesh.mesh_wormhole_contacts import CONTACTS_FILE
from services.mesh.mesh_wormhole_identity import IDENTITY_FILE, _default_identity
from services.mesh.mesh_wormhole_persona import PERSONA_FILE, _default_state as _default_persona_state
from services.mesh.mesh_wormhole_ratchet import STATE_FILE as RATCHET_FILE
def _load_payloads() -> dict[Path, object]:
return {
IDENTITY_FILE: mesh_secure_storage.read_secure_json(IDENTITY_FILE, _default_identity),
PERSONA_FILE: mesh_secure_storage.read_secure_json(PERSONA_FILE, _default_persona_state),
RATCHET_FILE: mesh_secure_storage.read_secure_json(RATCHET_FILE, lambda: {}),
CONTACTS_FILE: mesh_secure_storage.read_secure_json(CONTACTS_FILE, lambda: {}),
}
def main() -> None:
payloads = _load_payloads()
master_key_file = mesh_secure_storage.MASTER_KEY_FILE
backup_key_file = master_key_file.with_suffix(master_key_file.suffix + ".bak")
if master_key_file.exists():
if backup_key_file.exists():
backup_key_file.unlink()
master_key_file.replace(backup_key_file)
for path, payload in payloads.items():
mesh_secure_storage.write_secure_json(path, payload)
print(
json.dumps(
{
"ok": True,
"rewrapped": [str(path.name) for path in payloads.keys()],
"master_key": str(master_key_file),
"backup_master_key": str(backup_key_file) if backup_key_file.exists() else "",
}
)
)
if __name__ == "__main__":
main()