Documentation
¶
Index ¶
- Variables
- func ValidateName(name string) error
- type Check
- type DaemonState
- type Identity
- type Profile
- type ProfileHome
- type Result
- type Store
- func (s *Store) AuthPath() string
- func (s *Store) Current() (string, bool, error)
- func (s *Store) Daemon() DaemonState
- func (s *Store) Doctor() []Check
- func (s *Store) Import(name string) (Result, error)
- func (s *Store) Inspect(names []string, inspect func(name string, home ProfileHome) error) ([]error, Result, error)
- func (s *Store) List() ([]string, string, error)
- func (s *Store) Login(name string, runLogin func(home string) error) (Result, error)
- func (s *Store) Logout(name string, runLogout func(home string) error) (Result, error)
- func (s *Store) Profiles() ([]Profile, error)
- func (s *Store) Purge(before func() error) error
- func (s *Store) Remove(name string) (Result, error)
- func (s *Store) Rename(oldName, newName string) (Result, error)
- func (s *Store) Show(name string) (Profile, error)
- func (s *Store) Sync() (Result, error)
- func (s *Store) Use(name string) (Result, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotChatGPT = errors.New("not a ChatGPT login")
Functions ¶
func ValidateName ¶ added in v0.3.0
Types ¶
type DaemonState ¶ added in v0.2.1
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 never carries tokens or API keys, so it is safe to print.
type ProfileHome ¶ added in v0.3.2
type Store ¶
type Store struct {
CodexHome string
StateHome string
// DetectDaemon is daemon.Detect when nil.
DetectDaemon func(codexHome string) daemon.Status
}
func NewFromEnvironment ¶
func (*Store) Daemon ¶ added in v0.2.1
func (s *Store) Daemon() DaemonState
func (*Store) Inspect ¶ added in v0.3.2
func (s *Store) Inspect(names []string, inspect func(name string, home ProfileHome) error) ([]error, Result, error)
Inspect runs inspect in parallel with a Codex home holding each profile's login, and returns one error per name. The selected profile uses the real Codex home so it does not compete with running clients for its tokens; the others get isolated copies. A refresh retires the old refresh token, so refreshed copies are saved back, under the lock.
func (*Store) Logout ¶ added in v0.2.0
Logout revokes the session in an isolated home, then deletes the profile and an active auth.json of the same account.
func (*Store) Purge ¶ added in v0.3.0
Purge leaves the Codex home alone. before runs under the lock; if it fails nothing is removed.
func (*Store) Remove ¶ added in v0.2.0
Remove leaves the active auth.json, so Codex stays logged in.