Documentation
¶
Overview ¶
Package secrets is the cross-platform credential store with the canonical User > Install > Env > None resolution hierarchy. Wraps the platform secret store so provider API keys never have to live in config.toml on disk in plaintext.
Backends: Windows seals each secret file with DPAPI; macOS seals each secret file with AES-256-GCM under a random 32-byte master key held in one login-Keychain generic-password item, which costs one Keychain prompt per build identity instead of one per secret. Both keep the blobs under runtimepath.SecretsDir(). Every other target has no encrypted store and fails closed with ErrSecureStoreUnavailable, so callers fall back to environment or Doppler-managed credentials rather than to plaintext on disk.
Audit 2026-05-24 maintainability sweep.
Index ¶
- Variables
- func ClearNamedSecret(name string) error
- func ClearUserHuggingFaceToken() error
- func DefaultDopplerSecretLookup(dopplerPath, key, project, cfg string) (string, error)
- func FindDopplerExecutable(lookPath func(string) (string, error)) string
- func MigrateInstallTokenBootstrap() (bool, error)
- func SetInstallHuggingFaceToken(token string) error
- func SetNamedSecret(name, value string) error
- func SetUserHuggingFaceToken(token string) error
- func UseMemoryStoreForTests() func()
- type TokenSource
- type TokenStatus
- func HuggingFaceTokenStatus(envResolver func() string) (TokenStatus, error)
- func NamedSecretStatus(name string, envResolver func() string) (TokenStatus, error)
- func ResolveHuggingFaceToken(envResolver func() string) (string, TokenStatus, error)
- func ResolveNamedSecret(name string, envResolver func() string) (string, TokenStatus, error)
Constants ¶
This section is empty.
Variables ¶
ErrSecureStoreUnavailable means the current OS has no supported encrypted secret store implementation. Callers should use environment variables or Doppler-managed install credentials instead of persisting local secrets.
Functions ¶
func ClearNamedSecret ¶ added in v0.14.8
func ClearUserHuggingFaceToken ¶
func ClearUserHuggingFaceToken() error
func DefaultDopplerSecretLookup ¶ added in v0.14.6
DefaultDopplerSecretLookup runs the Doppler CLI to retrieve a single secret value. It hides the console window on Windows to avoid terminal flashes in GUI mode.
func FindDopplerExecutable ¶ added in v0.14.6
FindDopplerExecutable locates the doppler CLI binary. lookPath is injected so callers (and tests) can substitute exec.LookPath. Checks DOPPLER_PATH env override, PATH, and common Windows installation directories.
func SetNamedSecret ¶ added in v0.14.8
func SetUserHuggingFaceToken ¶
func UseMemoryStoreForTests ¶
func UseMemoryStoreForTests() func()
Types ¶
type TokenSource ¶
type TokenSource string
const ( TokenSourceNone TokenSource = "none" TokenSourceUser TokenSource = "user" TokenSourceInstall TokenSource = "install" TokenSourceEnv TokenSource = "env" )
type TokenStatus ¶
type TokenStatus struct {
HasUserToken bool
HasInstallToken bool
ActiveSource TokenSource
}
func HuggingFaceTokenStatus ¶
func HuggingFaceTokenStatus(envResolver func() string) (TokenStatus, error)
func NamedSecretStatus ¶ added in v0.14.8
func NamedSecretStatus(name string, envResolver func() string) (TokenStatus, error)
func ResolveHuggingFaceToken ¶
func ResolveHuggingFaceToken(envResolver func() string) (string, TokenStatus, error)
func ResolveNamedSecret ¶ added in v0.14.8
func ResolveNamedSecret(name string, envResolver func() string) (string, TokenStatus, error)