Struct PairingDesk
pub struct PairingDesk { /* private fields */ }Expand description
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.
The desk shows nothing and asks nobody: the caller displays show_pin’s PIN, lists
slots, passes what the operator typed to submit_code or find_device, and calls
approve or deny.
Implementations§
§impl PairingDesk
impl PairingDesk
pub fn builder() -> PairingDeskBuilder
pub fn builder() -> PairingDeskBuilder
A builder with nothing set.
§impl PairingDesk
impl PairingDesk
pub fn new(random: Random) -> PairingDesk
pub fn new(random: Random) -> PairingDesk
A desk with the default options and limits, the system clock, and random for PINs,
slots and user codes: PairingDesk::builder().random(random).build().
pub fn settings(&self) -> PairingDeskSettings
pub fn settings(&self) -> PairingDeskSettings
The settings in force.
pub fn non_defaults(&self) -> Vec<NonDefault>
pub fn non_defaults(&self) -> Vec<NonDefault>
Every setting that differs from its default, named by key path.
pub fn options(&self) -> PairingOptions
pub fn options(&self) -> PairingOptions
The options in force.
pub fn limits(&self) -> DeskLimits
pub fn limits(&self) -> DeskLimits
The limits in force.
pub fn show_pin(&self) -> Result<ShownPin, Error>
pub fn show_pin(&self) -> Result<ShownPin, Error>
Makes a new PIN for joiners to type, replacing the one shown before, and returns it for the caller to display.
§Errors
[Error::Random] when the random source fails.
pub fn clear_pin(&self)
pub fn clear_pin(&self)
Withdraws the shown PIN.
pub fn slots(&self) -> Vec<PendingSlot>
pub fn slots(&self) -> Vec<PendingSlot>
The joiners that show their own PIN and wait for it to be typed, by slot.
pub fn submit_code(&self, code: &PairingCode) -> Result<(), PairingError>
pub fn submit_code(&self, code: &PairingCode) -> Result<(), PairingError>
Hands the PIN the operator typed to the joiner waiting in code.slot. Whether it is
right is found by the PAKE; the slot is used either way.
§Errors
PairingError::Refused with PairRefusal::WrongCode when no joiner waits in that
slot (or slot is None).
pub fn find_device(
&self,
approver: &str,
code: &str,
) -> Result<PendingDevice, PairingError>
pub fn find_device( &self, approver: &str, code: &str, ) -> Result<PendingDevice, PairingError>
The device-flow joiner whose user code the operator entered, for the caller to approve
or deny. approver names who entered it (an account, a session), for the per-approver
throttle.
The code is matched exactly over the user-code alphabet, in constant time against every pending code.
§Errors
PairingError::Local with [Error::InvalidCode] when code is not of the alphabet
(not counted as a wrong entry); PairRefusal::Throttled when the approver or all
approvers entered too many wrong codes recently; PairRefusal::WrongCode when no
pending joiner has it (counted).
pub fn approve(&self, device: &PendingDevice) -> Result<(), PairingError>
pub fn approve(&self, device: &PendingDevice) -> Result<(), PairingError>
Approves a device-flow joiner: its responder accepts its key and tells it so.
§Errors
PairRefusal::Expired when it expired, was decided, or disconnected.
pub fn deny(&self, device: &PendingDevice) -> Result<(), PairingError>
pub fn deny(&self, device: &PendingDevice) -> Result<(), PairingError>
pub fn sweep(&self)
pub fn sweep(&self)
Expires the shown PIN and the waiting joiners by the clock, waking their responders. The waits below also do it; call it when the clock is not the system’s.
Trait Implementations§
§impl Clone for PairingDesk
impl Clone for PairingDesk
§fn clone(&self) -> PairingDesk
fn clone(&self) -> PairingDesk
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more