auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAuthenticated = errors.New("not authenticated")
	ErrInvalidToken     = errors.New("invalid token")
)
View Source
var (
	ErrKeyringUnavailable = errors.New("keyring unavailable")
)

Functions

func DeviceFlowLogin

func DeviceFlowLogin(ctx context.Context, clientID string, scopes []string) (string, error)

func GetToken

func GetToken(provider Provider) (string, error)

func IsKeyringAvailable

func IsKeyringAvailable() bool

func IsLoggedIn

func IsLoggedIn(provider Provider) bool

func Login

func Login(provider Provider, token string) error

func LoginWithOAuth

func LoginWithOAuth(ctx context.Context, provider Provider, clientID string, scopes []string) (string, error)

func Logout

func Logout(provider Provider) error

func Reset

func Reset()

func SetSecureStoreForTest

func SetSecureStoreForTest(s *SecureStore)

func ValidateToken

func ValidateToken(ctx context.Context, provider Provider) (string, error)

Types

type Credentials

type Credentials struct {
	Provider Provider
	Token    string
}

type Provider

type Provider string
const (
	ProviderGitHub Provider = "github"
)

func ParseProvider

func ParseProvider(s string) (Provider, error)

type SecureStore

type SecureStore struct {
	ServiceName string
	// contains filtered or unexported fields
}

func NewSecureStore

func NewSecureStore(service string) *SecureStore

func (*SecureStore) Delete

func (s *SecureStore) Delete(provider Provider) error

func (*SecureStore) Load

func (s *SecureStore) Load(provider Provider) (string, error)

func (*SecureStore) Save

func (s *SecureStore) Save(provider Provider, token string) error

func (*SecureStore) SetFallbackDir

func (s *SecureStore) SetFallbackDir(dir string)

func (*SecureStore) SetForceFallback

func (s *SecureStore) SetForceFallback(force bool)

type StoredCredentials

type StoredCredentials struct {
	Credentials map[Provider]Credentials
}

Jump to

Keyboard shortcuts

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