Expand description
The node-authorization handshake that gates a session (phase D, #881).
Runs BEFORE crate::session::run_session, over the same bidirectional stream, and reveals
nothing about the account (not even confirmation that this peer hosts it) until the remote is
authorized. Each side presents a signed transport-node ↔ account-device binding and verifies the
other’s under its OWN admission policy — authorization is mutual, so a peer handed a
poisoned address never streams its inventory to an impostor.
Ordering is asymmetric to close the metadata gap without deadlocking (the transfer phase that follows stays concurrent):
- the acceptor reads the dialer’s binding and verifies it BEFORE sending its own — an unauthorized dialer learns nothing, not even the acceptor’s binding;
- the dialer sends its binding (to the node iroh already authenticated it dialed) then verifies the acceptor’s before proceeding to the data phase.
A failure closes with one UNIFORM error regardless of cause (wrong account / not on roster / bad signature / stale) so a peer cannot probe “does this server host account A / know device D”.
Structs§
- Auth
Config - The non-stream inputs to one auth handshake, bundled so
run_auth_phasetakes the stream pair, the authorizer, and this — rather than a long argument train.
Enums§
- Auth
Error - A node-authorization handshake that did not admit the connection.
- Auth
Policy - How a peer decides whether to admit a connection. Local policy, never negotiated on the wire —
an impostor cannot assert
Opento exempt itself from the other side’sClosed. Per-ACCOUNT, not per-endpoint: one transport node may legitimately serve several accounts, so a public account beingOpenmust not open a private one on the same endpoint. - Auth
Role - Which end of the connection this peer is — determines the send/verify order above.
Constants§
- DEFAULT_
PRE_ AUTH_ TIMEOUT - How long a peer may take to send its auth frame before the handshake aborts. Deliberately much shorter than the data-phase idle timeout: an unauthorized peer that connects and stalls must not occupy the single-session accept slot for long.
Traits§
- Node
Auth - The account-authorization capability the transport needs from the store: mint our own binding,
and verify a peer’s. Both resolve against the store’s account + live fold; kept separate from
crate::session::SyncStoreso the auth phase is testable without the data-phase machinery.
Functions§
- run_
auth_ phase - Run the mutual auth handshake. On
Ok(())both sides have verified each other under their own policies and the caller may proceed tocrate::session::run_sessionover the same stream; onErrthe caller drops the connection without revealing any inventory.