Skip to main content

DeviceBindingStorage

Trait DeviceBindingStorage 

Source
pub trait DeviceBindingStorage: Send + Sync {
    // Required methods
    fn save_device<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device: &'life1 TrustedDevice,
    ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_device<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<TrustedDevice, DeviceBindingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_user_devices<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 UserId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TrustedDevice>, DeviceBindingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_last_auth<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device_id: &'life1 str,
        timestamp: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn revoke_device<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device_id: &'life1 str,
        reason: String,
        revoked_at: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_device<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_similar_devices<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 UserId,
        fingerprint: &'life2 DeviceFingerprint,
        min_similarity: f64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TrustedDevice>, DeviceBindingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Storage trait for device binding

Required Methods§

Source

fn save_device<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 TrustedDevice, ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save a trusted device

Source

fn get_device<'life0, 'life1, 'async_trait>( &'life0 self, device_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<TrustedDevice, DeviceBindingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get device by ID

Source

fn get_user_devices<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 UserId, ) -> Pin<Box<dyn Future<Output = Result<Vec<TrustedDevice>, DeviceBindingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all devices for a user

Source

fn update_last_auth<'life0, 'life1, 'async_trait>( &'life0 self, device_id: &'life1 str, timestamp: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update device last authentication time

Source

fn revoke_device<'life0, 'life1, 'async_trait>( &'life0 self, device_id: &'life1 str, reason: String, revoked_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Revoke device

Source

fn delete_device<'life0, 'life1, 'async_trait>( &'life0 self, device_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), DeviceBindingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete device

Source

fn find_similar_devices<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 UserId, fingerprint: &'life2 DeviceFingerprint, min_similarity: f64, ) -> Pin<Box<dyn Future<Output = Result<Vec<TrustedDevice>, DeviceBindingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Find devices by fingerprint similarity

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§