Skip to main content

Module hosts

Module hosts 

Source
Expand description

Host identity and pairing (kernel spec §4): the hosts registry, one-time pairing codes, and the check of a host’s hello proof (ACP core §3.5). Every query names the database’s owner (kernel spec §1), bound when the registry opens (db::kernel_owner): another owner’s host is unknown here, and another owner’s code pairs nothing.

Every time is seconds since the Unix epoch and is passed in by the caller (secret::unix_now() in production), so expiry is testable without sleeping.

Structs§

Enrollment
What a host sends to enroll (kernel spec §4.1), besides the code.
HostRecord
One paired host, as GET /api/hosts lists it.
Hosts
PairingCode
A freshly minted pairing code, shown once.
TooManyPairingCodes
A mint refused because MAX_LIVE_PAIRING_CODES codes are live.

Enums§

EnrollOutcome
The outcome of Hosts::enroll.
HelloCheck
The verdict on a hello (ACP core §3.5).
Registered
The outcome of Hosts::register.
Revoke
The outcome of Hosts::revoke.

Constants§

MAX_AGENTS
The most agents of a hello.mcp_isolation the registry keeps (plan 8e).
MAX_LIVE_PAIRING_CODES
At most this many pairing codes are live (unspent and unexpired) at once; a mint past it is refused with TooManyPairingCodes.
MAX_PATH
The longest path the collector stores or shows from a host, in bytes.
MAX_ROOTS
The most workspace roots stored per host (decision 7).
PAIRING_CODE_TTL_SECS
A pairing code is valid this long (kernel spec §4.1).

Functions§

is_displayable_path
Whether a path a host reported can be stored and shown (decision 7, the review’s A6): absolute and is_displayable_text within MAX_PATH. It is shown, never trusted: the host enforces its own fence.
is_displayable_text
Whether text a host sent can be shown (the review’s A6): at most max bytes, with no control or invisible format character.
normalize_code
A pairing code as typed, reduced to its eight canonical characters: case, dashes and spaces ignored, O read as 0, I and L as 1.
parse_public_key
A hex Ed25519 public key that is a valid point and not of small order.
verify_proof
Whether proof (hex) is public_key’s signature over the hello message for this nonce, host id and protocol version.