Documentation
¶
Index ¶
- type Check
- type DaemonState
- type Identity
- type Profile
- type Store
- func (s *Store) AuthChanged() bool
- func (s *Store) Current() (string, bool, error)
- func (s *Store) Daemon() DaemonState
- func (s *Store) Doctor() []Check
- func (s *Store) Import(name string) error
- func (s *Store) List() ([]string, string, error)
- func (s *Store) Login(name string, runLogin func(home string) error) (string, error)
- func (s *Store) Logout(name string, runLogout func(home string) error) (string, error)
- func (s *Store) Profiles() ([]Profile, error)
- func (s *Store) Remove(name string) (string, error)
- func (s *Store) Rename(oldName, newName string) (string, error)
- func (s *Store) Show(name string) (Profile, error)
- func (s *Store) Sync() (string, error)
- func (s *Store) Use(name string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DaemonState ¶ added in v0.2.1
type DaemonState struct {
daemon.Status
// Stale means the daemon is running and started before codexctl last
// changed auth.json, so it still uses the credentials it loaded then.
Stale bool
// Profile is the profile that change activated, or "" if it signed Codex
// out. It is only set when Stale is true.
Profile string
}
DaemonState describes the Codex app-server daemon relative to the active auth.json.
type Identity ¶ added in v0.2.0
type Identity struct {
AuthMode string `json:"auth_mode,omitempty"`
AccountID string `json:"account_id,omitempty"`
Email string `json:"email,omitempty"`
Plan string `json:"plan,omitempty"`
LastRefresh string `json:"last_refresh,omitempty"`
}
Identity is the non-secret description of a credential file. It never carries tokens or API keys, so it is safe to print.
type Profile ¶ added in v0.2.0
type Profile struct {
Name string `json:"name"`
Selected bool `json:"selected"`
Valid bool `json:"valid"`
Identity
}
Profile describes a saved profile without exposing its credentials.
type Store ¶
type Store struct {
CodexHome string
StateHome string
// DetectDaemon inspects the app-server daemon of a Codex home. Nil means
// daemon.Detect; tests substitute a fake.
DetectDaemon func(codexHome string) daemon.Status
// contains filtered or unexported fields
}
func NewFromEnvironment ¶
func (*Store) AuthChanged ¶ added in v0.2.1
AuthChanged reports whether this Store changed the active auth.json, including by finishing an interrupted switch.
func (*Store) Daemon ¶ added in v0.2.1
func (s *Store) Daemon() DaemonState
Daemon reports the app-server daemon of this Codex home and whether it predates the last account switch.
func (*Store) Import ¶ added in v0.2.0
Import saves the active auth.json as a new profile and selects it. It is meant for accounts that were logged in with plain `codex login` before codexctl was installed.
func (*Store) Logout ¶ added in v0.2.0
Logout runs `codex logout` for a saved profile inside an isolated home, so the session is revoked without touching the real Codex home, then deletes the profile. If the profile was selected and the active auth.json holds the same account, that file is removed as well, since its tokens are no longer usable.
func (*Store) Profiles ¶ added in v0.2.0
Profiles returns every saved profile with its identity, sorted by name.
func (*Store) Remove ¶ added in v0.2.0
Remove deletes a saved profile. Removing the selected profile clears the selection but leaves the active auth.json in place, so Codex stays logged in; use `codex logout` to sign out of the account itself.
func (*Store) Rename ¶ added in v0.2.0
Rename gives a saved profile a new name. If the profile is the selected one, its refreshed credentials are saved first and the selection follows the new name. The active auth.json is not touched.