pub struct Pase { /* private fields */ }Expand description
The PASE state
Implementations§
Source§impl Pase
impl Pase
Sourcepub fn check_comm_window_timeout(
&mut self,
notify_mdns: impl FnMut(),
notify_change: impl FnMut(u16, u32),
) -> Result<bool, Error>
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.
Sourcepub fn comm_window(&self) -> Option<&CommWindow>
pub fn comm_window(&self) -> Option<&CommWindow>
Get the opened commissioning window, if any
Sourcepub fn comm_window_state(&self) -> CommWindowState
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.
Sourcepub 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>
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 identifiersalt- The salt bytes (16..=32 bytes, validated upstream)password- The passcodediscriminator- The discriminatortimeout_secs- The timeout in seconds of the validity of the windowopener- The opener infomdns_notif- The mDNS notification callback
§Returns
Ok(())if the window was opened successfullyErr(Error)if an error occurred (i.e. there is another non-expired commissioning window already opened or the timeout is invalid)
Sourcepub 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>
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 identifierverifier- The verifier bytessalt- The salt bytes (16..=32 bytes, validated upstream)count- The iteration countdiscriminator- The discriminatortimeout_secs- The timeout in seconds of the validity of the windowopener- The opener infomdns_notif- The mDNS notification callback
§Returns
Ok(())if the window was opened successfullyErr(Error)if an error occurred (i.e. there is another non-expired commissioning window already opened or the timeout is invalid)
Sourcepub fn record_pake_failure(
&mut self,
notify_mdns: impl FnMut(),
notify_change: impl FnMut(u16, u32),
) -> Result<(), Error>
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.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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