auth

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package auth provides functionality for managing authentication credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultStorePath

func DefaultStorePath() (string, error)

DefaultStorePath returns the standard ~/.config/autocmd/auth.json path.

Types

type FileSystem

type FileSystem interface {
	ReadFile(name string) ([]byte, error)
	WriteFile(name string, data []byte, perm os.FileMode) error
	MkdirAll(path string, perm os.FileMode) error
}

FileSystem abstracts filesystem operations for the auth package.

type Manager

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

Manager handles persistent storage of authentication credentials.

func NewManager

func NewManager(fs FileSystem, storePath string) *Manager

NewManager creates a new Manager with the given filesystem and storage path.

func (*Manager) All

func (m *Manager) All() (map[string]domain.Credential, error)

All returns all stored credentials.

func (*Manager) Get

func (m *Manager) Get(providerID string) (*domain.Credential, error)

Get returns the credential for the given provider.

func (*Manager) GetWithFallback

func (m *Manager) GetWithFallback(p domain.Provider) (*domain.Credential, error)

GetWithFallback returns the credential for the given provider, prioritizing stored credentials over environment variable fallbacks.

func (*Manager) Remove

func (m *Manager) Remove(providerID string) error

Remove deletes the credential for the given provider.

func (*Manager) Set

func (m *Manager) Set(providerID string, cred domain.Credential) error

Set stores the credential for the given provider.

type OAuthManager

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

OAuthManager handles the RFC 8628 Device Authorization Flow.

func NewOAuthManager

func NewOAuthManager(client *http.Client) *OAuthManager

NewOAuthManager creates a new OAuth manager.

func (*OAuthManager) RunDeviceFlow

func (m *OAuthManager) RunDeviceFlow(ctx context.Context, cfg domain.OAuthMethod, onCode func(uri string, code string)) (string, error)

RunDeviceFlow executes the polling flow based on a logicless OAuthMethod descriptor.

Jump to

Keyboard shortcuts

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