auth

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles GitHub Copilot token exchange and caching.

func New

func New() (*Manager, error)

New creates a Manager, loads the GitHub PAT from auth.json. Deprecated: use NewWithDirs for XDG-aware path resolution.

func NewWithDirs added in v1.1.0

func NewWithDirs(stateDir, dataDir string) (*Manager, error)

NewWithDirs creates a Manager using explicit state and data directories.

func (*Manager) APIURL

func (m *Manager) APIURL() string

APIURL returns the Copilot API base URL (from the last token exchange).

func (*Manager) GetToken

func (m *Manager) GetToken(ctx context.Context) (string, error)

GetToken returns a valid Copilot access token, refreshing if needed.

func (*Manager) StartRefresher

func (m *Manager) StartRefresher(ctx context.Context)

StartRefresher launches a background goroutine that proactively refreshes the token.

type Token

type Token struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
	APIURL    string    `json:"api_url,omitempty"` // from endpoints.api
}

Token is a short-lived Copilot API token.

Jump to

Keyboard shortcuts

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