Skip to main content

AuthClient

Trait AuthClient 

Source
pub trait AuthClient: Send + Sync {
    // Required methods
    fn login<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        username: &'life1 str,
        password: &'life2 str,
        totp_code: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = Result<AuthResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn register<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        username: &'life1 str,
        email: &'life2 str,
        password: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<AuthResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn change_password<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        current_password: &'life1 str,
        new_password: &'life2 str,
        totp_code: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = Result<MutateResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete_account<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        password: &'life1 str,
        totp_code: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<MutateResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Abstraction over the legacy (Rust sync server) and Hub auth APIs.

CLI commands use this trait so they don’t need to know which backend is active — they just prompt for input and call these methods.

Required Methods§

Source

fn login<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, username: &'life1 str, password: &'life2 str, totp_code: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<AuthResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Log in with username + password, optionally providing a TOTP code.

Source

fn register<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, username: &'life1 str, email: &'life2 str, password: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<AuthResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Register a new account.

Source

fn change_password<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, current_password: &'life1 str, new_password: &'life2 str, totp_code: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<MutateResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Change the account password, optionally providing a TOTP code.

Source

fn delete_account<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, password: &'life1 str, totp_code: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<MutateResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete the account, requiring the current password and optionally a TOTP code.

Implementors§