{"modulePath":"github.com/Stackdome/stackdome","version":"v0.0.7-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package credentials\n\nPackage credentials defines the credential-resolution seam shared by the service layer and its consumers (validators, workers). The canonical implementation lives in pkg/services; the types are declared here so packages that the services layer itself depends on can consume the resolver without an import cycle.\n\n## Functions\n\n```go\nfunc ClusterSecretNameForGitHost(host string) string\n```\nClusterSecretNameForGitHost returns the deterministic name of the cluster secret synthesized for an org-level git integration.\n\n```go\nfunc ClusterSecretNameForRegistryHost(host string, purpose RegistryPurpose) string\n```\nClusterSecretNameForRegistryHost returns the deterministic name of the cluster secret synthesized for an org-level registry credential. The purpose is part of the name so a pull credential and a push credential sharing a host (potentially different accounts) map to distinct cluster secrets.\n\n## Types\n\n```go\ntype GitAuthSelector struct {\n\t// IntegrationID pins an org-level git integration; resolution lands with\n\t// git integrations.\n\tIntegrationID string\n}\n```\nGitAuthSelector carries the explicit per-resource overrides for git credential resolution. The zero value selects no override.\n\n```go\ntype RegistryAuthSelector struct {\n\t// RegistryCredentialID pins an org-level registry credential, overriding\n\t// host auto-attach.\n\tRegistryCredentialID string\n}\n```\nRegistryAuthSelector carries the explicit per-resource overrides for registry credential resolution. The zero value selects no override.\n\n```go\ntype RegistryPurpose string\n```\nRegistryPurpose distinguishes pull from push resolution for registries.\n\n```go\nconst (\n\tRegistryPurposePull RegistryPurpose = \"pull\"\n\tRegistryPurposePush RegistryPurpose = \"push\"\n)\n```\n\n```go\ntype ResolvedGitCredential struct {\n\tSource      Source\n\tCredentials gitclient.GitCredentials // zero value == anonymous\n\tDataHash    string                   // for SecretDataHashAnnotation / release freezing\n\n\t// IntegrationID and Host identify the org-level git integration when\n\t// Source == SourceIntegration.\n\tIntegrationID string\n\tHost          string\n\n\t// TokenMintedAt/TokenExpiresAt are set when the credentials are a minted\n\t// GitHub App installation token; they drive hub-side refresh.\n\tTokenMintedAt  *time.Time\n\tTokenExpiresAt *time.Time\n}\n```\n\n```go\ntype ResolvedRegistryCredential struct {\n\tSource   Source\n\tUsername string\n\tPassword string\n\tDataHash string\n\n\t// CredentialID and Host identify the org-level registry credential when\n\t// Source == SourceIntegration. Host is the normalized registry host.\n\tCredentialID string\n\tHost         string\n\n\t// Purpose is the resolution purpose (pull vs push) this credential was\n\t// resolved for. It disambiguates the deterministic cluster-secret name for\n\t// org-level credentials: a pull credential and a push credential can share\n\t// the same host but hold different accounts, so they must not collide.\n\tPurpose RegistryPurpose\n}\n```\n\n```go\ntype Resolver interface {\n\tGitCredentials(ctx context.Context, orgID, repoURL string, selector GitAuthSelector) (*ResolvedGitCredential, *errors.ServiceError)\n\tRegistryCredentials(ctx context.Context, orgID, ref string, purpose RegistryPurpose, selector RegistryAuthSelector) (*ResolvedRegistryCredential, *errors.ServiceError)\n}\n```\nResolver resolves credentials for git/registry targets with fixed precedence: explicit secret ref \u003e explicit integration/credential ID \u003e org-level integration matched by host \u003e anonymous.\n\n```go\ntype Source string\n```\nSource identifies where a resolved credential came from.\n\n```go\nconst (\n\t// SourceIntegration is an org-level integration matched by host\n\t// (registry credentials / git integrations).\n\tSourceIntegration Source = \"integration\"\n\t// SourceAnonymous means no credentials apply.\n\tSourceAnonymous Source = \"anonymous\"\n)\n```\n\n","path":"github.com/Stackdome/stackdome/pkg/credentials","name":"credentials","synopsis":"Package credentials defines the credential-resolution seam shared by the service layer and its consumers (validators, workers).","isRedistributable":true}
