pub struct TokenStore { /* private fields */ }Expand description
Token storage manager.
Handles reading and writing OAuth tokens to disk.
Implementations§
Source§impl TokenStore
impl TokenStore
Sourcepub fn new() -> Result<Self, TokenStoreError>
pub fn new() -> Result<Self, TokenStoreError>
Create a new token store using the default path.
Sourcepub fn save(&self, token: &Token) -> Result<(), TokenStoreError>
pub fn save(&self, token: &Token) -> Result<(), TokenStoreError>
Save a token to disk.
Creates the parent directory if it doesn’t exist. Sets restrictive file permissions (0600) on Unix systems.
Sourcepub fn load(&self) -> Result<Token, TokenStoreError>
pub fn load(&self) -> Result<Token, TokenStoreError>
Load a token from disk.
Returns NotFound error if no token file exists.
Sourcepub fn delete(&self) -> Result<(), TokenStoreError>
pub fn delete(&self) -> Result<(), TokenStoreError>
Delete the stored token.
Auto Trait Implementations§
impl Freeze for TokenStore
impl RefUnwindSafe for TokenStore
impl Send for TokenStore
impl Sync for TokenStore
impl Unpin for TokenStore
impl UnwindSafe for TokenStore
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