Documentation
¶
Index ¶
- Constants
- func CopilotAPIBaseURL(enterpriseURL string) string
- func CreateClaudeAPIKey(ctx context.Context, accessToken string) (string, error)
- func DefaultPath() string
- func GenerateCodeChallenge(verifier string) string
- func GenerateCodeVerifier() (string, error)
- func GenerateState() (string, error)
- func NormalizeEnterpriseURL(raw string) (string, error)
- func WaitForClaudeAuthCode(ctx context.Context, flow *ClaudeOAuthFlow) (string, bool, error)
- type ClaudeOAuthFlow
- type ClaudeProfile
- type ClaudeTokenResponse
- type CopilotDeviceFlow
- type Info
- type Store
Constants ¶
const ( ProviderGitHubCopilot = "github-copilot" ProviderAnthropic = "anthropic" )
Variables ¶
This section is empty.
Functions ¶
func CopilotAPIBaseURL ¶
func CreateClaudeAPIKey ¶ added in v1.1.34
CreateClaudeAPIKey creates a long-lived API key from an OAuth access token.
func DefaultPath ¶
func DefaultPath() string
func GenerateCodeChallenge ¶ added in v1.1.34
GenerateCodeChallenge creates a S256 code challenge from a code verifier.
func GenerateCodeVerifier ¶ added in v1.1.34
GenerateCodeVerifier creates a cryptographically random code verifier for PKCE.
func GenerateState ¶ added in v1.1.34
GenerateState creates a random state parameter for OAuth.
func NormalizeEnterpriseURL ¶
func WaitForClaudeAuthCode ¶ added in v1.1.34
WaitForClaudeAuthCode waits for the authorization code from the local callback.
Types ¶
type ClaudeOAuthFlow ¶ added in v1.1.34
type ClaudeOAuthFlow struct {
AutoURL string
ManualURL string
CodeVerifier string
State string
Port int
// contains filtered or unexported fields
}
ClaudeOAuthFlow holds the state for an in-progress OAuth 2.0 + PKCE flow.
func StartClaudeOAuthFlow ¶ added in v1.1.34
func StartClaudeOAuthFlow(_ context.Context) (*ClaudeOAuthFlow, error)
StartClaudeOAuthFlow initiates a new OAuth 2.0 + PKCE flow.
func (*ClaudeOAuthFlow) Close ¶ added in v1.1.34
func (f *ClaudeOAuthFlow) Close()
Close shuts down the callback HTTP server.
type ClaudeProfile ¶ added in v1.1.34
ClaudeProfile holds user profile information from the Anthropic API.
func FetchClaudeProfile ¶ added in v1.1.34
func FetchClaudeProfile(ctx context.Context, accessToken string) (*ClaudeProfile, error)
FetchClaudeProfile fetches the user's profile information.
type ClaudeTokenResponse ¶ added in v1.1.34
type ClaudeTokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
Scope string `json:"scope"`
}
ClaudeTokenResponse holds the parsed token exchange response.
func ExchangeClaudeCodeForTokens ¶ added in v1.1.34
func ExchangeClaudeCodeForTokens(ctx context.Context, code, codeVerifier string, isManual bool, port int) (*ClaudeTokenResponse, error)
ExchangeClaudeCodeForTokens exchanges an authorization code for OAuth tokens.
type CopilotDeviceFlow ¶
type CopilotDeviceFlow struct {
Domain string
EnterpriseURL string
VerificationURI string
UserCode string
DeviceCode string
Interval time.Duration
}
func StartCopilotDeviceFlow ¶
func StartCopilotDeviceFlow(ctx context.Context, enterpriseURL string) (*CopilotDeviceFlow, error)
type Info ¶
type Info struct {
ProviderID string `json:"provider_id"`
Type string `json:"type"`
AccessToken string `json:"access_token,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
EnterpriseURL string `json:"enterprise_url,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
func PollCopilotDeviceFlow ¶
func PollCopilotDeviceFlow(ctx context.Context, flow *CopilotDeviceFlow) (*Info, error)
func RefreshClaudeToken ¶ added in v1.1.34
RefreshClaudeToken refreshes an expired access token using the refresh token.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func DefaultStore ¶
func DefaultStore() *Store