Skip to main content

create_node

Function create_node 

Source
pub fn create_node(config: NodeConfig) -> Result<Arc<PeatNode>, PeatError>
Expand description

Create a new PeatNode with FormationKey authentication

Requires app_id and shared_key for peer authentication. Only peers with matching credentials can connect and sync.

§Arguments

  • config - Node configuration including:
    • app_id: Formation/application identifier (use same value for all nodes in your swarm)
    • shared_key: Base64-encoded 32-byte secret key (generate with openssl rand -base64 32)
    • bind_address: Optional address to bind (default: “0.0.0.0:0”)
    • storage_path: Directory for persistent storage

Note: This function is NOT async because we manage our own Tokio runtime to ensure proper context for Iroh transport operations.