Invites carried no trust level, and both accept_invite and the peer-joined handler hardcoded TrustLevel::Trusted — so 'Invite a Peer' (Observer) federated both sides as fully Trusted. - invite codes now carry a 'trust' field (legacy codes parse as Trusted) - federation.invite accepts trust_level: trusted|observer - accept_invite assigns the invite's level on the acceptor side - peer-joined resolves the granted level authoritatively by matching the acceptor's echoed invite token against our stored outgoing invites; the peer's own unsigned claim is honored only as a downgrade, so no escalation is possible - discovery/connection-request approvals mint Observer invites directly (the post-hoc demotion in handshake.rs stays as a legacy safety net) - asymmetry self-heal re-asserts at the locally-held level Tests: observer threading + legacy default-trusted parse. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
28 lines
1.2 KiB
Rust
28 lines
1.2 KiB
Rust
//! Node federation: trusted multi-node clusters with state sync.
|
|
//!
|
|
//! Nodes federate by exchanging invite codes containing DID + onion address.
|
|
//! Trust is bilateral — both sides must agree. Federated nodes periodically
|
|
//! sync container status, health metrics, and availability.
|
|
|
|
mod invites;
|
|
pub mod pending;
|
|
mod storage;
|
|
mod sync;
|
|
mod types;
|
|
|
|
// Re-export all public items so `crate::federation::*` continues to work.
|
|
pub use invites::{accept_invite, create_invite, parse_invite};
|
|
// Crate-internal: used by the periodic federation auto-sync to re-assert
|
|
// membership to peers that don't list us back (asymmetry self-heal).
|
|
pub(crate) use invites::notify_join;
|
|
// Crate-internal: peer-joined resolves the granted trust level by matching
|
|
// the acceptor's invite_token against our stored outgoing invites.
|
|
pub(crate) use storage::load_invites;
|
|
#[allow(unused_imports)]
|
|
pub use storage::{
|
|
add_node, fips_npub_for_onion, load_nodes, load_removed_dids, record_peer_transport,
|
|
remove_node, save_nodes, set_trust_level, update_node,
|
|
};
|
|
pub use sync::{build_local_state, deploy_to_peer, sync_with_peer, sync_with_peer_by_did};
|
|
pub use types::{AppStatus, FederatedNode, NodeStateSnapshot, TrustLevel};
|