Documentation
¶
Index ¶
- Variables
- func Delete(configDir string) error
- func DeleteService(configDir, service string) error
- func Load(configDir string) (string, error)
- func LoadService(configDir, service string) (string, error)
- func Resolve(configDir string) string
- func ResolveService(configDir, service string, envVars []string) string
- func Store(configDir, token string) error
- func StoreService(configDir, service, token string) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("credentials: no token stored")
ErrNotFound is returned by Load and Delete when no token is stored.
Functions ¶
func Delete ¶
Delete removes the stored token from the keychain or credentials file. Returns ErrNotFound if no token was stored anywhere.
func DeleteService ¶
DeleteService removes a service-specific token from the keychain or credentials file. Returns ErrNotFound if no token was stored anywhere.
func Load ¶
Load retrieves the token from the OS keychain or credentials file. Returns ErrNotFound if no token is stored.
func LoadService ¶
LoadService retrieves a service-specific token from the OS keychain or credentials file. Returns ErrNotFound if no token is stored.
func Resolve ¶
Resolve returns the best available token using the full priority chain: GH_TOKEN -> GITHUB_TOKEN -> GITHUB_TOOLS_SAP_TOKEN (legacy) -> keychain/file -> "". Never returns an error.
func ResolveService ¶
ResolveService returns the best available token for a service using the priority chain: env vars (in order) -> keychain/file -> "". Never returns an error.
func Store ¶
Store saves the token to the OS keychain. Falls back to <configDir>/credentials (0600) if the keychain is unavailable.
func StoreService ¶
StoreService saves a service-specific token to the OS keychain. Falls back to <configDir>/credentials-<service> (0600) if the keychain is unavailable.
Types ¶
This section is empty.