zlayer_types/secrets/git.rs
1//! Git credential data shapes (the wire/storage form, not the store impl).
2//!
3//! Lifted into `zlayer-types` so cross-crate consumers can name these
4//! without depending on `zlayer-secrets`. The store impl
5//! (`GitCredentialStore`) stays in `zlayer-secrets` and consumes these
6//! types from here.
7
8use serde::{Deserialize, Serialize};
9
10/// Git authentication credential metadata.
11///
12/// The actual PAT or SSH key is stored separately as a [`Secret`] in the
13/// `git_credentials` scope, keyed by [`id`](GitCredential::id).
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct GitCredential {
16 /// Unique identifier (UUID v4).
17 pub id: String,
18 /// Human-readable display label, e.g. `"GitHub PAT for ci"`.
19 pub name: String,
20 /// Whether this credential is a personal access token or an SSH key.
21 pub kind: GitCredentialKind,
22}
23
24/// The kind of Git credential.
25#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
26#[serde(rename_all = "snake_case")]
27pub enum GitCredentialKind {
28 /// Personal access token.
29 Pat,
30 /// SSH private key.
31 SshKey,
32}