credentials

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 GetGeminiCredentials

func GetGeminiCredentials() (string, error)

GetGeminiCredentials returns an error explaining how to configure Gemini. Kept for backwards compatibility with the old error message.

func RefreshChatGPTCredentials added in v0.0.32

func RefreshChatGPTCredentials(creds *ChatGPTCredentials) error

RefreshChatGPTCredentials refreshes the access token using the refresh token. The updated credentials are automatically saved to storage.

func SaveChatGPTCredentials added in v0.0.32

func SaveChatGPTCredentials(creds *ChatGPTCredentials) error

SaveChatGPTCredentials saves ChatGPT OAuth credentials to storage.

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 GeminiOAuthCredentials

type GeminiOAuthCredentials struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiryDate   int64  `json:"expiry_date"`
}

GeminiOAuthCredentials holds the OAuth credentials loaded from ~/.gemini/oauth_creds.json

func GetGeminiOAuthCredentials

func GetGeminiOAuthCredentials() (*GeminiOAuthCredentials, error)

GetGeminiOAuthCredentials loads OAuth credentials from ~/.gemini/oauth_creds.json These are used for the Code Assist API (cloudcode-pa.googleapis.com)

Jump to

Keyboard shortcuts

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