mcl_core_lan_token (mcl_core v1.0.0)
View SourceThe LAN entry point's token (docs/DESIGN.md §4.2, mcl-core#4).
A token names a member's node id and role, when it was issued and when it expires (15 minutes later). It is sealed with HMAC-SHA256 under the cluster-wide token key, which every node derives from the gossip secret with HKDF-SHA256 (RFC 5869, no salt, info mcl-lan token v1). Any node verifies a token any other node issued, and no new secret is handed out.
The holder of the gossip secret can forge tokens; that holder already owns the cluster through the cookie (design §2.1), so it adds no harm.
On the wire a token is base64url without padding over <<Version:8, NodeId:32/binary, Role:8, IssuedMs:64, ExpiresMs:64, Mac:32/binary>>, the times in system milliseconds. Pure: the caller passes the time and the key.
Summary
Functions
HKDF-SHA256 with no salt (a hash-long run of zeros, RFC 5869 §2.2), one output block: 32 bytes.
The cluster's token key, derived from its gossip secret.
How long a token lives.
A token for NodeId in Role, issued at NowMs.
The claims of a token sealed under Key and not expired at NowMs; anything else is refused, never raised on.
Types
Functions
HKDF-SHA256 with no salt (a hash-long run of zeros, RFC 5869 §2.2), one output block: 32 bytes.
-spec key(binary()) -> <<_:256>>.
The cluster's token key, derived from its gossip secret.
-spec lifetime_ms() -> pos_integer().
How long a token lives.
A token for NodeId in Role, issued at NowMs.
The claims of a token sealed under Key and not expired at NowMs; anything else is refused, never raised on.