[][src]Trait webchain_rs::storage::KeyfileStorage

pub trait KeyfileStorage: Send + Sync {
    fn put(&self, kf: &KeyFile) -> Result<(), KeystoreError>;
fn delete(&self, addr: &Address) -> Result<(), KeystoreError>;
fn hide(&self, addr: &Address) -> Result<bool, KeystoreError>;
fn unhide(&self, addr: &Address) -> Result<bool, KeystoreError>;
fn update(
        &self,
        addr: &Address,
        name: Option<String>,
        desc: Option<String>
    ) -> Result<(), KeystoreError>;
fn list_accounts(
        &self,
        show_hidden: bool
    ) -> Result<Vec<AccountInfo>, KeystoreError>;
fn search_by_address(
        &self,
        addr: &Address
    ) -> Result<(AccountInfo, KeyFile), KeystoreError>; fn is_addr_exist(&self, addr: &Address) -> Result<(), KeystoreError> { ... } }

Storage for KeyFiles

Required methods

fn put(&self, kf: &KeyFile) -> Result<(), KeystoreError>

Put new KeyFile inside storage

Arguments:

  • kf - KeyFile to insert

fn delete(&self, addr: &Address) -> Result<(), KeystoreError>

Delete KeyFile from storage for specified Address

Arguments:

  • addr - target Address

fn hide(&self, addr: &Address) -> Result<bool, KeystoreError>

Hide account for given address from being listed

Arguments:

  • addr - target Address

fn unhide(&self, addr: &Address) -> Result<bool, KeystoreError>

Unhide account for given address from being listed

Arguments:

  • addr - target Address

fn update(
    &self,
    addr: &Address,
    name: Option<String>,
    desc: Option<String>
) -> Result<(), KeystoreError>

Update account for given address with new name and description

Arguments:

  • addr - target Address
  • name - optional new name
  • desc - optional new description

fn list_accounts(
    &self,
    show_hidden: bool
) -> Result<Vec<AccountInfo>, KeystoreError>

Lists info for Keystore files inside storage Can include hidden files if flag set.

Arguments

  • showHidden - flag to show hidden Keystore files

Return:

Array of AccountInfo struct

fn search_by_address(
    &self,
    addr: &Address
) -> Result<(AccountInfo, KeyFile), KeystoreError>

Search of KeyFile by specified Address Provides additional meta info for account

Arguments:

  • addr - target Address
Loading content...

Provided methods

fn is_addr_exist(&self, addr: &Address) -> Result<(), KeystoreError>

Check whether specified address is already inserted into the storage

Arguments

  • addr - address to check
Loading content...

Implementors

impl KeyfileStorage for DbStorage[src]

fn is_addr_exist(&self, addr: &Address) -> Result<(), KeystoreError>[src]

impl KeyfileStorage for FsStorage[src]

fn is_addr_exist(&self, addr: &Address) -> Result<(), KeystoreError>[src]

Loading content...