auth

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultAuthFileMode = constants.PrivateFileMode

Variables

This section is empty.

Functions

func AuthFilePath

func AuthFilePath() (string, error)

func IsLegacySchemaError

func IsLegacySchemaError(err error) bool

func SaveAuthStore

func SaveAuthStore(path string, store AuthStore) error

func SetAuthFilePathForTest

func SetAuthFilePathForTest(authPath string) func()

func WritePrivateFile

func WritePrivateFile(path string, body []byte) error

Types

type Account

type Account struct {
	RefreshToken string `json:"refresh_token"`
	UserID       int64  `json:"user_id,omitempty"`
	Username     string `json:"username,omitempty"`
}

func SelectAuthAccount

func SelectAuthAccount(store AuthStore, requestedUserID int64) (int64, Account, bool)

type AuthStore

type AuthStore struct {
	DefaultUserID int64     `json:"default_user_id,omitempty"`
	Accounts      []Account `json:"accounts,omitempty"`
}

func LoadAuthStore

func LoadAuthStore(path string) (AuthStore, error)

func (AuthStore) Get

func (s AuthStore) Get(userID int64) (int, Account, bool)

func (AuthStore) Has

func (s AuthStore) Has(userID int64) bool

func (*AuthStore) Remove

func (s *AuthStore) Remove(userID int64) bool

func (*AuthStore) Upsert

func (s *AuthStore) Upsert(acct Account)

func (AuthStore) UserIDs

func (s AuthStore) UserIDs() []int64

type LegacySchemaError

type LegacySchemaError struct {
	Field string
}

func (LegacySchemaError) Error

func (e LegacySchemaError) Error() string

Jump to

Keyboard shortcuts

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