Documentation
¶
Overview ¶
Package credentials resolves the Pipedrive API token from secure storage. The OS keyring (libsecret on Linux, Keychain on macOS, Credential Manager on Windows) is the persistent home; the env var fallback exists for CI, automation, and any environment where the keyring is unavailable (headless SSH, WSL without DBus, containers).
Resolution order (first non-empty wins):
- PIPEDRIVE_API_TOKEN env var. Mirrors gh's GH_TOKEN, aws's AWS_ACCESS_KEY_ID, etc. — env explicitly overrides stored credentials so an operator can use a different token without running `pipedrive-mcp login` again.
- OS keyring entry under serviceName, account = company domain.
If env is unset and the keyring lookup fails for any reason other than "entry not found" (no DBus, no Secret Service, etc.), the underlying error is returned so the user sees what to fix.
Index ¶
Constants ¶
const EnvVar = "PIPEDRIVE_API_TOKEN"
EnvVar is the env-var fallback. Documented for CI use.
const ServiceName = "pipedrive-mcp"
ServiceName is the keyring service identifier. Same value across all platforms; the keyring backend handles platform-specific storage.
Variables ¶
var ErrNotFound = errors.New("credentials: no token found in keyring or PIPEDRIVE_API_TOKEN")
ErrNotFound is returned when no token is configured anywhere.
Functions ¶
func Delete ¶
Delete removes the keyring entry for the given domain. No-op if the entry did not exist.
func IsNotFound ¶
IsNotFound reports whether err signals a missing keyring entry (as opposed to the keyring being unavailable entirely).
Types ¶
type Backend ¶
type Backend interface {
Get(service, account string) (string, error)
Set(service, account, token string) error
Delete(service, account string) error
}
Backend is the minimal keyring contract this package depends on. Tests substitute an in-memory implementation; production wires it to github.com/zalando/go-keyring.
type Source ¶
type Source string
Source identifies which path a resolved token came from. Useful for log fields and tests.
Source values returned by Resolve.