credentials

package
v0.0.82 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnthropicOAuthCredentialsExist added in v0.0.82

func AnthropicOAuthCredentialsExist() bool

AnthropicOAuthCredentialsExist returns true if Anthropic OAuth credentials are stored.

func ChatGPTCredentialsExist added in v0.0.32

func ChatGPTCredentialsExist() bool

ChatGPTCredentialsExist returns true if ChatGPT credentials are stored.

func ClearAnthropicOAuthCredentials added in v0.0.82

func ClearAnthropicOAuthCredentials() error

ClearAnthropicOAuthCredentials removes the stored Anthropic OAuth credentials.

func ClearChatGPTCredentials added in v0.0.32

func ClearChatGPTCredentials() error

ClearChatGPTCredentials removes the stored ChatGPT credentials.

func ClearCopilotCredentials added in v0.0.34

func ClearCopilotCredentials() error

ClearCopilotCredentials removes the stored Copilot credentials.

func CopilotCredentialsExist added in v0.0.34

func CopilotCredentialsExist() bool

CopilotCredentialsExist returns true if Copilot credentials are stored.

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 SaveAnthropicOAuthCredentials added in v0.0.82

func SaveAnthropicOAuthCredentials(creds *AnthropicOAuthCredentials) error

SaveAnthropicOAuthCredentials saves Anthropic OAuth credentials to storage.

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.

Types

type AnthropicOAuthCredentials added in v0.0.82

type AnthropicOAuthCredentials struct {
	AccessToken string `json:"access_token"`
}

AnthropicOAuthCredentials holds the OAuth token for Anthropic API access. Generated via `claude setup-token` (requires Claude subscription).

func GetAnthropicOAuthCredentials added in v0.0.82

func GetAnthropicOAuthCredentials() (*AnthropicOAuthCredentials, error)

GetAnthropicOAuthCredentials retrieves the Anthropic OAuth credentials from storage. Returns an error if credentials don't exist or are invalid.

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