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 ¶
- Variables
- func Decrypt(msg []byte, key [32]byte) ([]byte, error)
- func Encrypt(msg []byte, key [32]byte) ([]byte, error)
- func GenerateKey(size uint) []byte
- type Credentials
- func (s *Credentials) Decrypt() error
- func (s *Credentials) Encrypt() error
- func (s *Credentials) IsConnected() bool
- func (s *Credentials) Locked() bool
- func (s *Credentials) SealKey(slot string, key [32]byte) error
- func (s *Credentials) SplitAPIToken() (string, string, error)
- func (s *Credentials) Unlock(slot, password string) error
- type Secret
- type Store
- func (s *Store) Add(userID, userName, uid, ref string, mailboxPassword []byte, emails []string) (*Credentials, []byte, error)
- func (s *Store) AddKeySlot(userID, slot, mainKey string) (string, error)
- func (s *Store) Delete(userID string) (err error)
- func (s *Store) Get(userID string) (creds *Credentials, err error)
- func (s *Store) List() ([]string, error)
- func (s *Store) ListKeySlots(userID string) ([]string, error)
- func (s *Store) Logout(userID string) (*Credentials, error)
- func (s *Store) RemoveKeySlot(userID, slot string) error
- func (s *Store) UpdateEmails(userID string, emails []string) (*Credentials, error)
- func (s *Store) UpdatePassword(userID string, password []byte) (*Credentials, error)
- func (s *Store) UpdateToken(userID, uid, ref string) (*Credentials, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("Credentials not found") ErrLocked = errors.New("Credentials are locked") ErrDecryptionFailed = errors.New("Decryption of credentials failed") ErrEncryptionFailed = errors.New("Encryption of credentials failed") ErrAlreadyExists = errors.New("Credential already exists") ErrCantRemoveMainSlot = errors.New("Cannot remove the main key slot") )
Functions ¶
func GenerateKey ¶ added in v0.3.0
Types ¶
type Credentials ¶
type Credentials struct { UserID string Name string Emails []string Secret Secret `json:"-"` SealedSecret []byte SealedKeys map[string][]byte Key [32]byte `json:"-"` }
func (*Credentials) Decrypt ¶ added in v0.3.0
func (s *Credentials) Decrypt() error
func (*Credentials) Encrypt ¶ added in v0.3.0
func (s *Credentials) Encrypt() error
func (*Credentials) IsConnected ¶
func (s *Credentials) IsConnected() bool
func (*Credentials) Locked ¶ added in v0.3.0
func (s *Credentials) Locked() bool
func (*Credentials) SealKey ¶ added in v0.3.0
func (s *Credentials) SealKey(slot string, key [32]byte) error
func (*Credentials) SplitAPIToken ¶
func (s *Credentials) SplitAPIToken() (string, string, error)
func (*Credentials) Unlock ¶ added in v0.3.0
func (s *Credentials) Unlock(slot, password string) error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an encrypted credentials store.
func (*Store) AddKeySlot ¶ added in v0.3.0
func (*Store) ListKeySlots ¶ added in v0.3.0
func (*Store) RemoveKeySlot ¶ added in v0.3.0
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)
Click to show internal directories.
Click to hide internal directories.