pub struct CredentialStore { /* private fields */ }Expand description
Secure credential store backed by a JSON file with 0600 permissions.
Environment variables always take precedence over stored values.
Implementations§
Source§impl CredentialStore
impl CredentialStore
Sourcepub fn new(auth_path: Option<PathBuf>) -> Self
pub fn new(auth_path: Option<PathBuf>) -> Self
Create a new credential store.
If auth_path is None, defaults to ~/.opendev/auth.json.
Sourcepub fn get_key(&mut self, provider: &str) -> Option<String>
pub fn get_key(&mut self, provider: &str) -> Option<String>
Get API key for a provider. Environment variable takes precedence.
Sourcepub fn set_key(&mut self, provider: &str, key: &str) -> Result<(), HttpError>
pub fn set_key(&mut self, provider: &str, key: &str) -> Result<(), HttpError>
Store an API key for a provider.
Sourcepub fn remove_key(&mut self, provider: &str) -> Result<bool, HttpError>
pub fn remove_key(&mut self, provider: &str) -> Result<bool, HttpError>
Remove a stored API key. Returns true if the key existed.
Sourcepub fn list_providers(&mut self) -> Vec<ProviderStatus>
pub fn list_providers(&mut self) -> Vec<ProviderStatus>
List all known providers with their credential status.
Trait Implementations§
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