Networking & sealed channels
A node speaks HTTP and nothing else: one listener (--listen) serves clients,
peers and the operator. There is no gossip, no peer discovery and no
peer-to-peer stream protocol. Nodes learn each other’s URLs from the system
group’s nodes table, seeded from --peers at bootstrap and extended through
POST /ops/nodes.
Why seal on top of HTTP
Section titled “Why seal on top of HTTP”Whatever TLS sits in front of a node ends outside the TD: at a load balancer, a reverse proxy, wherever the operator points it. Everything that crosses that hop — bearer tokens, call arguments, results — would be readable there, however genuine the node’s quote. So clients do not trust the transport. They encrypt each request to a key the node’s attestation binds, and only the attested process can open it.
The sealed channel
Section titled “The sealed channel”calimero-sealed implements it (wire format v2, byte-compatible with mero-js’s
src/sealed/).
- Transport key. At start the node makes an X25519 key. It lives only in
the process’s memory and is never written anywhere, so a restart replaces it.
GET /attestationreturns its public half and binds it into the quote’s report data. - Handshake.
POST /sealed/handshakeruns NoiseNK_25519_AESGCM_SHA256with prologuecalimero/sealed-http/v2: the client knows the node’s static key in advance (from the quote), and both sides’ ephemeral keys make the session keys. The reply carries a session id and its lifetime. - Exchange. The client wraps a whole HTTP request — method, path, headers
(the bearer token among them), body — seals it under the session’s request
key and posts it to
/sealed. Each request carries an id its session accepts once. The node opens it, routes the inner request through the same router a direct request takes, and streams the response back as sealed frames (a head, body frames, an end frame), so server-sent events are sealed too and a truncated response is detected. - Earlier paths. Releases up to 1.0.0-rc.24 served the two at
/sealed/v2/handshakeand/sealed/v2, and 1.0.0-rc.25 to 1.0.0-rc.29 served those too, deprecated. A node no longer does, and a client no longer tries them: a client or peer reaches nodes of 1.0.0-rc.25 and later, and a client that still posts to/sealed/v2gets404(or403 sealed_requiredfrom a node that seals everything). Thev2named no wire format; the version byte does, and it is still0x02.
| Property | Value |
|---|---|
| Session lifetime | 1 hour, however busy (the forward-secrecy window); a client renews a minute before |
| Idle session kept | 10 minutes |
| Sessions held | 16 384 anonymous and 4096 identified (peers), apart; past that, the least useful session is dropped and its client opens another |
| Handshakes | 100 a second (burst 200) anonymous, 50 (burst 100) identified |
| Replay window | 4096 request ids per session; ids below the window are refused too |
| Largest sealed request | 64 MiB; 256 MiB of sealed bodies in flight per node |
| Response frame | at most 64 KiB of data |
The handshake and one request
Section titled “The handshake and one request”On the wire (calimero-sealed’s module documentation, byte-compatible with
mero-js src/sealed/):
handshake Noise_NK_25519_AESGCM_SHA256, prologue "calimero/sealed-http/v2" request POST /sealed/handshake 0x02 || transport_pk || Noise message 1 response 0x02 || Noise message 2 (payload = session_id(16) || lifetime secs, u32 BE)identified 0x03 instead of 0x02, Noise_IK_25519_AESGCM_SHA256 (peers only)exchange POST /sealed (content type application/vnd.calimero.sealed) header 0x02 || session_id(16) || request_id (u64 BE; from 1, each used once) request header || AES-256-GCM(req key, nonce = request_id || 0u32, aad = header, inner) response frames: u32 BE length || AES-256-GCM(resp key, nonce = request_id || index, aad = header, kind || data) inner u32 BE head length || head (JSON) || bodyThe transport_pk the client puts in the handshake is the key it attested; a
node whose key has changed refuses it as stale_transport_key.
A proxy in the middle sees opaque POSTs. It cannot read a request or a
response, forge or reorder a frame, or replay a request. When a node restarts,
its old transport key is gone; the client gets stale_transport_key, attests
the new key and opens a new session. WebSocket upgrades cannot cross the
envelope and are refused inside it.
What is served in the clear
Section titled “What is served in the clear”Only GET /attestation and GET /health ({ ok, node, systemLeader, release, clusterVersion, rollbackEpoch }) answer outside the envelope; with sealed_required (every non---dev node)
any other unsealed request is refused. Two outer layers sit in front of the
envelope:
- App frontends. With
--apps-domain, a request whose host is a package’s label under that domain is answered from the package’s signed frontend and never reaches a node route (Packages & frontends). - The consent page.
GET /consent/{id}and its/model,/approveand/declineare served in the clear on the node’s own origin, so a person approves on a page no app controls (The consent page). - CORS. The configured
--origins, every package frontend origin and every registered package origin may call the node from a browser. CORS is outermost so a preflight is answered before the envelope sees it; what travels sealed needs no header of its own.
The routes
Section titled “The routes”| Prefix | Who | What |
|---|---|---|
/attestation, /health |
Anyone, unsealed | The node’s quote; liveness |
/consent/* |
An app (request, result); the person (the page, in the clear) | The consent page |
/auth/* |
People and API keys | Passkey sign-up and sign-in, devices, sessions, API keys, aliases, recovery codes, backup key, account proofs, activity, usage |
/sign-up*, /deployers*, /deployments*, /releases, /publishers/* |
Anyone signed in, or the cluster’s owner | The sign-up policy and invites, deployer grants, deployments, release deadlines, publisher bindings |
/packages*, /package-origins/*, /bundles |
Installers, package managers | Install, list and remove releases; registered web origins; raw WASM in development |
/apps* |
Callers the app admits | Create, list, call, view, events, upgrade, access, transfer, move, metadata, blobs and files, runs and pipeline runs, presence, storage, ABI, attestation |
/pipelines/validate |
Anyone signed in | Check a pipeline before it ships |
/orgs*, /invites/{token}/redeem |
Members | Organizations, teams, members, capabilities, invites, approvals, upgrade runs, backup key, recovery |
/recover/holder |
A holder’s own device | Bring an organization’s or account’s apps onto this cluster from a recovery disk |
/internal/* |
Peers only | Raft RPCs, system writes and read index, forwarded calls and views, blobs, presence, events, storage stats, the cluster key |
/ops/* |
The operator’s token (and its signature for decisions) | Status, metrics, node registration, replica moves, backups, restores and recovery, quotas, pools and prices, and the decisions governance gives the operator |
A job node serves a different set: /health, /attestation
(purpose=jobs only) and /job/*, all from the cluster that started it
(Compute actions). With
--metrics-listen, a second plain-HTTP listener serves GET /metrics and
nothing else. The full list is the node’s OpenAPI document
(Node API, OpenAPI).
Errors are JSON { "error": CODE, "message": …, "details"? } with an HTTP
status.
Between nodes
Section titled “Between nodes”A node talks to a peer exactly as a client does: it fetches the peer’s
attestation, judges the quote against its own measurement policy, and opens a
sealed session to the attested key (HttpAttestor). In TDX mode the policy is
the signed mero-tee release the peer names, with the profiles in
--peer-profiles (default: this node’s own MERO_TEE_PROFILE) and the floor
--peer-min-release (at least the built-in 2.3.109); a TDX node refuses to
start without them. A node trusts a debug-profile peer only if it runs a debug
image itself, which it checks against its own registers at start. The release each
peer’s attestation named is remembered, which is what the
release gate reads.
A node’s session to a peer is identified: handshake version 3,
Noise_IK_25519_AESGCM_SHA256 instead of the client’s NK, where the caller
also proves its own static key, which is its attested transport key. The peer
hands that key to every request of the session, and the request names the
calling node (x-calimero-node). The receiver believes the name only once it
has attested that node’s registered address itself, with a fresh nonce, and
found the same key there; the same quote gives it the caller’s release
(Node::identify_peer, cached by key). The client’s NK handshake never tells
the server who is calling, and a gate on what a node answers needs exactly
that. Every internal request also carries
x-cluster-auth, the cluster secret HMAC-SHA256(K_c, "calimero.cluster.v1|" ‖ cluster)
(Encryption), compared in
constant time, but the secret alone authorizes no data access: every release
can compute it.
Each internal route judges the identified caller, the inbound twin of the release gate on what a node sends:
| Route | The caller must be |
|---|---|
internal/view, call, events, storage, last-write, restore-point, xcalls, app/index, app-ready, blob/held, blob/pin, presence, upload/… |
On a release approved for the app’s data (caller_may_hold; release approvals) |
internal/blob/get, GET internal/segment/{hash} |
Any node of the cluster for code (a bundle, a release .mpk); for any other blob or file segment, on a release approved for an app hosted here that marks it |
internal/blob/delete |
Any node of the cluster, and no app hosted here may still mark the blob |
internal/raft, raft-batch |
The node the RPC names as its sender (leader or candidate); for an app group also on an approved release and a replica or member of the group. The message’s target must be this node (421 NOT_ADDRESSEE). A batch carries only heartbeats, and each item is judged alone |
internal/digests |
Any node of the cluster; answered only for the app groups it is a voter or learner of |
internal/system, system/index, blob, PUT internal/segment/{hash}, challenge/take, runtime, usage, usage/today |
A registered node that is not removed (or a node still in the system group’s membership while its removal commits); what it proposes is judged where it applies (system group), and a blob or segment it stores must hash to its name |
An anonymous peer session (Noise NK) is refused on every internal route but
internal/cluster-key, which a node asks before it holds the cluster secret:
the key is delivered to the node’s registered address, never answered
(Encryption).
The sender check matters because openraft takes the sender a message names on trust, and a follower takes an append from any node with a higher term: without it, any node that can compute the cluster secret could overwrite an app group’s log.
Raft itself is an RPC: POST /internal/raft { group, target, rpc } carries an
AppendEntries, Vote or InstallSnapshot request as JSON and returns the
response. target is the node id the sender meant. The route checks both ends
of the message: the sender must be the authenticated caller (above), and the
addressee must be this node. A node reached under another id (a reused port, a
node moved or replaced) refuses the message with 421 NOT_ADDRESSEE instead of
taking it as its own. A message without target comes from a peer on an
earlier release; it is still accepted, counted and warned about, and the release
after refuses it. Forwarded calls go to internal/call, views to internal/view,
system writes to internal/system. A forward to an app’s leader is bounded at
5 seconds; a system write keeps the 30-second HTTP timeout.
In calimero-node
Section titled “In calimero-node”Where the node implements this chapter, by the names in its code: paths are under crates/node/src
unless another crate is named. The design and its reasons are above; a module’s own detail is in its
//! doc, and the node’s mental model is crates/node/AGENTS.md.
Peer identity and the inbound gate
Section titled “Peer identity and the inbound gate”A node’s channel to a peer is identified (Noise IK with its own transport key, x-calimero-node: <id>); Node::identify_peer attests the claimed node’s registered address itself and takes the
claim only if that quote names the proven key (cached by key; the quote’s release with it).
That attestation, and the one before a channel to a peer opens (Node::connected), runs in a task
of its own (node::detach, one per caller or peer at a time, MAX_DETACHED): on TDX it takes about
a second, longer than the one heartbeat openraft gives an RPC, and dropped with the RPC it never
finished.
api::peer replaces the bare cluster-secret check and refuses an anonymous session.
Routes: app data (view, call, events, storage, last-write, xcalls, blob/held,
app-ready, presence) need a release approved for the app (caller_may_hold); blob/get code to
any node, other blobs only for an approved hosted app that marks them; blob/delete refused while a
hosted app marks the blob or its leader is committing an entry that stored it; raft needs
rpc.sender = the caller and, for an app group, an approved release and membership (replicas or the
group’s voters/learners): openraft itself never checks (F4).
Outbound, blobs (spread_blob) and presence go only to peers may_send allows.
Both Raft checks run per heartbeat of every app group, so they read SystemMachine::app_of_group
and group_may_hold (system/routing.rs: a group -> app and node -> apps index and a (group,
release) decision cache, derived, dropped on every system apply and restore; Node::sys_machine),
never a scan of apps; reconcile uses apps_on and app_of_group too.
Heartbeats always travel batched per peer (internal/raft-batch, PeerTransport::send_batch, B6);
every item passes admit_raft as a message alone does, only empty appends, at most
MAX_HEARTBEATS_PER_BATCH; a batch a peer refuses is sent again item by item.
Raft addressee
Section titled “Raft addressee”Code: PeerTransport::send, api::internal_raft.
The sender check above covers one end of a Raft message; the other is its addressee.
Every Raft message names the node it is for (target), and a node that is not that node refuses it
with 421 NOT_ADDRESSEE.
So a genuine member’s message that reaches the wrong node (a reused port, a node moved or replaced)
cannot move that node’s term or log.
Both cases are counted in calimero_raft_misaddressed_total{reason="not_addressee"|"no_target"}.