Skip to main content

Module local_proof

Module local_proof 

Source
Expand description

The proof agentmux-srv open and a headless srv give each other before open asks for anything. SPEC_HEADLESS_SERVER_PACKAGE_AND_LOCAL_WEB_UI Β§3.

open never sends the key. It sends a fresh nonce; srv answers with its own nonce and a MAC, made with the key, over both nonces and the address srv is bound to. open checks that MAC against the address it is talking to before it sends anything else, so a listener without the key, or one that forwards to the real srv from another port, gets nothing it can reuse. Each later request then carries a MAC of its method, path, body and a rising sequence number, under a key made from the key and both nonces, and each answer carries one too. Every MAC has its own label, so a MAC made for one purpose is never valid for another.

StructsΒ§

Admitted πŸ”’
A request that proved itself: the answer to it is proved with this.
Channel πŸ”’
ChannelKey πŸ”’
A channel’s key, kept in memory only.
Channels πŸ”’
The channels open has begun. Memory only.
Client πŸ”’
open’s end of a channel, after srv proved itself.
Hello πŸ”’
srv’s answer to a hello.
HelloReply πŸ”’
What srv said in its hello.
NotProved πŸ”’
A hello that did not prove srv holds the key, or is bound to the address open is talking to.
Signed πŸ”’

ConstantsΒ§

CHANNEL_HEADER πŸ”’
CHANNEL_LIFE πŸ”’
A channel lives this long: more than a sign-in takes (a minute for the browser, a minute for the answer).
MAX_CHANNELS πŸ”’
At most this many channels at once; a new one beyond it replaces the oldest that has proved nothing.
PROOF_HEADER πŸ”’
SEQ_HEADER πŸ”’

FunctionsΒ§

channel_key πŸ”’
The key of one channel: made from the key and everything the hello proved.
hello_proof πŸ”’
What srv proves in its hello: it holds the key, and is bound to bound with declared as the other origin it accepts (empty when none).
is_nonce πŸ”’
A nonce is 32 random bytes as 64 lowercase hex characters.
mac πŸ”’
MAC over length-prefixed parts under key, so no two part lists give the same input.
new_nonce πŸ”’
request_proof πŸ”’
response_proof πŸ”’
The proof on srv’s answer to request number seq.

Type AliasesΒ§

Hmac256 πŸ”’