Trait WalletManager

Source
pub trait WalletManager: Debug {
    // Required methods
    fn get_recovery_share(&self) -> Option<Share>;
    fn set_recovery_share(&mut self, share: Option<Share>);
    fn create_wallet_from_new_mnemonic<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        access_token: &'life2 Option<AccessToken>,
        repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>,
        pin: &'life4 EncryptionPin,
    ) -> Pin<Box<dyn Future<Output = Result<String, WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn create_wallet_from_existing_mnemonic<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        access_token: &'life2 Option<AccessToken>,
        repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>,
        pin: &'life4 EncryptionPin,
        mnemonic: &'life5 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait;
    fn create_wallet_from_backup<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        access_token: &'life2 Option<AccessToken>,
        repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>,
        pin: &'life4 EncryptionPin,
        backup: &'life5 [u8],
        backup_password: &'life6 PlainPassword,
    ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             'life6: 'async_trait;
    fn create_wallet_backup<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        access_token: &'life2 Option<AccessToken>,
        repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>,
        pin: &'life4 EncryptionPin,
        backup_password: &'life5 PlainPassword,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait;
    fn delete_wallet<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        access_token: &'life2 Option<AccessToken>,
        repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>,
    ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn check_mnemonic<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        access_token: &'life2 Option<AccessToken>,
        repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>,
        pin: &'life4 EncryptionPin,
        mnemonic: &'life5 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait;
    fn change_wallet_password<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        access_token: &'life2 Option<AccessToken>,
        repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>,
        pin: &'life4 EncryptionPin,
        new_password: &'life5 PlainPassword,
    ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait;
    fn try_get<'a, 'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'a mut self,
        config: &'life0 mut Config,
        access_token: &'life1 Option<AccessToken>,
        repo: &'life2 mut Box<dyn UserRepo + Send + Sync + 'static>,
        network: &'life3 ApiNetwork,
        pin: &'life4 EncryptionPin,
    ) -> Pin<Box<dyn Future<Output = Result<WalletBorrow<'a>, WalletError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

Creates a wallet and returns an instance to work upon

Required Methods§

Source

fn get_recovery_share(&self) -> Option<Share>

Get the recovery share

Source

fn set_recovery_share(&mut self, share: Option<Share>)

Set the recovery share

Source

fn create_wallet_from_new_mnemonic<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 mut self, config: &'life1 Config, access_token: &'life2 Option<AccessToken>, repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>, pin: &'life4 EncryptionPin, ) -> Pin<Box<dyn Future<Output = Result<String, WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Generate a new mnemonic and create shares. Returns the new mnemonic.

Source

fn create_wallet_from_existing_mnemonic<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 mut self, config: &'life1 Config, access_token: &'life2 Option<AccessToken>, repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>, pin: &'life4 EncryptionPin, mnemonic: &'life5 str, ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Create shares from a mnemonic

Source

fn create_wallet_from_backup<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 mut self, config: &'life1 Config, access_token: &'life2 Option<AccessToken>, repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>, pin: &'life4 EncryptionPin, backup: &'life5 [u8], backup_password: &'life6 PlainPassword, ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait,

Create shares from a kdbx backup byte stream

Source

fn create_wallet_backup<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 mut self, config: &'life1 Config, access_token: &'life2 Option<AccessToken>, repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>, pin: &'life4 EncryptionPin, backup_password: &'life5 PlainPassword, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Create kdbx backup bytes from shares

Source

fn delete_wallet<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, config: &'life1 Config, access_token: &'life2 Option<AccessToken>, repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>, ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

deletes the user’s wallet

Source

fn check_mnemonic<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 mut self, config: &'life1 Config, access_token: &'life2 Option<AccessToken>, repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>, pin: &'life4 EncryptionPin, mnemonic: &'life5 str, ) -> Pin<Box<dyn Future<Output = Result<bool, WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Checks if the mnemonic resembled by the shares is the same as the provided mnemonic.

Source

fn change_wallet_password<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 mut self, config: &'life1 Config, access_token: &'life2 Option<AccessToken>, repo: &'life3 mut Box<dyn UserRepo + Send + Sync + 'static>, pin: &'life4 EncryptionPin, new_password: &'life5 PlainPassword, ) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Changes the password of the existing wallet by re-encrypting the backup share

Source

fn try_get<'a, 'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'a mut self, config: &'life0 mut Config, access_token: &'life1 Option<AccessToken>, repo: &'life2 mut Box<dyn UserRepo + Send + Sync + 'static>, network: &'life3 ApiNetwork, pin: &'life4 EncryptionPin, ) -> Pin<Box<dyn Future<Output = Result<WalletBorrow<'a>, WalletError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Tries to instantiate a [WalletUser] object from shares and/or returns a mutable reference bound to the lifetime of this object. The same instance may be reused across several calls to try_get, hence the lifetime is bound to the lifetime of self.

Implementors§