Documentation
¶
Overview ¶
Package gitcredentials owns the per-user git PAT credential surface (list / create / delete). The token plaintext is encrypted at rest under "git_credential/{id}/token" via secrets.Store and is never returned by any method on this Service — DTOs deliberately omit it, so a caller can't accidentally serialize the secret. Per-row runtime lookups that need the encrypted ref (agent build pipeline) hit dbq.GetGitCredential directly with their own ownership check; this service is for the operator's own CRUD against their credential list.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
CreateRequest is the input for Create. Type "" defaults to "pat".
type Credential ¶
type Credential struct {
ID uuid.UUID
UserID uuid.UUID
Type string
Name string
GithubInstallID string
CreatedAt pgtype.Timestamptz
LastUsedAt pgtype.Timestamptz
}
Credential is the wire shape the handler / sysagent tool sees. No token field exists — by design, so accidental serialization can't leak the secret.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the per-user git PAT layer. All methods gate on the principal being an authenticated user; there is no agent axis.
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, p authz.Principal, req CreateRequest) (Credential, error)
Create encrypts the token under a generated id and persists the row. Returns ErrInvalidInput (Detail-wrapped) on missing name/token or unsupported type, ErrConflict on a duplicate name for this user.