pub struct CredentialStore { /* private fields */ }Expand description
Where the CLI keeps its credentials.
The directory is supplied by the caller rather than derived here. That is
what lets $ATLASSIAN_CLI_CONFIG_DIR move it, and it is what lets the tests
run against a temporary directory instead of the developer’s real one.
Implementations§
Source§impl CredentialStore
impl CredentialStore
pub fn new(dir: impl Into<PathBuf>) -> Self
pub fn dir(&self) -> &Path
Sourcepub fn credentials_path(&self) -> PathBuf
pub fn credentials_path(&self) -> PathBuf
The pre-encryption credentials file. Still read so an old install keeps
working until migrate_plaintext_to_encrypted runs.
pub fn encrypted_path(&self) -> PathBuf
Sourcepub fn set(&self, account: &str, secret: &str) -> Result<()>
pub fn set(&self, account: &str, secret: &str) -> Result<()>
Store a secret in the plaintext credentials file.
Sourcepub fn get(&self, account: &str) -> Result<Option<String>>
pub fn get(&self, account: &str) -> Result<Option<String>>
Read a secret from the plaintext credentials file.
Sourcepub fn delete(&self, account: &str) -> Result<()>
pub fn delete(&self, account: &str) -> Result<()>
Remove a secret from the plaintext credentials file.
Sourcepub fn set_encrypted(&self, account: &str, secret: &str) -> Result<()>
pub fn set_encrypted(&self, account: &str, secret: &str) -> Result<()>
Store an encrypted secret.
Sourcepub fn delete_encrypted(&self, account: &str) -> Result<()>
pub fn delete_encrypted(&self, account: &str) -> Result<()>
Remove an encrypted secret.
Sourcepub fn migrate_plaintext_to_encrypted(&self) -> Result<usize>
pub fn migrate_plaintext_to_encrypted(&self) -> Result<usize>
Re-store any plaintext credentials as encrypted ones, then securely delete the plaintext file. Returns how many were migrated.
Trait Implementations§
Source§impl Clone for CredentialStore
impl Clone for CredentialStore
Source§fn clone(&self) -> CredentialStore
fn clone(&self) -> CredentialStore
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 moreAuto 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