Documentation
¶
Index ¶
- func ChatGPTCredentialsExist() bool
- func ClearChatGPTCredentials() error
- func ClearChatGPTCredentialsIfRefreshToken(refreshToken string) error
- func ClearCopilotCredentials() error
- func ClearGrokCredentials() error
- func ClearGrokCredentialsIfRefreshToken(refreshToken string) error
- func CopilotCredentialsExist() bool
- func GrokCredentialsExist() bool
- func RefreshChatGPTCredentials(creds *ChatGPTCredentials) error
- func RefreshGrokCredentials(ctx context.Context, creds *GrokCredentials, force bool) error
- func RefreshGrokCredentialsWithClient(ctx context.Context, creds *GrokCredentials, force bool, ...) error
- func SaveChatGPTCredentials(creds *ChatGPTCredentials) error
- func SaveCopilotCredentials(creds *CopilotCredentials) error
- func SaveGrokCredentials(creds *GrokCredentials) error
- type ChatGPTCredentials
- type CopilotCredentials
- type GrokCredentials
- type GrokOAuthClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChatGPTCredentialsExist ¶ added in v0.0.32
func ChatGPTCredentialsExist() bool
ChatGPTCredentialsExist returns true if ChatGPT credentials are stored.
func ClearChatGPTCredentials ¶ added in v0.0.32
func ClearChatGPTCredentials() error
ClearChatGPTCredentials removes the stored ChatGPT credentials.
func ClearChatGPTCredentialsIfRefreshToken ¶ added in v0.0.334
ClearChatGPTCredentialsIfRefreshToken removes credentials only if they still contain the refresh token that was rejected. A concurrent refresh or login therefore cannot be deleted by a stale provider's authentication retry.
func ClearCopilotCredentials ¶ added in v0.0.34
func ClearCopilotCredentials() error
ClearCopilotCredentials removes the stored Copilot credentials.
func ClearGrokCredentials ¶ added in v0.0.404
func ClearGrokCredentials() error
func ClearGrokCredentialsIfRefreshToken ¶ added in v0.0.404
func CopilotCredentialsExist ¶ added in v0.0.34
func CopilotCredentialsExist() bool
CopilotCredentialsExist returns true if Copilot credentials are stored.
func GrokCredentialsExist ¶ added in v0.0.404
func GrokCredentialsExist() bool
func RefreshChatGPTCredentials ¶ added in v0.0.32
func RefreshChatGPTCredentials(creds *ChatGPTCredentials) error
RefreshChatGPTCredentials refreshes the access token using the refresh token. Remote OAuth I/O deliberately runs outside the process and file locks. A short compare-and-swap commit prevents a stale refresh from overwriting a concurrent login, logout, or refresh.
func RefreshGrokCredentials ¶ added in v0.0.404
func RefreshGrokCredentials(ctx context.Context, creds *GrokCredentials, force bool) error
func RefreshGrokCredentialsWithClient ¶ added in v0.0.404
func RefreshGrokCredentialsWithClient(ctx context.Context, creds *GrokCredentials, force bool, client GrokOAuthClient) error
func SaveChatGPTCredentials ¶ added in v0.0.32
func SaveChatGPTCredentials(creds *ChatGPTCredentials) error
SaveChatGPTCredentials saves ChatGPT OAuth credentials to storage.
func SaveCopilotCredentials ¶ added in v0.0.34
func SaveCopilotCredentials(creds *CopilotCredentials) error
SaveCopilotCredentials saves Copilot OAuth credentials to storage.
func SaveGrokCredentials ¶ added in v0.0.404
func SaveGrokCredentials(creds *GrokCredentials) error
Types ¶
type ChatGPTCredentials ¶ added in v0.0.32
type ChatGPTCredentials struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt int64 `json:"expires_at"` // Unix timestamp in seconds
AccountID string `json:"account_id"` // ChatGPT account ID from JWT
}
ChatGPTCredentials holds the OAuth tokens for ChatGPT
func GetChatGPTCredentials ¶ added in v0.0.32
func GetChatGPTCredentials() (*ChatGPTCredentials, error)
GetChatGPTCredentials retrieves the ChatGPT OAuth credentials from storage. Returns an error if credentials don't exist or are invalid.
func (*ChatGPTCredentials) IsExpired ¶ added in v0.0.32
func (c *ChatGPTCredentials) IsExpired() bool
IsExpired returns true if the access token is expired or will expire within 5 minutes
type CopilotCredentials ¶ added in v0.0.34
type CopilotCredentials struct {
AccessToken string `json:"access_token"`
ExpiresAt int64 `json:"expires_at"` // Unix timestamp in seconds, 0 = no expiry
}
CopilotCredentials holds the OAuth token for GitHub Copilot
func GetCopilotCredentials ¶ added in v0.0.34
func GetCopilotCredentials() (*CopilotCredentials, error)
GetCopilotCredentials retrieves the Copilot OAuth credentials from storage. Returns an error if credentials don't exist or are invalid.
func (*CopilotCredentials) IsExpired ¶ added in v0.0.34
func (c *CopilotCredentials) IsExpired() bool
IsExpired returns true if the access token is expired or will expire within 5 minutes. GitHub OAuth tokens are typically long-lived, so this usually returns false.
type GrokCredentials ¶ added in v0.0.404
type GrokCredentials struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt int64 `json:"expires_at"`
AccountID string `json:"account_id"`
}
func GetGrokCredentials ¶ added in v0.0.404
func GetGrokCredentials() (*GrokCredentials, error)
func (*GrokCredentials) IsExpired ¶ added in v0.0.404
func (c *GrokCredentials) IsExpired() bool