March Docs

Handshake

Handshake: the net-kernel greeting + authentication decision.

When two nodes connect, each sends a Hello { its identity, a fresh nonce }. Each then replies with a proof = ClusterAuth.prove(secret, peer_nonce). A node accepts the peer iff the peer's proof matches the nonce it issued — so only holders of the cluster secret join, and a proof can't be replayed for a different nonce. This module is the pure protocol logic; the socket I/O (framing via NetFrame, send/recv) lives in the net-kernel on top.

Types

typeHelloHello = { identity : NodeIdentity.Identity, nonce : String }#

Functions

fnauthenticateauthenticate(secret : String, our_nonce : String, peer : Hello,#
fndecode_hellodecode_hello(bytes : List(Int)) : Result(Hello, String)#
fnencode_helloencode_hello(h : Hello) : List(Int)#
fnmake_hellomake_hello(identity : NodeIdentity.Identity, nonce : String) : Hello#