Skip to main content

PairingFlow

Struct PairingFlow 

Source
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>

Source

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.

Source

pub fn token(&self) -> &PairingToken

Pairing token accessor (for display / QR emission).

Source

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>

Source

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.

Source

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>

Source

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).

Auto Trait Implementations§

§

impl<S> Freeze for PairingFlow<S>

§

impl<S> RefUnwindSafe for PairingFlow<S>
where S: RefUnwindSafe,

§

impl<S> Send for PairingFlow<S>
where S: Send,

§

impl<S> Sync for PairingFlow<S>
where S: Sync,

§

impl<S> Unpin for PairingFlow<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for PairingFlow<S>

§

impl<S> UnwindSafe for PairingFlow<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V