Documentation
¶
Overview ¶
Package secrets parses and resolves value references (SPEC §3.6, T10):
literal:VALUE a non-secret value, used as-is env:VAR an environment variable keyring:SERVICE/KEY an OS keyring item
Every reference needs an explicit scheme, so a secret can't be pasted in as a bare string by accident. Secrets themselves (auth credentials, and secrets on the command line, where other local users can read them) must be env: or keyring:. Errors name the reference, never the value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoScheme = errors.New("value needs an explicit literal:, env: or keyring: prefix") ErrLiteralSecret = errors.New("secrets must come from env: or keyring:, not a literal value") ErrInvalidRef = errors.New("invalid reference") ErrNotFound = errors.New("secret not found") ErrEmpty = errors.New("secret is empty") ErrKeyring = errors.New("keyring error") ErrKeyringItemNotFound = errors.New("keyring item not found") )
Sentinel errors callers can match with errors.Is.
Functions ¶
This section is empty.
Types ¶
type KeyringGetter ¶
KeyringGetter reads an OS keyring item. It returns ErrKeyringItemNotFound for a missing item.
type OSKeyring ¶
type OSKeyring struct{}
OSKeyring is the OS credential store: Windows Credential Manager, macOS Keychain or the Secret Service on Linux.
type Ref ¶
Ref is a parsed reference. Only the fields for its Scheme are set.
func ParseSecretRef ¶
ParseSecretRef parses a reference that must hold a secret: env: or keyring: only.
type Resolver ¶
type Resolver struct {
LookupEnv func(string) (string, bool)
Keyring KeyringGetter
}
Resolver resolves references.
func NewResolver ¶
func NewResolver() *Resolver
NewResolver resolves against the process environment and the OS keyring.