Struct Pairing
pub struct Pairing { /* private fields */ }Expand description
How a joiner pairs: build one, then join a channel.
Implementations§
§impl Pairing
impl Pairing
pub fn invitation(inviter: PeerId, secret: [u8; 32]) -> Pairing
pub fn invitation(inviter: PeerId, secret: [u8; 32]) -> Pairing
Pairs with an invitation: secret from the inviter, who is inviter. The joiner sends
the secret only when the channel proved inviter’s key, so it must be confidential and
authenticate the inviter (a TLS connection that pins it).
pub fn pin(pin: Pin, role: PinRole) -> Pairing
pub fn pin(pin: Pin, role: PinRole) -> Pairing
Pairs with a PIN: the one the responder shows and a person typed here
(PinRole::Typed), or this joiner’s own, which it shows with the slot the responder
assigns (PinRole::Shown). The PAKE draws from the operating system’s generator
unless random gives another.
pub fn device(label: &str) -> Pairing
pub fn device(label: &str) -> Pairing
Pairs by the device flow: the responder issues a user code that this joiner shows, and
pairs when its operator approves. label (at most 255 bytes, one line) is shown to the
operator if the responder’s app chooses; it proves nothing.
The joiner must have verified the responder (a pin, or roots for the name dialled):
join refuses a channel that is not Channel::verified unless
allow_unverified is set.
pub fn allow_unverified(self, allow: bool) -> Pairing
pub fn allow_unverified(self, allow: bool) -> Pairing
Lets the device flow run with a responder this joiner did not verify. A relaying attacker can then pair in place of both sides: the operator approves the attacker’s code, and this joiner trusts the attacker. Off by default.
pub fn allows_unverified(&self) -> bool
pub fn allows_unverified(&self) -> bool
Whether allow_unverified is set.
pub fn random(self, random: Random) -> Pairing
pub fn random(self, random: Random) -> Pairing
The PAKE’s random source, instead of the operating system’s.
pub fn join(self, channel: Channel) -> Result<PairingJoiner, PairingError>
pub fn join(self, channel: Channel) -> Result<PairingJoiner, PairingError>
Starts the exchange over channel; the first message is ready to
transmit.
§Errors
PairingError::Unverified for an invitation whose channel did not prove the
inviter’s key, and for the device flow over a channel that did not verify the responder
unless allowed;
PairingError::Local with [Error::InvalidOptions] for a device label longer than
255 bytes or with a control or bidirectional formatting character.