Skip to main content

Pase

Struct Pase 

Source
pub struct Pase { /* private fields */ }
Expand description

The PASE state

Implementations§

Source§

impl Pase

Source

pub const fn new() -> Pase

Create a new PASE state

Source

pub fn init() -> impl Init<Pase>

Return an in-place initializer for the PASE manager

Source

pub fn check_comm_window_timeout( &mut self, notify_mdns: impl FnMut(), notify_change: impl FnMut(u16, u32), ) -> Result<bool, Error>

Check if the opened commissioning window has expired, and close it if so.

This should be called periodically to ensure that the commissioning window state is updated in a timely manner. Ideally, it should also be called at the beginning of any API that requires the commissioning window to be opened to ensure that the state is up to date.

Source

pub fn comm_window(&self) -> Option<&CommWindow>

Get the opened commissioning window, if any

Source

pub fn comm_window_state(&self) -> CommWindowState

Return the state of the commissioning window - whether one is open, and if so who opened it. See CommWindowState for what the answer is good for.

Source

pub fn open_basic_comm_window( &mut self, mdns_id: u64, salt: &[u8], password: CryptoSensitiveRef<'_, rs_matter::::sc::pase::spake2p::Spake2pVerifierPasswordRef::{constant#0}>, discriminator: u16, timeout_secs: u16, opener: Option<CommWindowOpener>, notify_mdns: impl FnMut(), notify_change: impl FnMut(u16, u32), ) -> Result<(), Error>

Open a basic commissioning window using a passcode

§Arguments
  • mdns_id - The mDNS identifier
  • salt - The salt bytes (16..=32 bytes, validated upstream)
  • password - The passcode
  • discriminator - The discriminator
  • timeout_secs - The timeout in seconds of the validity of the window
  • opener - The opener info
  • mdns_notif - The mDNS notification callback
§Returns
  • Ok(()) if the window was opened successfully
  • Err(Error) if an error occurred (i.e. there is another non-expired commissioning window already opened or the timeout is invalid)
Source

pub fn open_comm_window( &mut self, mdns_id: u64, verifier: CryptoSensitiveRef<'_, rs_matter::::sc::pase::spake2p::Spake2pVerifierStrRef::{constant#0}>, salt: &[u8], count: u32, discriminator: u16, timeout_secs: u16, opener: Option<CommWindowOpener>, notify_mdns: impl FnMut(), notify_change: impl FnMut(u16, u32), ) -> Result<(), Error>

Open an enhanced commissioning window using a verifier

§Arguments
  • mdns_id - The mDNS identifier
  • verifier - The verifier bytes
  • salt - The salt bytes (16..=32 bytes, validated upstream)
  • count - The iteration count
  • discriminator - The discriminator
  • timeout_secs - The timeout in seconds of the validity of the window
  • opener - The opener info
  • mdns_notif - The mDNS notification callback
§Returns
  • Ok(()) if the window was opened successfully
  • Err(Error) if an error occurred (i.e. there is another non-expired commissioning window already opened or the timeout is invalid)
Source

pub fn record_pake_failure( &mut self, notify_mdns: impl FnMut(), notify_change: impl FnMut(u16, u32), ) -> Result<(), Error>

Record a failed PAKE handshake against the currently-open commissioning window, and revoke the window if the limit is reached.

Per Matter Core spec, after 20 unsuccessful PAKE attempts the device SHALL revoke the open commissioning window.

Also clears the in-progress PASE establishment timeout so that the next handshake attempt is not rejected as “another session in progress” — without this, only the first wrong-passcode attempt would be counted because subsequent attempts would be short-circuited at the session-timeout gate.

Has no effect on the failure counter if no window is open.

Source

pub fn close_comm_window( &mut self, notify_mdns: impl FnMut(), notify_change: impl FnMut(u16, u32), ) -> Result<bool, Error>

Close the opened commissioning window, if any

§Arguments
  • ctx - The handler context
§Returns
  • Ok(true) if a commissioning window was closed
  • Ok(false) if there was no commissioning window to close

Trait Implementations§

Source§

impl Default for Pase

Source§

fn default() -> Pase

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Pase

§

impl RefUnwindSafe for Pase

§

impl Send for Pase

§

impl Sync for Pase

§

impl Unpin for Pase

§

impl UnsafeUnpin for Pase

§

impl UnwindSafe for Pase

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, E> Init<T, E> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, I> IntoFallibleInit<T> for I
where I: Init<T>,

Source§

fn into_fallible<E>(self) -> impl Init<T, E>

Convert the infallible initializer to a fallible one.
Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<T, E> PinInit<T, E> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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