Skip to main content

pair_accept

Function pair_accept 

Source
pub fn pair_accept<S: Read + Write + PeerAddr + ReadTimeout + WriteTimeout>(
    stream: S,
    identity: &Identity,
    store: &TrustStore,
    desk: &PairingDesk,
    config: &PairConfig,
) -> Result<Paired, PeerError>
Expand description

Accepts a pairing connection over stream as identity and runs the responder’s side to its end: redeeming an invitation from store, taking PINs and decisions from desk (this call blocks while the operator decides), and accepting the joiner’s certificate in store. The address of stream is the source the desk throttles by.

Every read waits at most the sooner of what is left of PairConfig::timeout and the responder’s own deadline (pin_ttl or device_ttl from the joiner’s first message); past that deadline the joiner is told Expired.

§Errors

PeerError::Pairing when either side refused or the deadline passed; PeerError::Io when the handshake or the connection fails or the timeout passes (TimedOut); PeerError::Tls when the client did not negotiate the pairing ALPN.