Documentation
¶
Overview ¶
Package codexauth reads and writes the Codex CLI's own sign-in, $CODEX_HOME/auth.json, so an account can be handed to Codex.
Index ¶
- Constants
- type Auth
- type Home
- func (h Home) AuthPath() string
- func (h Home) Backup(dst string) error
- func (h Home) Read() (*Auth, error)
- func (h Home) SignIn(tokens auth.Tokens, accountID string, lastRefresh time.Time) error
- func (h Home) StoreMode() (string, error)
- func (h Home) UpdateTokens(prev *Auth, tokens auth.Tokens, lastRefresh time.Time) error
Constants ¶
View Source
const HomeEnvVar = "CODEX_HOME"
HomeEnvVar overrides Codex's home directory, as it does for Codex.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
Mode string // auth_mode; empty in older files
HasAPIKey bool // OPENAI_API_KEY is set
Tokens *auth.Tokens
AccountID string // tokens.account_id
LastRefresh time.Time
// contains filtered or unexported fields
}
Auth is the sign-in stored in auth.json.
type Home ¶
type Home struct {
Dir string
}
Home is a Codex home directory (default ~/.codex).
func DefaultHome ¶
DefaultHome returns $CODEX_HOME, or ~/.codex.
func (Home) SignIn ¶
SignIn replaces auth.json with a ChatGPT sign-in, in the format `codex login` writes.
Click to show internal directories.
Click to hide internal directories.