credentials

package
v0.0.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("credentials: no token stored")

ErrNotFound is returned by Load and Delete when no token is stored.

Functions

func Delete

func Delete(configDir string) error

Delete removes the stored token from the keychain or credentials file. Returns ErrNotFound if no token was stored anywhere.

func DeleteService

func DeleteService(configDir, service string) error

DeleteService removes a service-specific token from the keychain or credentials file. Returns ErrNotFound if no token was stored anywhere.

func Load

func Load(configDir string) (string, error)

Load retrieves the token from the OS keychain or credentials file. Returns ErrNotFound if no token is stored.

func LoadService

func LoadService(configDir, service string) (string, error)

LoadService retrieves a service-specific token from the OS keychain or credentials file. Returns ErrNotFound if no token is stored.

func Resolve

func Resolve(configDir string) string

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

func ResolveService(configDir, service string, envVars []string) string

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

func Store(configDir, token string) error

Store saves the token to the OS keychain. Falls back to <configDir>/credentials (0600) if the keychain is unavailable.

func StoreService

func StoreService(configDir, service, token string) error

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.

Jump to

Keyboard shortcuts

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