Expand description
Proof that a websocket connection is the AgentMux window’s.
Every agent holds the instance auth key, so a connection that never sent
bus:register proves nothing by itself. Operator-only actions need the
host’s proof (RpcContext::operator_only):
- the window asks srv for a challenge over its own websocket
(
operator.challenge) and gets a single-use nonce bound to that connection; - it hands the nonce to the CEF host (
operator_attest), which posts it toPOST /api/v1/host/operator_attestwith its IPC token, which agents never see; - srv marks the connection the nonce was issued to as the operator’s.
A nonce is used once and expires after TTL. Registering the connection
as an agent afterwards drops the proof (WshRpcEngine::set_rpc_context).
A headless srv has no CEF host. A browser the person signed in there (a
confirmed local_session, which the person approved by comparing a check
phrase in a terminal) is their window too: vouch_for_signed_in_browser
gives its connection the same proof. An agent never has such a session: it
holds the key, which takes the other path in auth_middleware.
Structs§
- Attest
Request 🔒 - Challenges 🔒
- Challenges waiting for the host, by nonce.
- Operator
Challenge Result operator.challenge’s answer: the nonce to hand to the CEF host.- Pending 🔒
Constants§
- COMMAND_
OPERATOR_ CHALLENGE - MAX_
PENDING 🔒 - The most challenges waiting at once; past it the oldest is dropped.
- TTL 🔒
- How long a challenge waits for the host’s attestation.
Statics§
Functions§
- attest
- Spend
nonceand mark the connection it was issued to as the operator’s. False when the nonce is unknown, used, expired, its connection closed, or that connection has registered as an agent. - challenges 🔒
- handle_
host_ 🔒attest POST /api/v1/host/operator_attest: the CEF host vouches, with its own token, for the connection a challenge was issued to. The instance auth key, which every agent has, isn’t enough.- issue
- A fresh single-use nonce bound to
engine’s connection. - peek_
engine 🔒 - The connection
noncewas issued to, without spending it (a registered external host asks which connection a challenge belongs to before it signs:server::external_host). - register_
challenge 🔒 - Register
operator.challengeon one connection’s engine. The handler holds only a weak reference to the engine that owns it. - take_
engine 🔒 - Spend
nonceand hand back the connection it was issued to, for a caller that decides whether to mark it (server::external_host). The nonce is spent either way. - vouch_
for_ 🔒signed_ in_ browser - Mark a connection the person’s when a browser they signed in opened it
(
sessionis set only for a confirmed local session). The proof is dropped again if the connection registers as an agent, like the app window’s.