pub struct MeshGenesis {
pub mesh_name: String,
pub created_at_ms: u64,
pub policy: MembershipPolicy,
/* private fields */
}Expand description
Genesis event for creating a new mesh
Contains all the cryptographic material needed to bootstrap a mesh. The creator should securely store this for recovery purposes.
Fields§
§mesh_name: StringHuman-readable mesh name
created_at_ms: u64Timestamp of creation (milliseconds since Unix epoch)
policy: MembershipPolicyMembership policy for this mesh
Implementations§
Source§impl MeshGenesis
impl MeshGenesis
Sourcepub fn create(
mesh_name: &str,
creator: &DeviceIdentity,
policy: MembershipPolicy,
) -> Self
pub fn create( mesh_name: &str, creator: &DeviceIdentity, policy: MembershipPolicy, ) -> Self
Sourcepub fn with_seed(
mesh_name: &str,
seed: [u8; 32],
creator: &DeviceIdentity,
policy: MembershipPolicy,
) -> Self
pub fn with_seed( mesh_name: &str, seed: [u8; 32], creator: &DeviceIdentity, policy: MembershipPolicy, ) -> Self
Create genesis with a specific seed (for testing or deterministic creation)
§Safety
Only use with cryptographically random seeds in production.
Sourcepub fn mesh_id(&self) -> String
pub fn mesh_id(&self) -> String
Derive the mesh_id from name and seed
The mesh_id is 8 hex characters derived from BLAKE3 keyed hash. Format: uppercase hex, e.g., “A1B2C3D4”
Sourcepub fn encryption_secret(&self) -> [u8; 32]
pub fn encryption_secret(&self) -> [u8; 32]
Derive the mesh-wide encryption secret
Uses BLAKE3 key derivation with a specific context.
Sourcepub fn beacon_key_base(&self) -> [u8; 32]
pub fn beacon_key_base(&self) -> [u8; 32]
Derive the base key for encrypted beacons
Beacon keys are rotated, but this is the base from which they’re derived.
Sourcepub fn mesh_seed(&self) -> &[u8; 32]
pub fn mesh_seed(&self) -> &[u8; 32]
Get the mesh seed for secure storage
Security: This is the root secret. Protect it carefully.
Sourcepub fn creator(&self) -> &DeviceIdentity
pub fn creator(&self) -> &DeviceIdentity
Get the creator’s identity
Sourcepub fn creator_public_key(&self) -> [u8; 32]
pub fn creator_public_key(&self) -> [u8; 32]
Get the creator’s public key
Sourcepub fn is_creator(&self, identity: &DeviceIdentity) -> bool
pub fn is_creator(&self, identity: &DeviceIdentity) -> bool
Check if a given identity is the mesh creator
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encode genesis data for persistence
Format:
- mesh_name length (2 bytes, LE)
- mesh_name (variable)
- mesh_seed (32 bytes)
- creator public key (32 bytes)
- creator private key (32 bytes) - SENSITIVE!
- created_at_ms (8 bytes, LE)
- policy (1 byte)
Total: 107 + mesh_name.len() bytes
Trait Implementations§
Source§impl Clone for MeshGenesis
impl Clone for MeshGenesis
Source§fn clone(&self) -> MeshGenesis
fn clone(&self) -> MeshGenesis
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more