pub struct CredentialStore { /* private fields */ }Expand description
The credential store: auth.json in the agent directory, or memory.
Implementations§
Source§impl CredentialStore
impl CredentialStore
Sourcepub fn open(path: impl Into<PathBuf>) -> CredentialStore
pub fn open(path: impl Into<PathBuf>) -> CredentialStore
The store backed by path, loaded now. An unreadable file reads as empty.
Sourcepub fn read_error(&self) -> Option<String>
pub fn read_error(&self) -> Option<String>
Why the file cannot be read now, as pi’s store reports it. Reads meanwhile see the last document that could be.
Sourcepub fn get(&self, provider: &str) -> Option<Credential>
pub fn get(&self, provider: &str) -> Option<Credential>
The stored credential for provider, if it is a valid one.
Sourcepub fn list(&self) -> Vec<(String, CredentialKind)>
pub fn list(&self) -> Vec<(String, CredentialKind)>
Stored providers and their credential kinds, in file order.
Sourcepub async fn modify<F, Fut>(
&self,
provider: &str,
change: F,
cancel: &CancellationToken,
) -> Result<Option<Credential>, AuthError>where
F: FnOnce(Option<Credential>) -> Fut,
Fut: Future<Output = Result<Option<Credential>, AuthError>>,
pub async fn modify<F, Fut>(
&self,
provider: &str,
change: F,
cancel: &CancellationToken,
) -> Result<Option<Credential>, AuthError>where
F: FnOnce(Option<Credential>) -> Fut,
Fut: Future<Output = Result<Option<Credential>, AuthError>>,
Replaces provider’s credential with what change returns for the
current one, under the lock. None leaves the file untouched. Returns the
credential now stored.
Sourcepub async fn set(
&self,
provider: &str,
credential: Credential,
cancel: &CancellationToken,
) -> Result<(), AuthError>
pub async fn set( &self, provider: &str, credential: Credential, cancel: &CancellationToken, ) -> Result<(), AuthError>
Stores credential for provider.
Trait Implementations§
Source§impl Debug for CredentialStore
impl Debug for CredentialStore
Auto Trait Implementations§
impl !Freeze for CredentialStore
impl Forget 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