credentials

package
v1.8.12 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 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 string
	MailboxPassword []byte
	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) SplitAPIToken added in v1.8.0

func (s *Credentials) SplitAPIToken() (string, string, error)

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, uid, ref string, mailboxPassword []byte, emails []string) (*Credentials, 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) (*Credentials, error)

func (*Store) SwitchAddressMode

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

func (*Store) UpdateEmails

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

func (*Store) UpdatePassword

func (s *Store) UpdatePassword(userID string, password []byte) (*Credentials, error)

func (*Store) UpdateToken

func (s *Store) UpdateToken(userID, uid, ref string) (*Credentials, error)

Jump to

Keyboard shortcuts

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