Trait wash_lib::keys::KeyManager

source ·
pub trait KeyManager {
    // Required methods
    fn get(&self, name: &str) -> Result<Option<KeyPair>>;
    fn list_names(&self) -> Result<Vec<String>>;
    fn list(&self) -> Result<Vec<KeyPair>>;
    fn delete(&self, name: &str) -> Result<()>;
    fn save(&self, name: &str, key: &KeyPair) -> Result<()>;
}
Expand description

A trait that can be implemented by anything that needs to manage nkeys

Required Methods§

source

fn get(&self, name: &str) -> Result<Option<KeyPair>>

Returns the named keypair. Returns None if the key doesn’t exist in the manager

source

fn list_names(&self) -> Result<Vec<String>>

List all key names available

source

fn list(&self) -> Result<Vec<KeyPair>>

Retrieves all keys. Note that this could be an expensive operation depending on the implementation

source

fn delete(&self, name: &str) -> Result<()>

Deletes a named keypair

source

fn save(&self, name: &str, key: &KeyPair) -> Result<()>

Saves the given keypair with the given name

Implementors§