auth

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAuthorizeURL

func BuildAuthorizeURL(cfg OAuthProviderConfig, pkce PKCECodes, state, redirectURI string) string

func DeleteAllCredentials

func DeleteAllCredentials() error

func DeleteCredential

func DeleteCredential(provider string) error

func SaveStore

func SaveStore(store *AuthStore) error

func SetCredential

func SetCredential(provider string, cred *AuthCredential) error

Types

type AuthCredential

type AuthCredential struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	AccountID    string    `json:"account_id,omitempty"`
	ExpiresAt    time.Time `json:"expires_at,omitempty"`
	Provider     string    `json:"provider"`
	AuthMethod   string    `json:"auth_method"`
}

func GetCredential

func GetCredential(provider string) (*AuthCredential, error)

func LoginBrowser

func LoginBrowser(cfg OAuthProviderConfig) (*AuthCredential, error)

func LoginDeviceCode

func LoginDeviceCode(cfg OAuthProviderConfig) (*AuthCredential, error)

func LoginPasteToken

func LoginPasteToken(provider string, r io.Reader) (*AuthCredential, error)

func RefreshAccessToken

func RefreshAccessToken(cred *AuthCredential, cfg OAuthProviderConfig) (*AuthCredential, error)

func (*AuthCredential) IsExpired

func (c *AuthCredential) IsExpired() bool

func (*AuthCredential) NeedsRefresh

func (c *AuthCredential) NeedsRefresh() bool

type AuthStore

type AuthStore struct {
	Credentials map[string]*AuthCredential `json:"credentials"`
}

func LoadStore

func LoadStore() (*AuthStore, error)

type OAuthProviderConfig

type OAuthProviderConfig struct {
	Issuer     string
	ClientID   string
	Scopes     string
	Originator string
	Port       int
}

func OpenAIOAuthConfig

func OpenAIOAuthConfig() OAuthProviderConfig

type PKCECodes

type PKCECodes struct {
	CodeVerifier  string
	CodeChallenge string
}

func GeneratePKCE

func GeneratePKCE() (PKCECodes, error)

Jump to

Keyboard shortcuts

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