credentials

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package credentials implements our struct stored in keychain. Store struct is kind of like a database client. Credentials struct is kind of like one record from the database.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongFormat = errors.New("malformed credentials")
)

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	UserID,
	Name,
	Emails,
	APIToken,
	MailboxPassword,
	BridgePassword,
	Version string
	Timestamp int64
	IsHidden,
	IsCombinedAddressMode bool
}

func (*Credentials) CheckPassword

func (s *Credentials) CheckPassword(password string) error

func (*Credentials) EmailList

func (s *Credentials) EmailList() []string

func (*Credentials) IsConnected

func (s *Credentials) IsConnected() bool

func (*Credentials) Logout

func (s *Credentials) Logout()

func (*Credentials) Marshal

func (s *Credentials) Marshal() string

func (*Credentials) SetEmailList

func (s *Credentials) SetEmailList(list []string)

func (*Credentials) Unmarshal

func (s *Credentials) Unmarshal(secret string) error

type Store

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

Store is an encrypted credentials store.

func NewStore

func NewStore(keychain *keychain.Keychain) *Store

NewStore creates a new encrypted credentials store.

func (*Store) Add

func (s *Store) Add(userID, userName, apiToken, mailboxPassword string, emails []string) (creds *Credentials, err error)

func (*Store) Delete

func (s *Store) Delete(userID string) (err error)

Delete removes credentials from the store.

func (*Store) Get

func (s *Store) Get(userID string) (creds *Credentials, err error)

func (*Store) GetAndCheckPassword

func (s *Store) GetAndCheckPassword(userID, password string) (creds *Credentials, err error)

func (*Store) List

func (s *Store) List() (userIDs []string, err error)

List returns a list of usernames that have credentials stored.

func (*Store) Logout

func (s *Store) Logout(userID string) error

func (*Store) SwitchAddressMode

func (s *Store) SwitchAddressMode(userID string) error

func (*Store) UpdateEmails

func (s *Store) UpdateEmails(userID string, emails []string) error

func (*Store) UpdatePassword

func (s *Store) UpdatePassword(userID, password string) error

func (*Store) UpdateToken

func (s *Store) UpdateToken(userID, apiToken string) error

Jump to

Keyboard shortcuts

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