auth

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAccounts      = errors.New("no accounts configured")
	ErrAccountNotFound = errors.New("account not found")
)

Functions

This section is empty.

Types

type AccountAuth

type AccountAuth struct {
	Name       string `json:"name"`
	Homeserver string `json:"homeserver"`
	UserID     string `json:"userId"`
	Token      string `json:"token"`
}

func (AccountAuth) Domain

func (a AccountAuth) Domain() (string, error)

type AccountAuths

type AccountAuths []AccountAuth

func (AccountAuths) Find

func (a AccountAuths) Find(name string) (AccountAuth, bool)

func (AccountAuths) Update

func (a AccountAuths) Update(auth AccountAuth) AccountAuths

type Auth

type Auth struct {
	Current  string       `json:"current_account"`
	Accounts AccountAuths `json:"accounts"`
}

type TokenStore

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

func NewTokenStore

func NewTokenStore(dir string, client *http.Client) (*TokenStore, error)

func (*TokenStore) Current

func (t *TokenStore) Current() (AccountAuth, error)

func (*TokenStore) CurrentName

func (t *TokenStore) CurrentName() string

func (*TokenStore) Find

func (t *TokenStore) Find(name string) (AccountAuth, error)

func (*TokenStore) List

func (t *TokenStore) List() AccountAuths

func (*TokenStore) Login

func (t *TokenStore) Login(name, homeserver, username, password string) (AccountAuth, error)

func (*TokenStore) Remove

func (t *TokenStore) Remove(name string) error

func (*TokenStore) SetCurrent

func (t *TokenStore) SetCurrent(name string) error

Jump to

Keyboard shortcuts

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