Documentation
¶
Index ¶
- func DeleteAPIKey(profile string) error
- func ExportAPIKey(apiKey string, dest ExportDestination) error
- func GetAPIKey(profile string) (string, error)
- func GetActiveProfile() string
- func GetStoredAPIKey(profile string) (string, error)
- func InitStore() error
- func IsInteractiveTerminal() bool
- func ListProfiles() (profiles []string, activeProfile string, err error)
- func Login(profile, operatorID, keyTitle string, progress *LoginProgress) (string, error)
- func SetActiveProfile(profile string) error
- func StoreAPIKey(apiKey, profile string) error
- type ExportDestination
- type LoginProgress
- type LoginResponse
- type PollResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteAPIKey ¶
DeleteAPIKey removes the API key for a profile.
func ExportAPIKey ¶
func ExportAPIKey(apiKey string, dest ExportDestination) error
ExportAPIKey exports the API key to the specified destination.
func GetActiveProfile ¶
func GetActiveProfile() string
GetActiveProfile returns the currently active profile name.
func GetStoredAPIKey ¶
GetStoredAPIKey retrieves the API key from the credential store only, ignoring PE_API_KEY.
func IsInteractiveTerminal ¶
func IsInteractiveTerminal() bool
IsInteractiveTerminal returns true if stdin is a terminal.
func ListProfiles ¶
ListProfiles returns all stored profile names and the active profile.
func Login ¶
func Login(profile, operatorID, keyTitle string, progress *LoginProgress) (string, error)
Login authenticates via browser and stores the API key for the given profile. If progress is nil, no progress messages are printed.
func SetActiveProfile ¶
SetActiveProfile sets the active profile.
func StoreAPIKey ¶
StoreAPIKey stores an API key for a profile.
Types ¶
type ExportDestination ¶
type ExportDestination string
ExportDestination represents where to export the API key beyond the keyring.
const ( ExportOpenClaw ExportDestination = "openclaw" ExportShell ExportDestination = "shell" ExportNone ExportDestination = "none" )
func PromptExportDestination ¶
func PromptExportDestination(in io.Reader, out io.Writer) ExportDestination
PromptExportDestination shows an interactive menu and returns the user's choice.
type LoginProgress ¶
type LoginProgress struct {
// OnBrowserOpen is called when the browser is about to open, with the fallback URL.
OnBrowserOpen func(loginURL string)
// OnWaiting is called when polling starts.
OnWaiting func()
}
LoginProgress reports login progress to the caller.