secrets

package
v0.40.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package secrets is the cross-platform credential store with the canonical User > Install > Env > None resolution hierarchy. Wraps the platform secret store (DPAPI on Windows, file fallback elsewhere) so provider API keys never have to live in config.toml on disk in plaintext.

Audit 2026-05-24 maintainability sweep.

Index

Constants

This section is empty.

Variables

View Source
var ErrSecureStoreUnavailable = errors.New("secrets: secure secret storage unavailable on this OS")

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 ClearNamedSecret(name string) error

func ClearUserHuggingFaceToken

func ClearUserHuggingFaceToken() error

func DefaultDopplerSecretLookup added in v0.14.6

func DefaultDopplerSecretLookup(dopplerPath, key, project, cfg string) (string, error)

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

func FindDopplerExecutable(lookPath func(string) (string, error)) string

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 MigrateInstallTokenBootstrap

func MigrateInstallTokenBootstrap() (bool, error)

func SetInstallHuggingFaceToken

func SetInstallHuggingFaceToken(token string) error

func SetNamedSecret added in v0.14.8

func SetNamedSecret(name, value string) error

func SetUserHuggingFaceToken

func SetUserHuggingFaceToken(token string) error

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL