Documentation
¶
Overview ¶
Package credentials defines the common contract for credential providers.
A resolved Secret owns its byte buffer. Callers must close it as soon as the child process has consumed the credential.
Index ¶
Constants ¶
const ( ProviderOnePassword = "1password" ProviderCommand = "command" ProviderEnvironment = "environment" ProviderNative = "native" )
Variables ¶
var ( ErrInvalidReference = errors.New("invalid credential reference") ErrNativeCredential = errors.New("credential is managed by the native client") )
Functions ¶
func Fingerprint ¶
Fingerprint returns the first 96 bits of a domain-separated SHA-256 digest.
Types ¶
type Metadata ¶
Metadata is safe to display or log. Label must never contain credential material or command arguments.
type Provider ¶
type Provider interface {
Available(context.Context, Reference) bool
Resolve(context.Context, Reference) (*Secret, error)
Metadata(Reference) Metadata
}
Provider resolves one kind of credential reference.
type Reference ¶
Reference is the provider configuration stored in an environment manifest. Identifier is an opaque provider-specific reference (for example, an op URI or environment variable name). Executable and Arguments are used only by the command provider.
type Secret ¶
type Secret struct {
// contains filtered or unexported fields
}
Secret is a short-lived credential buffer. Secret is not safe for concurrent use. Close must be called exactly once by the owner when practical.
func NewSecret ¶
NewSecret takes ownership of value. The caller must not retain or mutate the slice after this call.
func RunSecretCommand ¶
func RunSecretCommand(ctx context.Context, executable string, arguments, environment []string) (*Secret, error)
RunSecretCommand executes a credential helper without a shell. Its stdout is retained as the secret, while stderr and stdout are deliberately excluded from returned errors because either stream may contain credential material.
func (*Secret) Fingerprint ¶
Fingerprint returns a short, non-reversible identifier suitable for comparing two resolved credentials. It does not reveal the credential.