storage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServiceName = "freeagent"

Variables

View Source
var ErrNotFound = errors.New("token not found")

Functions

func DefaultFileDir

func DefaultFileDir() (string, error)

Types

type FileStore

type FileStore struct {
	Dir string
}

func (*FileStore) Delete

func (s *FileStore) Delete(profile string) error

func (*FileStore) Get

func (s *FileStore) Get(profile string) (*Token, error)

func (*FileStore) Set

func (s *FileStore) Set(profile string, token *Token) error

type KeychainStore

type KeychainStore struct {
	Service string
}

func (*KeychainStore) Delete

func (s *KeychainStore) Delete(profile string) error

func (*KeychainStore) Get

func (s *KeychainStore) Get(profile string) (*Token, error)

func (*KeychainStore) Set

func (s *KeychainStore) Set(profile string, token *Token) error

type Store

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

func NewDefaultStore

func NewDefaultStore() (*Store, error)

func NewStore

func NewStore(primary TokenStore, fallback TokenStore) *Store

func (*Store) Delete

func (s *Store) Delete(profile string) error

func (*Store) Get

func (s *Store) Get(profile string) (*Token, error)

func (*Store) Set

func (s *Store) Set(profile string, token *Token) error

type Token

type Token struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	TokenType    string    `json:"token_type"`
	ExpiresAt    time.Time `json:"expires_at"`
}

type TokenStore

type TokenStore interface {
	Get(profile string) (*Token, error)
	Set(profile string, token *Token) error
	Delete(profile string) error
}

Jump to

Keyboard shortcuts

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