Documentation
¶
Index ¶
- type Check
- type Identity
- type Profile
- type Store
- func (s *Store) Current() (string, bool, error)
- 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 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 ¶
func NewFromEnvironment ¶
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.