pub struct DeviceBindingManager<S: DeviceBindingStorage> { /* private fields */ }Expand description
Device binding manager
Implementations§
Source§impl<S: DeviceBindingStorage> DeviceBindingManager<S>
impl<S: DeviceBindingStorage> DeviceBindingManager<S>
Sourcepub fn new(storage: S, config: DeviceBindingConfig) -> Self
pub fn new(storage: S, config: DeviceBindingConfig) -> Self
Create a new manager with configuration
Sourcepub async fn register_device(
&self,
request: DeviceRegistrationRequest,
) -> Result<TrustedDevice, DeviceBindingError>
pub async fn register_device( &self, request: DeviceRegistrationRequest, ) -> Result<TrustedDevice, DeviceBindingError>
Register a new device
Sourcepub async fn validate_device_trust(
&self,
device_id: &str,
operation: &str,
) -> Result<DeviceTrustResult, DeviceBindingError>
pub async fn validate_device_trust( &self, device_id: &str, operation: &str, ) -> Result<DeviceTrustResult, DeviceBindingError>
Validate device trust
Sourcepub async fn record_authentication(
&self,
device_id: &str,
) -> Result<(), DeviceBindingError>
pub async fn record_authentication( &self, device_id: &str, ) -> Result<(), DeviceBindingError>
Update device authentication time
Sourcepub async fn revoke_device(
&self,
device_id: &str,
reason: String,
) -> Result<(), DeviceBindingError>
pub async fn revoke_device( &self, device_id: &str, reason: String, ) -> Result<(), DeviceBindingError>
Revoke a device
Sourcepub async fn delete_device(
&self,
device_id: &str,
) -> Result<(), DeviceBindingError>
pub async fn delete_device( &self, device_id: &str, ) -> Result<(), DeviceBindingError>
Delete a device
Sourcepub async fn get_user_devices(
&self,
user_id: &UserId,
) -> Result<Vec<TrustedDevice>, DeviceBindingError>
pub async fn get_user_devices( &self, user_id: &UserId, ) -> Result<Vec<TrustedDevice>, DeviceBindingError>
Get all devices for a user
Sourcepub async fn find_device_by_fingerprint(
&self,
user_id: &UserId,
fingerprint: &DeviceFingerprint,
) -> Result<Option<TrustedDevice>, DeviceBindingError>
pub async fn find_device_by_fingerprint( &self, user_id: &UserId, fingerprint: &DeviceFingerprint, ) -> Result<Option<TrustedDevice>, DeviceBindingError>
Find existing device by fingerprint
Sourcepub async fn cleanup_expired_devices(
&self,
user_id: &UserId,
) -> Result<usize, DeviceBindingError>
pub async fn cleanup_expired_devices( &self, user_id: &UserId, ) -> Result<usize, DeviceBindingError>
Cleanup expired devices
Auto Trait Implementations§
impl<S> Freeze for DeviceBindingManager<S>where
S: Freeze,
impl<S> RefUnwindSafe for DeviceBindingManager<S>where
S: RefUnwindSafe,
impl<S> Send for DeviceBindingManager<S>
impl<S> Sync for DeviceBindingManager<S>
impl<S> Unpin for DeviceBindingManager<S>where
S: Unpin,
impl<S> UnsafeUnpin for DeviceBindingManager<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for DeviceBindingManager<S>where
S: UnwindSafe,
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
Mutably borrows from an owned value. Read more