Documentation ¶
Index ¶
- func Backup(client backends.Client) error
- func NewEmptyNote(name string) note
- func NewSafeDTO(safeBytes []byte) *safeDTO
- type Account
- type Safe
- func (s *Safe) Add(name, username, password string) (*Account, error)
- func (s *Safe) ChangePassword(p []byte) error
- func (s *Safe) Edit(name, username, password string) (*Account, error)
- func (s *Safe) Get(name string) (*Account, error)
- func (s *Safe) Init() error
- func (s *Safe) List() map[string]Account
- func (s *Safe) Move(name, newName string) error
- func (s *Safe) Remove(name string) error
- func (s *Safe) RequireCompatibilityWith(version string) error
- func (s *Safe) SyncWith(otherSafe *Safe) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEmptyNote ¶
func NewEmptyNote(name string) note
func NewSafeDTO ¶
func NewSafeDTO(safeBytes []byte) *safeDTO
NewSafeDTO returns a safeDTO from the bytes provided from a Backend. If we cannot decode the bytes we assume the safe uses a very old, legacy format and provide an OpenPGP Config.
Types ¶
type Account ¶
type Account struct { Username string `json:"username"` Password string `json:"password"` CreatedOn int64 `json:"createdOn"` ModifiedOn int64 `json:"modifiedOn"` History accountHistory `json:"history,omitempty"` }
func NewAccount ¶
type Safe ¶
type Safe struct { Config *config.Config Accounts map[string]Account `json:"accounts"` Notes *notesManager // contains filtered or unexported fields }
Safe holds the structure for defining a Safe object
func Load ¶
func Load(password []byte, backendClient backends.Client, cryptoClient crypto.Client, config *config.Config) (*Safe, error)
Load loads, decrypts, and returns an instantiated Safe. In the case that the Safe configuration has changed, the Safe will be upgraded to the latest configuration and saved.
func New ¶
func New(password []byte, backendClient backends.Client, cryptoClient crypto.Client, config *config.Config, accounts map[string]Account, notes map[string]note) (*Safe, error)
New returns a new, initialized Safe
func (*Safe) ChangePassword ¶
func (*Safe) RequireCompatibilityWith ¶
RequireCompatibilityWith returns an error if the Safe version is incompatible with the provided version
func (*Safe) SyncWith ¶
SyncWith syncs the current safe with another safe if they're branching off the same safe, i.e. are not completely different safes. It simply imports non-existing accounts & notes into the current safe and updates existing accounts & notes if the other safe has a more recent version of an account / note. A backup is made when existing accounts / notes are updated.