Documentation
¶
Overview ¶
Package keyring provides credential storage using the OS keychain, with an optional tmpfs-backed store for headless Linux hosts.
Index ¶
- Constants
- func ClearRefreshToken(org string) error
- func MockForTesting()
- func ResetForTesting()
- func ValidateCredentialStore(store string) error
- type Keyring
- func (k *Keyring) Delete(org string) error
- func (k *Keyring) DeleteRefreshToken(org string) error
- func (k *Keyring) Description() string
- func (k *Keyring) Get(org string) (string, error)
- func (k *Keyring) GetRefreshToken(org string) (string, error)
- func (k *Keyring) IsAvailable() bool
- func (k *Keyring) Set(org, token string) error
- func (k *Keyring) SetRefreshToken(org, token string) error
Constants ¶
const ( // CredentialStoreEnv selects the credential store used by keyring.New. // Supported values are "auto", "keyring", and "shm". CredentialStoreEnv = "BUILDKITE_CREDENTIAL_STORE" // CredentialStorePathEnv overrides the tmpfs credential file path. It is // mainly useful for tests and controlled environments. CredentialStorePathEnv = "BUILDKITE_CREDENTIAL_STORE_PATH" StoreAuto = "auto" StoreKeyring = "keyring" StoreSHM = "shm" )
Variables ¶
This section is empty.
Functions ¶
func ClearRefreshToken ¶ added in v3.46.0
ClearRefreshToken removes any stored OAuth refresh token for an organization. This is used when replacing OAuth credentials with a non-OAuth API token.
func MockForTesting ¶
func MockForTesting()
MockForTesting replaces the keyring backend with an in-memory store and marks it as available so subsequent New() calls use the mock.
func ResetForTesting ¶ added in v3.35.0
func ResetForTesting()
ResetForTesting resets the availability cache so that the next call to New() re-evaluates the environment. Intended for use in tests only.
func ValidateCredentialStore ¶ added in v3.46.0
Types ¶
type Keyring ¶
type Keyring struct {
// contains filtered or unexported fields
}
Keyring provides credential storage with fallback support.
func New ¶
func New() *Keyring
New creates a new Keyring instance using the default credential store mode.
func NewWithCredentialStore ¶ added in v3.46.0
NewWithCredentialStore creates a keyring using the requested credential store. An empty store uses the default auto mode.
func (*Keyring) DeleteRefreshToken ¶ added in v3.42.0
DeleteRefreshToken removes a refresh token for the given organization
func (*Keyring) Description ¶ added in v3.46.0
Description returns a user-facing description of the active credential store.
func (*Keyring) GetRefreshToken ¶ added in v3.42.0
GetRefreshToken retrieves a refresh token for the given organization
func (*Keyring) IsAvailable ¶
IsAvailable returns true if the configured credential store is available.
func (*Keyring) SetRefreshToken ¶ added in v3.42.0
SetRefreshToken stores a refresh token for the given organization