pub struct PairingFlow<S> { /* private fields */ }Expand description
Typed pairing flow. The type parameter tracks which state the flow is in; methods are available only in the appropriate state.
Implementations§
Source§impl PairingFlow<Init>
impl PairingFlow<Init>
Sourcepub fn initiate(
now: DateTime<Utc>,
controller_did: String,
endpoint: String,
capabilities: Vec<Capability>,
) -> Result<(Self, PairingToken), ProtocolError>
pub fn initiate( now: DateTime<Utc>, controller_did: String, endpoint: String, capabilities: Vec<Capability>, ) -> Result<(Self, PairingToken), ProtocolError>
Start a new pairing flow. Generates the token; the caller transmits the token out-of-band (QR, manual entry) to the responder.
Sourcepub fn token(&self) -> &PairingToken
pub fn token(&self) -> &PairingToken
Pairing token accessor (for display / QR emission).
Sourcepub fn accept_response(
self,
now: DateTime<Utc>,
response: PairingResponse,
) -> Result<PairingFlow<Responded>, ProtocolError>
pub fn accept_response( self, now: DateTime<Utc>, response: PairingResponse, ) -> Result<PairingFlow<Responded>, ProtocolError>
Accept a responder’s signed response; verify signature, perform
ECDH, derive SAS + transport key. Transitions to <Responded>.
Source§impl PairingFlow<Responded>
impl PairingFlow<Responded>
Sourcepub fn sas(&self) -> Result<&[u8; 10], ProtocolError>
pub fn sas(&self) -> Result<&[u8; 10], ProtocolError>
The 10-byte SAS to display to the user. Caller formats with
crate::sas::format_sas_numeric / crate::sas::format_sas_emoji.
Sourcepub fn confirm(self, _proof: SasMatch) -> PairingFlow<Confirmed>
pub fn confirm(self, _proof: SasMatch) -> PairingFlow<Confirmed>
Record the user’s SAS confirmation. The SasMatch proof token
can only be constructed via SasMatch::user_confirmed_visual_match,
and must be produced by the UI layer AFTER the user has pressed
“match”. Transitions to <Confirmed>.
Source§impl PairingFlow<Confirmed>
impl PairingFlow<Confirmed>
Sourcepub fn finalize(
self,
) -> Result<(PairingFlow<Paired>, CompletedPairing), ProtocolError>
pub fn finalize( self, ) -> Result<(PairingFlow<Paired>, CompletedPairing), ProtocolError>
Finalize the pairing. Returns the full CompletedPairing —
shared secret, transport key, peer DID, and signed attestation.
Consumes self; the PairingFlow<Paired> terminal state is
non-extractable (intentional: once finalized, there is nothing
further to do with the flow).