auth

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeprecatedError added in v1.0.6

func DeprecatedError(action string) error

func EnvRefreshToken added in v1.3.1

func EnvRefreshToken() string

EnvRefreshToken returns the refresh token supplied via the environment, or "" when unset. When set it takes precedence over the saved token file.

func GetToken

func GetToken() (string, error)

GetToken returns a valid access token, refreshing if needed.

func Login

func Login(email, password string) error

Login authenticates via the Liftoff tRPC user.signIn procedure.

func Logout

func Logout() error

Logout removes the stored auth tokens.

func ResolveAPIBase added in v1.0.6

func ResolveAPIBase() string

ResolveAPIBase returns the env override LIFTOFF_API_BASE if set, else the compiled-in default. Liftoff mints version-pinned hosts (e.g. v2-13-0) and retires older ones; the env var lets users dodge a deprecation without waiting for a new release. Logged once when an override is in effect so users can tell which endpoint is active when something breaks.

func Save

func Save(store *TokenStore) error

func SaveFromCapture

func SaveFromCapture(accessToken, refreshToken, expiresAt string) error

SaveFromCapture stores tokens captured manually (e.g. from MITM).

Types

type TokenStore

type TokenStore struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
}

func Load added in v1.1.0

func Load() (*TokenStore, error)

Load reads the saved token store without attempting a refresh. Returns (nil, error) when no token has been saved yet. Suitable for non-mutating status checks; use GetToken when an action needs a usable access token.

func Refresh

func Refresh(refreshToken string) (*TokenStore, error)

Refresh exchanges a refresh token for a new access token and saves the result. Use refresh directly when the tokens must not touch disk.

Jump to

Keyboard shortcuts

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