pub trait AuthClientStorage: Send {
// Required methods
fn get<'a>(
&'a mut self,
key: &'a str,
) -> BoxFuture<'a, Result<Option<StoredKey>, StorageError>>;
fn set<'a>(
&'a mut self,
key: &'a str,
value: StoredKey,
) -> BoxFuture<'a, Result<(), StorageError>>;
fn remove<'a>(
&'a mut self,
key: &'a str,
) -> BoxFuture<'a, Result<(), StorageError>>;
}Available on crate feature
wasm-js only.Expand description
Trait for persisting user authentication data.
Required Methods§
Sourcefn get<'a>(
&'a mut self,
key: &'a str,
) -> BoxFuture<'a, Result<Option<StoredKey>, StorageError>>
fn get<'a>( &'a mut self, key: &'a str, ) -> BoxFuture<'a, Result<Option<StoredKey>, StorageError>>
Retrieves a stored value by key from the storage backend.
§Parameters
key: The key to retrieve the value for. The key will be prefixed with the storage prefix.
§Returns
Returns Ok(Some(StoredKey)) if the key exists in storage, Ok(None) if not, or
Err(StorageError) if there was an error accessing the storage.
Sourcefn set<'a>(
&'a mut self,
key: &'a str,
value: StoredKey,
) -> BoxFuture<'a, Result<(), StorageError>>
fn set<'a>( &'a mut self, key: &'a str, value: StoredKey, ) -> BoxFuture<'a, Result<(), StorageError>>
Stores a value with the given key in the storage backend.
§Parameters
key: The key to store the value under. The key will be prefixed with the storage prefix.value: The value to store, which will be encoded before storage.
§Returns
Returns Ok(()) if the value was successfully stored, or Err(StorageError) if there was an
error accessing the storage or storing the value.
Trait Implementations§
Source§impl From<LocalStorage> for Box<dyn AuthClientStorage>
impl From<LocalStorage> for Box<dyn AuthClientStorage>
Source§fn from(storage: LocalStorage) -> Self
fn from(storage: LocalStorage) -> Self
Converts to this type from the input type.