Challenge
A host's answer to a device asking to join: "prove you hold your key, and here is proof that I hold mine." The host signs it, so the joiner learns the host's key from the host itself, and the fresh hostNonce it carries is what the joiner's AdmissionProof must sign over.
It names the room, both ends by their peer ids, and both nonces: the joinerNonce the joiner sent in its Hello, so the joiner knows this challenge answers its own Hello and is not a replay, and the hostNonce the host chose, so the proof answering it is good only once.
Its wire form is the signed bytes themselves — the layout below, then the 64-byte signature — and two challenges are equal when their wire bytes are. The arrays it hands out are copies.
Layout tag "kuilt/challenge", version 1, six fields in this order:
host key (33-byte compressed point) ‖ room id (UTF-8) ‖ host peer id (UTF-8) ‖
joiner peer id (UTF-8) ‖ joiner nonce (16 bytes) ‖ host nonce (16 bytes)decode reads the layout only; it does not check the signature. isSignedByHost does that, under the hostKey the challenge itself names — which proves the challenge came from whoever holds that key, not that the key belongs to anyone in particular.
Properties
Functions
Whether the signature on wire is hostKey's over the layout. false, never a throw, for a bad signature or a hostKey whose point is not on the curve.
isSignedByHost, checked in scheme rather than always in KeyScheme.P256. A room passes its own DeviceKeyStore.keyScheme, so a room on the real scheme checks with ECDSA whatever was sent.