Module pair
Expand description
Pairing: how a joiner and a responder come to accept each other’s keys, over any channel.
Three modes, each of which a responder may turn off (PairingOptions):
- Invitation: the responder made an
Invitationand the joiner holds its secret and the inviter’s id. The joiner sends the secret only over a channel that proved the inviter’s key; the responder redeems it. - PIN (feature
pin): one side shows a shortPin, a person types it on the other, and both run SPAKE2 with key confirmation over both sides’ keys and the channel binding. An attacker gets one guess per run. - Device flow: the responder issues a
UserCodethe joiner shows; an operator enters it at the responder and approves. Meant for a joiner that verified the responder.
The exchange is sans-IO: PairingJoiner and PairingResponder take whole messages
with receive and give them with transmit; the caller moves them over a reliable,
ordered channel. What a person must see or decide is returned as data
(PairingJoiner::shown, the PairingDesk); the crate shows nothing.
Structs§
- Channel
- What the channel the exchange runs over gives it.
Debugdoes not show the binding. - Code
Alphabet - The characters and length of a short code a person reads and types: a PIN or a device-flow user code.
- Decided
- The future of
PairingDesk::decided. - Desk
Limits - Bounds on a desk’s pending work and on guessing. Every field has a default; any value is
accepted, and
non_defaultslists the ones that differ from their default. Read likePairingOptions;#[non_exhaustive]. - Paired
- A successful pairing: the other side’s key, now to be trusted.
- Pairing
- How a joiner pairs: build one, then
joina channel. - Pairing
Code - What a person types at the responder when the joiner shows its PIN: the slot the responder
assigned to that joiner, and the PIN. Plain data: joining and splitting the text a person
reads (
37-482913, say) is the caller’s. - Pairing
Desk - The responder’s side of pairing that involves the operator: the PIN it shows, joiners that wait for a typed PIN or an approval, and the throttles. Clone it to share it between the connections and the app’s own surface.
- Pairing
Desk Builder - Builds a
PairingDeskfrom its settings, filled in layers, and the inputs it takes.buildlists everything still missing at once. - Pairing
Desk Parts - What a
PairingDeskBuildercollects: the settings, the random source and the clock. - Pairing
Desk Settings - What a
PairingDeskis built from, besides its random source and clock, in the form a file, a form or a peer fills. - Pairing
Joiner - The joiner’s side of a pairing exchange.
- Pairing
Options - What a responder offers and how its codes are made. Every field has a default; any value
with a meaning is accepted, and
non_defaultslists the ones that differ from their default. Every key is optional and an unknown key is refused; a duration reads as600,90sor250ms, andpin_ttlanddevice_ttlalso readnever.#[non_exhaustive]: start fromDefaultand assign the fields. - Pairing
Responder - The responder’s side of a pairing exchange: it redeems invitations from its
PairingStore(aTrustStore, or a host’s own), takes PINs and decisions from itsPairingDesk, and accepts the joiner’s key in the store when the pairing succeeds. - Pending
Device - A device-flow joiner found by its user code: what an app may show before it approves or denies.
- Pending
Slot - A joiner that shows its own PIN and waits for the operator to type it.
- Pin
- A PIN: a short code one side shows and a person types on the other, checked by a PAKE.
Debugdoes not show it. - Rotation
- The key-rotation announcement: the message a peer sends, over a session its current key authenticated, to name its successor key.
- Shown
Pin - A PIN the desk shows, for the caller to display.
- Ticket
- A responder’s handle on a decision it waits for: a joiner’s PIN typed by the operator, or the approval of a device-flow joiner.
- User
Code - A device-flow user code: the responder issues it, the joiner shows it, and the operator
enters it at the responder to approve.
Debugdoes not show it.
Enums§
- Decision
- How a waiting exchange is settled.
- Mode
- The pairing mode.
- Pair
Refusal - Why a pairing was refused, by this side or the other.
- Pairing
Error - Why a pairing exchange failed. No message holds a secret, a code or key material.
- PinRole
- Which side of a PIN pairing shows the PIN.
- Shown
- What the joiner must show a person, as data.
Traits§
- Code
Alphabet Setters - The typed setters of
CodeAlphabet, for any builder that holds its settings. - Desk
Limits Setters - The typed setters of
DeskLimits, for any builder that holds its settings. - Pairing
Desk Settings Setters - The typed setters of
PairingDeskSettings, for any builder that holds its settings. - Pairing
Options Setters - The typed setters of
PairingOptions, for any builder that holds its settings. - Pairing
Store - What a
PairingResponderneeds of the storage that holds the keys it admits and the invitations it redeems.