pub struct CredentialStore { /* private fields */ }Expand description
Manages credential storage for Garmin tokens. Supports file-based storage with optional keyring integration.
Implementations§
Source§impl CredentialStore
impl CredentialStore
Sourcepub fn new(profile: Option<String>) -> Result<Self>
pub fn new(profile: Option<String>) -> Result<Self>
Create a new credential store for the given profile
Sourcepub fn with_dir(profile: impl Into<String>, base_dir: PathBuf) -> Result<Self>
pub fn with_dir(profile: impl Into<String>, base_dir: PathBuf) -> Result<Self>
Create a credential store with a custom base directory (for testing)
Sourcepub fn save_oauth1(&self, token: &OAuth1Token) -> Result<()>
pub fn save_oauth1(&self, token: &OAuth1Token) -> Result<()>
Save OAuth1 token to storage
Sourcepub fn load_oauth1(&self) -> Result<Option<OAuth1Token>>
pub fn load_oauth1(&self) -> Result<Option<OAuth1Token>>
Load OAuth1 token from storage
Sourcepub fn save_oauth2(&self, token: &OAuth2Token) -> Result<()>
pub fn save_oauth2(&self, token: &OAuth2Token) -> Result<()>
Save OAuth2 token to storage
Sourcepub fn load_oauth2(&self) -> Result<Option<OAuth2Token>>
pub fn load_oauth2(&self) -> Result<Option<OAuth2Token>>
Load OAuth2 token from storage
Sourcepub fn save_tokens(
&self,
oauth1: &OAuth1Token,
oauth2: &OAuth2Token,
) -> Result<()>
pub fn save_tokens( &self, oauth1: &OAuth1Token, oauth2: &OAuth2Token, ) -> Result<()>
Save both tokens
Sourcepub fn load_tokens(&self) -> Result<Option<(OAuth1Token, OAuth2Token)>>
pub fn load_tokens(&self) -> Result<Option<(OAuth1Token, OAuth2Token)>>
Load both tokens, returns None if either is missing
Sourcepub fn has_credentials(&self) -> bool
pub fn has_credentials(&self) -> bool
Check if credentials exist
Sourcepub fn store_secret_in_keyring(&self, secret: &str) -> Result<()>
pub fn store_secret_in_keyring(&self, secret: &str) -> Result<()>
Try to store OAuth1 token secret in system keyring Falls back silently if keyring is not available
Sourcepub fn load_secret_from_keyring(&self) -> Result<Option<String>>
pub fn load_secret_from_keyring(&self) -> Result<Option<String>>
Try to load OAuth1 token secret from system keyring
Sourcepub fn delete_secret_from_keyring(&self) -> Result<()>
pub fn delete_secret_from_keyring(&self) -> Result<()>
Delete secret from system keyring
Auto Trait Implementations§
impl Freeze for CredentialStore
impl RefUnwindSafe for CredentialStore
impl Send for CredentialStore
impl Sync for CredentialStore
impl Unpin for CredentialStore
impl UnsafeUnpin for CredentialStore
impl UnwindSafe for CredentialStore
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