store

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Message string
	Warning bool
}

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
}

func NewFromEnvironment

func NewFromEnvironment() (*Store, error)

func (*Store) Current

func (s *Store) Current() (string, bool, error)

func (*Store) Doctor

func (s *Store) Doctor() []Check

func (*Store) Import added in v0.2.0

func (s *Store) Import(name string) error

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) List

func (s *Store) List() ([]string, string, error)

List returns the saved profile names in sorted order and the selected one.

func (*Store) Login

func (s *Store) Login(name string, runLogin func(home string) error) (string, error)

func (*Store) Logout added in v0.2.0

func (s *Store) Logout(name string, runLogout func(home string) error) (string, error)

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

func (s *Store) Profiles() ([]Profile, error)

Profiles returns every saved profile with its identity, sorted by name.

func (*Store) Remove added in v0.2.0

func (s *Store) Remove(name string) (string, error)

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

func (s *Store) Rename(oldName, newName string) (string, error)

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.

func (*Store) Show added in v0.2.0

func (s *Store) Show(name string) (Profile, error)

Show returns the identity of one saved profile.

func (*Store) Sync added in v0.2.0

func (s *Store) Sync() (string, error)

Sync saves credential refreshes from the active auth.json into the selected profile and returns that profile's name.

func (*Store) Use

func (s *Store) Use(name string) (string, error)

Jump to

Keyboard shortcuts

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