pub struct MemoryCredentialStore { /* private fields */ }Expand description
In-memory credential store for testing and temporary use.
Does NOT persist credentials across restarts. Useful for:
- Unit tests
- Temporary sessions
- WASM applications without localStorage access
§Example
use kalam_client::credentials::{CredentialStore, Credentials, MemoryCredentialStore};
let mut store = MemoryCredentialStore::new();
let creds = Credentials::new("local".to_string(), "jwt.token.value".to_string());
store.set_credentials(&creds).unwrap();
let retrieved = store.get_credentials("local").unwrap();
assert_eq!(retrieved, Some(creds));Implementations§
Source§impl MemoryCredentialStore
impl MemoryCredentialStore
Sourcepub fn new() -> MemoryCredentialStore
pub fn new() -> MemoryCredentialStore
Create a new empty in-memory credential store
Trait Implementations§
Source§impl Clone for MemoryCredentialStore
impl Clone for MemoryCredentialStore
Source§fn clone(&self) -> MemoryCredentialStore
fn clone(&self) -> MemoryCredentialStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CredentialStore for MemoryCredentialStore
impl CredentialStore for MemoryCredentialStore
Source§fn get_credentials(
&self,
instance: &str,
) -> Result<Option<Credentials>, KalamLinkError>
fn get_credentials( &self, instance: &str, ) -> Result<Option<Credentials>, KalamLinkError>
Retrieve credentials for a specific database instance Read more
Source§fn set_credentials(
&mut self,
credentials: &Credentials,
) -> Result<(), KalamLinkError>
fn set_credentials( &mut self, credentials: &Credentials, ) -> Result<(), KalamLinkError>
Store credentials for a database instance Read more
Source§fn delete_credentials(&mut self, instance: &str) -> Result<(), KalamLinkError>
fn delete_credentials(&mut self, instance: &str) -> Result<(), KalamLinkError>
Delete stored credentials for an instance Read more
Source§fn list_instances(&self) -> Result<Vec<String>, KalamLinkError>
fn list_instances(&self) -> Result<Vec<String>, KalamLinkError>
List all stored instance identifiers Read more
Source§fn has_credentials(&self, instance: &str) -> Result<bool, KalamLinkError>
fn has_credentials(&self, instance: &str) -> Result<bool, KalamLinkError>
Check if credentials exist for an instance Read more
Source§impl Debug for MemoryCredentialStore
impl Debug for MemoryCredentialStore
Source§impl Default for MemoryCredentialStore
impl Default for MemoryCredentialStore
Source§fn default() -> MemoryCredentialStore
fn default() -> MemoryCredentialStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryCredentialStore
impl RefUnwindSafe for MemoryCredentialStore
impl Send for MemoryCredentialStore
impl Sync for MemoryCredentialStore
impl Unpin for MemoryCredentialStore
impl UnsafeUnpin for MemoryCredentialStore
impl UnwindSafe for MemoryCredentialStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more