pub struct HiveMeshConfig {
pub node_id: NodeId,
pub callsign: String,
pub mesh_id: String,
pub peripheral_type: PeripheralType,
pub peer_config: PeerManagerConfig,
pub sync_interval_ms: u64,
pub auto_broadcast_events: bool,
pub encryption_secret: Option<[u8; 32]>,
pub strict_encryption: bool,
}Expand description
Configuration for HiveMesh
Fields§
§node_id: NodeIdOur node ID
callsign: StringOur callsign (e.g., “ALPHA-1”)
mesh_id: StringMesh ID to filter peers (e.g., “DEMO”)
peripheral_type: PeripheralTypePeripheral type for this device
peer_config: PeerManagerConfigPeer management configuration
sync_interval_ms: u64Sync interval in milliseconds (how often to broadcast state)
auto_broadcast_events: boolWhether to auto-broadcast on emergency/ack
encryption_secret: Option<[u8; 32]>Optional shared secret for mesh-wide encryption (32 bytes)
When set, all documents are encrypted using ChaCha20-Poly1305 before transmission and decrypted upon receipt. All nodes in the mesh must share the same secret to communicate.
strict_encryption: boolStrict encryption mode - reject unencrypted documents when encryption is enabled
When true and encryption is enabled, any unencrypted documents received will be rejected and trigger a SecurityViolation event. This prevents downgrade attacks where an adversary sends unencrypted malicious documents.
Default: false (backward compatible - accepts unencrypted for gradual rollout)
Implementations§
Source§impl HiveMeshConfig
impl HiveMeshConfig
Sourcepub fn new(node_id: NodeId, callsign: &str, mesh_id: &str) -> Self
pub fn new(node_id: NodeId, callsign: &str, mesh_id: &str) -> Self
Create a new configuration with required fields
Sourcepub fn with_encryption(self, secret: [u8; 32]) -> Self
pub fn with_encryption(self, secret: [u8; 32]) -> Self
Enable mesh-wide encryption with a shared secret
All documents will be encrypted using ChaCha20-Poly1305 before transmission. All mesh participants must use the same secret.
Sourcepub fn with_peripheral_type(self, ptype: PeripheralType) -> Self
pub fn with_peripheral_type(self, ptype: PeripheralType) -> Self
Set peripheral type
Sourcepub fn with_sync_interval(self, interval_ms: u64) -> Self
pub fn with_sync_interval(self, interval_ms: u64) -> Self
Set sync interval
Sourcepub fn with_peer_timeout(self, timeout_ms: u64) -> Self
pub fn with_peer_timeout(self, timeout_ms: u64) -> Self
Set peer timeout
Sourcepub fn with_max_peers(self, max: usize) -> Self
pub fn with_max_peers(self, max: usize) -> Self
Set max peers (for embedded systems)
Sourcepub fn with_strict_encryption(self) -> Self
pub fn with_strict_encryption(self) -> Self
Enable strict encryption mode
When enabled (and encryption is also enabled), any unencrypted documents
received will be rejected and trigger a SecurityViolation event.
This prevents downgrade attacks.
Note: This only has effect when encryption is enabled via with_encryption().
Trait Implementations§
Source§impl Clone for HiveMeshConfig
impl Clone for HiveMeshConfig
Source§fn clone(&self) -> HiveMeshConfig
fn clone(&self) -> HiveMeshConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more