Documentation
¶
Overview ¶
Package state manages runtime data that changes frequently and must not be managed declaratively: JWT tokens, current project selection, and the active profile pointer. It mirrors the XDG Base Directory Specification by storing data under XDG_STATE_HOME (default: $HOME/.local/state).
Index ¶
Constants ¶
const ( KindPassword = "password" KindDevice = "device" KindPAT = "pat" )
Credential kinds stored on ProfileState.CredentialKind. An empty value is treated as a legacy password login (non-refreshable).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProfileState ¶
type ProfileState struct {
JWT string `json:"jwt"`
RefreshToken string `json:"refresh_token,omitempty"`
TokenExpiresAt int64 `json:"token_expires_at,omitempty"`
CredentialKind string `json:"credential_kind,omitempty"`
CurrentProjectID string `json:"current_project_id,omitempty"`
}
ProfileState holds runtime state for a single Traceway profile.
type State ¶
type State struct {
CurrentProfile string `json:"current_profile"`
Profiles map[string]ProfileState `json:"profiles"`
}
State is the on-disk runtime state file.
func Load ¶
Load reads the state file from disk. A missing file yields an empty State (not an error) — the caller treats absence of credentials as an auth error only when an actual command needs them.