pub struct GitCredentialStore<S: SecretsStore> { /* private fields */ }Expand description
Store for Git authentication credentials.
Wraps a SecretsStore and organises data into two scopes:
git_credentials_meta: JSON-serialisedGitCredentialmetadata (everything except the secret value).git_credentials: The raw PAT or SSH key as an encrypted secret.
Implementations§
Source§impl<S: SecretsStore> GitCredentialStore<S>
impl<S: SecretsStore> GitCredentialStore<S>
Sourcepub fn new(store: S) -> Self
pub fn new(store: S) -> Self
Create a new Git credential store backed by the provided secrets store.
Sourcepub async fn create(
&self,
name: &str,
value: &str,
kind: GitCredentialKind,
) -> Result<GitCredential>
pub async fn create( &self, name: &str, value: &str, kind: GitCredentialKind, ) -> Result<GitCredential>
Store a new Git credential.
Generates a UUID for the credential, stores the PAT/SSH key as an
encrypted secret in the git_credentials scope, and the metadata as
JSON in the git_credentials_meta scope.
§Arguments
name- Human-readable label (e.g."GitHub PAT for ci")value- The PAT or SSH key content (stored encrypted)kind- Whether this is a PAT or SSH key
§Errors
Returns a SecretsError if serialisation or storage fails.
Sourcepub async fn get(&self, id: &str) -> Result<Option<GitCredential>>
pub async fn get(&self, id: &str) -> Result<Option<GitCredential>>
Retrieve credential metadata (without the secret value).
Returns None if no credential with the given id exists.
§Errors
Returns a SecretsError on storage/decryption errors.
Sourcepub async fn get_value(&self, id: &str) -> Result<Secret>
pub async fn get_value(&self, id: &str) -> Result<Secret>
Retrieve the PAT or SSH key for a Git credential.
§Errors
Returns SecretsError::NotFound if the credential does not exist.
Sourcepub async fn list(&self) -> Result<Vec<GitCredential>>
pub async fn list(&self) -> Result<Vec<GitCredential>>
List all Git credentials (metadata only, no secret values).
§Errors
Returns a SecretsError on storage/decryption errors.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for GitCredentialStore<S>where
S: Freeze,
impl<S> RefUnwindSafe for GitCredentialStore<S>where
S: RefUnwindSafe,
impl<S> Send for GitCredentialStore<S>
impl<S> Sync for GitCredentialStore<S>
impl<S> Unpin for GitCredentialStore<S>where
S: Unpin,
impl<S> UnsafeUnpin for GitCredentialStore<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for GitCredentialStore<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more