Documentation
¶
Index ¶
- Variables
- func CredentialKey(host string) string
- func DeleteHostCredentials(host string) error
- func ForceRefreshToken(ctx context.Context, host string) (string, error)
- func GetValidToken(ctx context.Context, host string) (string, error)
- func Login(ctx context.Context, host string) error
- func Logout(host string) error
- func OpenBrowser(url string) error
- func SaveConfig(cfg *Config) error
- func SaveCredentials(creds Credentials) error
- func SaveHostCredentials(host string, hostCreds HostCredentials) error
- type Config
- type Credentials
- type HostCredentials
Constants ¶
This section is empty.
Variables ¶
var ErrNotRefreshable = errors.New("no refresh token stored")
ErrNotRefreshable reports that the stored credentials for a host carry no refresh token, so no amount of retrying will produce a new access token.
Functions ¶
func CredentialKey ¶ added in v0.13.0
CredentialKey normalizes a host to its bare form (without "api." prefix) so that credentials are stored and looked up consistently regardless of whether the caller passes "acme.nullify.ai" or "api.acme.nullify.ai".
func DeleteHostCredentials ¶
func ForceRefreshToken ¶ added in v0.25.3
ForceRefreshToken exchanges the stored refresh token for a new access token regardless of the recorded expiry. GetValidToken only refreshes once ExpiresAt has elapsed, which leaves callers no way to recover from a token the server rejects while the CLI still believes it is valid -- revocation, a killed session, or a local clock running behind the server's.
func OpenBrowser ¶ added in v0.13.0
OpenBrowser opens the given URL in the user's default browser.
func SaveConfig ¶
func SaveCredentials ¶
func SaveCredentials(creds Credentials) error
func SaveHostCredentials ¶
func SaveHostCredentials(host string, hostCreds HostCredentials) error
Types ¶
type Credentials ¶
type Credentials map[string]HostCredentials
func LoadCredentials ¶
func LoadCredentials() (Credentials, error)