mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-04-29 14:35:57 +02:00
668ce16dc7
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
52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
import base64
|
|
|
|
from cryptography.hazmat.primitives import hashes
|
|
from cryptography.hazmat.primitives.asymmetric import ec, ed25519
|
|
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
|
|
|
|
from services.mesh.mesh_crypto import build_signature_payload, verify_signature
|
|
|
|
|
|
def test_ed25519_signature_roundtrip():
|
|
key = ed25519.Ed25519PrivateKey.generate()
|
|
pub_raw = key.public_key().public_bytes(Encoding.Raw, PublicFormat.Raw)
|
|
public_key_b64 = base64.b64encode(pub_raw).decode("utf-8")
|
|
|
|
payload = {"message": "hello", "destination": "broadcast", "channel": "LongFast"}
|
|
sig_payload = build_signature_payload(
|
|
event_type="message",
|
|
node_id="!sb_test",
|
|
sequence=1,
|
|
payload=payload,
|
|
)
|
|
signature = key.sign(sig_payload.encode("utf-8")).hex()
|
|
|
|
assert verify_signature(
|
|
public_key_b64=public_key_b64,
|
|
public_key_algo="Ed25519",
|
|
signature_hex=signature,
|
|
payload=sig_payload,
|
|
)
|
|
|
|
|
|
def test_ecdsa_signature_roundtrip():
|
|
key = ec.generate_private_key(ec.SECP256R1())
|
|
pub_raw = key.public_key().public_bytes(Encoding.X962, PublicFormat.UncompressedPoint)
|
|
public_key_b64 = base64.b64encode(pub_raw).decode("utf-8")
|
|
|
|
payload = {"target_id": "!sb_abc12345", "vote": 1, "gate": ""}
|
|
sig_payload = build_signature_payload(
|
|
event_type="vote",
|
|
node_id="!sb_test",
|
|
sequence=5,
|
|
payload=payload,
|
|
)
|
|
signature = key.sign(sig_payload.encode("utf-8"), ec.ECDSA(hashes.SHA256())).hex()
|
|
|
|
assert verify_signature(
|
|
public_key_b64=public_key_b64,
|
|
public_key_algo="ECDSA_P256",
|
|
signature_hex=signature,
|
|
payload=sig_payload,
|
|
)
|