Skip to main content

Module pair

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 Invitation and 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 short Pin, 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 UserCode the 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. Debug does not show the binding.
CodeAlphabet
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.
DeskLimits
Bounds on a desk’s pending work and on guessing. Every field has a default; any value is accepted, and non_defaults lists the ones that differ from their default. Read like PairingOptions; #[non_exhaustive].
Paired
A successful pairing: the other side’s key, now to be trusted.
Pairing
How a joiner pairs: build one, then join a channel.
PairingCode
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.
PairingDesk
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.
PairingDeskBuilder
Builds a PairingDesk from its settings, filled in layers, and the inputs it takes. build lists everything still missing at once.
PairingDeskParts
What a PairingDeskBuilder collects: the settings, the random source and the clock.
PairingDeskSettings
What a PairingDesk is built from, besides its random source and clock, in the form a file, a form or a peer fills.
PairingJoiner
The joiner’s side of a pairing exchange.
PairingOptions
What a responder offers and how its codes are made. Every field has a default; any value with a meaning is accepted, and non_defaults lists the ones that differ from their default. Every key is optional and an unknown key is refused; a duration reads as 600, 90s or 250ms, and pin_ttl and device_ttl also read never. #[non_exhaustive]: start from Default and assign the fields.
PairingResponder
The responder’s side of a pairing exchange: it redeems invitations from its PairingStore (a TrustStore, or a host’s own), takes PINs and decisions from its PairingDesk, and accepts the joiner’s key in the store when the pairing succeeds.
PendingDevice
A device-flow joiner found by its user code: what an app may show before it approves or denies.
PendingSlot
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. Debug does 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.
ShownPin
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.
UserCode
A device-flow user code: the responder issues it, the joiner shows it, and the operator enters it at the responder to approve. Debug does not show it.

Enums§

Decision
How a waiting exchange is settled.
Mode
The pairing mode.
PairRefusal
Why a pairing was refused, by this side or the other.
PairingError
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§

CodeAlphabetSetters
The typed setters of CodeAlphabet, for any builder that holds its settings.
DeskLimitsSetters
The typed setters of DeskLimits, for any builder that holds its settings.
PairingDeskSettingsSetters
The typed setters of PairingDeskSettings, for any builder that holds its settings.
PairingOptionsSetters
The typed setters of PairingOptions, for any builder that holds its settings.
PairingStore
What a PairingResponder needs of the storage that holds the keys it admits and the invitations it redeems.