Skip to main content

EnrollmentStore

Trait EnrollmentStore 

Source
pub trait EnrollmentStore: Send + Sync {
    // Required methods
    fn create<'life0, 'async_trait>(
        &'life0 self,
        record: EnrollmentRecord,
    ) -> Pin<Box<dyn Future<Output = Result<String, EnrollmentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<EnrollmentRecord>, EnrollmentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_enrolled<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        tenant_id: &'life2 TenantId,
        factor_id: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, EnrollmentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn list_by_user<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        tenant_id: &'life2 TenantId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EnrollmentRecord>, EnrollmentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn update<'life0, 'async_trait>(
        &'life0 self,
        record: EnrollmentRecord,
    ) -> Pin<Box<dyn Future<Output = Result<(), EnrollmentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), EnrollmentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn record_usage<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), EnrollmentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for pluggable enrollment storage

Required Methods§

Source

fn create<'life0, 'async_trait>( &'life0 self, record: EnrollmentRecord, ) -> Pin<Box<dyn Future<Output = Result<String, EnrollmentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new enrollment

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<EnrollmentRecord>, EnrollmentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a specific enrollment by ID

Source

fn is_enrolled<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: &'life1 str, tenant_id: &'life2 TenantId, factor_id: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<bool, EnrollmentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Check if user is enrolled in a specific factor

Source

fn list_by_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, tenant_id: &'life2 TenantId, ) -> Pin<Box<dyn Future<Output = Result<Vec<EnrollmentRecord>, EnrollmentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

List all enrollments for a user

Source

fn update<'life0, 'async_trait>( &'life0 self, record: EnrollmentRecord, ) -> Pin<Box<dyn Future<Output = Result<(), EnrollmentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update enrollment (e.g., status change, last_used)

Source

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

Delete/revoke an enrollment

Source

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

Record usage of a factor (increment counter, update timestamp)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§