AuthClientStorage

Trait AuthClientStorage 

Source
pub trait AuthClientStorage: Send {
    // Required methods
    fn get(&mut self, key: &str) -> Result<Option<StoredKey>, StorageError>;
    fn set(&mut self, key: &str, value: StoredKey) -> Result<(), StorageError>;
    fn remove(&mut self, key: &str) -> Result<(), StorageError>;
}
Available on crate feature native only.
Expand description

Trait for persisting user authentication data.

Required Methods§

Source

fn get(&mut self, key: &str) -> Result<Option<StoredKey>, StorageError>

Retrieves a stored value by key.

§Arguments
  • key - The key to look up in storage
§Returns
  • Ok(Some(StoredKey)) if the key exists in storage
  • Ok(None) if the key does not exist
  • Err(StorageError) if an error occurred
Source

fn set(&mut self, key: &str, value: StoredKey) -> Result<(), StorageError>

Stores a key-value pair in the storage.

§Arguments
  • key - The key to store the value under
  • value - The value to store
§Returns
  • Ok(()) if the value was successfully stored
  • Err(StorageError) if an error occurred during storage
Source

fn remove(&mut self, key: &str) -> Result<(), StorageError>

Removes a stored value by key.

§Arguments
  • key - The key to remove from storage
§Returns
  • Ok(()) if the key was successfully removed
  • Err(StorageError) if an error occurred during removal

Trait Implementations§

Source§

impl From<KeyringStorage> for Box<dyn AuthClientStorage>

Available on crate feature keyring only.
Source§

fn from(storage: KeyringStorage) -> Self

Converts to this type from the input type.
Source§

impl From<PemStorage> for Box<dyn AuthClientStorage>

Available on crate feature pem only.
Source§

fn from(storage: PemStorage) -> Self

Converts to this type from the input type.

Implementors§

Source§

impl AuthClientStorage for KeyringStorage

Available on crate feature keyring only.
Source§

impl AuthClientStorage for PemStorage

Available on crate feature pem only.