Skip to main content

SharedUnlockDriver

Trait SharedUnlockDriver 

Source
pub trait SharedUnlockDriver {
    // Required methods
    fn lock_user<'life0, 'async_trait>(
        &'life0 self,
        user_id: UserId,
    ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn unlock_user<'life0, 'async_trait>(
        &'life0 self,
        user_id: UserId,
        user_key: SymmetricCryptoKey,
    ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_users<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<UserId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_vault_url<'life0, 'async_trait>(
        &'life0 self,
        user_id: UserId,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn suppress_vault_timeout<'life0, 'async_trait>(
        &'life0 self,
        user_id: UserId,
        suppression_duration: Duration,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_peer_state<'life0, 'async_trait>(
        &'life0 self,
        user_id: UserId,
        lock_state: PeerLockState,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_last_manual_lock<'life0, 'async_trait>(
        &'life0 self,
        user_id: UserId,
        locked_at: u64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_last_manual_lock<'life0, 'async_trait>(
        &'life0 self,
        user_id: UserId,
    ) -> Pin<Box<dyn Future<Output = Option<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn discover_leader<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<Endpoint>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait that implmeents the device’s shared unlock driver. These functions need to be implemented in order to allow the shared unlock system to function.

Required Methods§

Source

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

Lock the user with the given ID.

Source

fn unlock_user<'life0, 'async_trait>( &'life0 self, user_id: UserId, user_key: SymmetricCryptoKey, ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unlock the user with the given ID.

Source

fn list_users<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<UserId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all users this device has an account for, locked or unlocked.

Source

fn get_vault_url<'life0, 'async_trait>( &'life0 self, user_id: UserId, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get vault_url for the user with the given ID, if available. This is used to verify IPC message sources

Source

fn suppress_vault_timeout<'life0, 'async_trait>( &'life0 self, user_id: UserId, suppression_duration: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Suppress the vault timeout for the given user for the specified duration. Called when a sync is received from this device’s leader, keeping the shared session active.

Source

fn on_peer_state<'life0, 'async_trait>( &'life0 self, user_id: UserId, lock_state: PeerLockState, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a peer state is reported to the shared unlock system (locked or unlocked). This can be used when client needs to be informed about establishment of a shared session with a peer device.

Source

fn set_last_manual_lock<'life0, 'async_trait>( &'life0 self, user_id: UserId, locked_at: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist the date (milliseconds since the Unix epoch) of the user’s last manual lock. Must survive a process reload, so a lock that was not synced before the reload still wins against an older unlock held by a peer.

Source

fn get_last_manual_lock<'life0, 'async_trait>( &'life0 self, user_id: UserId, ) -> Pin<Box<dyn Future<Output = Option<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The date persisted by SharedUnlockDriver::set_last_manual_lock, if any.

Source

fn discover_leader<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<Endpoint>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discovers the endpoint of the peer above this one in the device hierarchy or none if this device is at the top of the hierarchy. The local peer disables vault timeout if it is not at the top of the hierarchy.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§