Documentation
¶
Overview ¶
Package store persists the Hadron access token, preferring the OS keychain and falling back to a 0600 file when no keychain is available (CI containers, headless boxes).
Index ¶
Constants ¶
const EnvToken = "HADRON_TOKEN"
EnvToken is the environment variable that overrides any stored token (CI and scripting; same role as GH_TOKEN for gh).
Variables ¶
var ErrNotFound = errors.New("no stored token")
ErrNotFound is returned when no token is stored for a host.
Functions ¶
func ClearExcept ¶ added in v0.6.0
ClearExcept removes host's token from every backend EXCEPT keep, so a login that writes to one store doesn't leave a stale duplicate readable in the other (#116). It returns a non-nil error when a stale token could NOT be removed from another backend (so the caller can warn) — a silent failure would preserve exactly the cross-backend stale credential this is meant to eliminate. An unavailable keychain is skipped.
func Purge ¶ added in v0.6.0
Purge removes host's token from EVERY backend, so a token persisted in one store during an earlier login can't survive a logout that resolved to the other (#116). A delete failure against an UNAVAILABLE keychain (headless box) is skipped — nothing can be deleted there and the user can't act on it — but a genuine file error, or a delete that fails against an AVAILABLE keychain (the token is still stored), propagates so logout can't falsely report success. Returns whether any backend actually held a token.
Types ¶
type Keyring ¶
type Keyring struct{}
Keyring stores tokens in the OS keychain (macOS Keychain, libsecret, Windows Credential Manager).