Documentation
¶
Index ¶
Constants ¶
View Source
const ( StoreAuto = "auto" StoreKeychain = "keychain" StoreFile = "file" KeyringService = "Thalassa Cloud CLI" ThalassaCredentialStoreEnvVar = "THALASSA_CREDENTIAL_STORE" )
Variables ¶
View Source
var ErrNotAvailable = errors.New("credential store not available")
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err indicates missing credentials in the keychain.
func PreferredStore ¶
func PreferredStore() string
PreferredStore reads THALASSA_CREDENTIAL_STORE and returns a normalized store preference.
func ResetKeyring ¶
func ResetKeyring()
ResetKeyring removes all CLI credentials from the keychain. Intended for tests.
func UseKeychain ¶
UseKeychain reports whether secrets for the given user store should be kept in the keychain.
Types ¶
type Secrets ¶
type Secrets struct {
Token string `json:"token,omitempty"`
AccessToken string `json:"accessToken,omitempty"`
RefreshToken string `json:"refreshToken,omitempty"`
AccessTokenExpiry string `json:"accessTokenExpiry,omitempty"`
ClientID string `json:"clientID,omitempty"`
ClientSecret string `json:"clientSecret,omitempty"`
}
Secrets holds sensitive user credentials.
type Store ¶
type Store interface {
Name() string
Available() bool
Set(userName string, secrets Secrets) error
Get(userName string) (Secrets, error)
Delete(userName string) error
}
Store persists credentials outside the config file.
func ResolveStore ¶
ResolveStore returns the credential store to use for the given preference.
Click to show internal directories.
Click to hide internal directories.