Skip to main content

Module social_peers

Module social_peers 

Source
Expand description

SocialWebNet peer store.

Where an accepted connection’s peering material lands. Once a connection offer has been mutually authenticated (see handshake.rs) and the peering payload exchanged (see connection_identifier.rs), the resulting SocialPeer — the counterpart’s DID plus the WireGuard public key and overlay address needed to reach them on the SocialWebNet mesh — is recorded here.

The store is deliberately thin and additive: pure list-manipulation helpers (upsert, find) carry the logic and are unit-tested in isolation, while the *_peer functions layer a small pretty-JSON persistence step on top (a Vec<SocialPeer> at app_meta_dir()/social_peers.json).

Structs§

SocialPeer
An accepted peer on the SocialWebNet mesh.

Functions§

find
Find the peer with the given did, if present.
list_peers
Load every stored peer. Returns vec![] if the store file is absent or unreadable.
register_peer
Register (insert-or-update) a peer, then persist the store.
remove_peer
Remove the peer with the given did from the store, then persist.
resolve_envelope_keys
Resolve dids to (did, envelope_pubkey_hex) pairs from peers — the parties whose envelope key is known. Parties without a published key (or not peered) are simply omitted (the caller learns which keys are still missing by comparing lengths). Pure; unit-tested.
set_peer_active
Set the active flag on the peer with the given did, then persist.
set_peer_endpoint
Set (or clear) the peer’s last-known transport endpoint (host:port), then persist. Empty endpoint clears it. Errors if no such peer.
set_peer_envelope_key
Set the peer’s envelope (X25519) public key (hex), then persist. Errors if no such peer.
upsert
Insert or update peer in peers, keyed by SocialPeer::did.