pub struct PairingManager { /* private fields */ }Expand description
Manages one-time pairing and revocable in-memory sessions.
Implementations§
Source§impl PairingManager
impl PairingManager
Sourcepub fn new<I, S>(allowed_origins: I, ttl: Duration) -> Result<Self>
pub fn new<I, S>(allowed_origins: I, ttl: Duration) -> Result<Self>
Create a manager with an explicit origin allowlist and inactivity lease.
Sourcepub fn begin_pairing(&self) -> PairingDisplay
pub fn begin_pairing(&self) -> PairingDisplay
Starts a fresh pairing code, invalidating any older unconsumed code.
Sourcepub fn begin_pairing_for_origin(
&self,
origin: impl Into<String>,
) -> Result<PairingDisplay>
pub fn begin_pairing_for_origin( &self, origin: impl Into<String>, ) -> Result<PairingDisplay>
Starts a code bound to a specific allowed origin.
Sourcepub fn replace_pairing_for_origin(
&self,
origin: impl Into<String>,
) -> Result<PairingDisplay>
pub fn replace_pairing_for_origin( &self, origin: impl Into<String>, ) -> Result<PairingDisplay>
Revoke all browser sessions and issue a fresh code in one state update.
Sourcepub fn pair(&self, code: &str, origin: &str) -> Result<PairingSession>
pub fn pair(&self, code: &str, origin: &str) -> Result<PairingSession>
Consumes a code and creates a session token bound to the browser origin.
Sourcepub fn validate(&self, token: &str, origin: &str) -> Result<()>
pub fn validate(&self, token: &str, origin: &str) -> Result<()>
Validates a session token and its origin binding without extending it.
Sourcepub fn refresh(&self, token: &str, origin: &str) -> Result<()>
pub fn refresh(&self, token: &str, origin: &str) -> Result<()>
Validates a session and extends its inactivity deadline.
Pairing codes remain one-time and expire according to the configured TTL. An authenticated browser session may remain connected longer than that TTL as long as it continues making authenticated requests.
Sourcepub fn resume(&self, token: &str, origin: &str) -> Result<PairingSession>
pub fn resume(&self, token: &str, origin: &str) -> Result<PairingSession>
Rehydrates an existing in-memory session for a reconnecting socket.
Sourcepub fn revoke_all(&self)
pub fn revoke_all(&self)
Revokes every active browser session and pending code.
Sourcepub fn is_origin_allowed(&self, origin: &str) -> bool
pub fn is_origin_allowed(&self, origin: &str) -> bool
Returns whether the origin is explicitly allowed.
Trait Implementations§
Source§impl Clone for PairingManager
impl Clone for PairingManager
Source§fn clone(&self) -> PairingManager
fn clone(&self) -> PairingManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more