credentials

package
v0.20.7 Latest Latest
Warning

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

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

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

func IsNotFound(err error) bool

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

func UseKeychain(preference, userStore string) bool

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.

func (Secrets) Empty

func (s Secrets) Empty() bool

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

func ResolveStore(preference string) Store

ResolveStore returns the credential store to use for the given preference.

Jump to

Keyboard shortcuts

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