safe

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2018 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup added in v0.3.0

func Backup(client backends.Client) error

func NewEmptyNote added in v0.4.0

func NewEmptyNote(name string) note

func NewSafeDTO added in v0.7.0

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

func NewAccount(username, password string) *Account

func (*Account) SyncWith added in v0.4.0

func (acc *Account) SyncWith(otherAccount *Account, name string) (bool, error)

func (*Account) Update added in v0.4.0

func (acc *Account) Update(cb func(*Account))

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 added in v0.7.0

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) Add

func (s *Safe) Add(name, username, password string) (*Account, error)

func (*Safe) ChangePassword added in v0.8.0

func (s *Safe) ChangePassword(p []byte) error

func (*Safe) Edit added in v0.4.0

func (s *Safe) Edit(name, username, password string) (*Account, error)

func (*Safe) Get added in v0.3.0

func (s *Safe) Get(name string) (*Account, error)

func (*Safe) Init added in v0.5.0

func (s *Safe) Init() error

func (*Safe) List

func (s *Safe) List() map[string]Account

func (*Safe) Move added in v0.4.0

func (s *Safe) Move(name, newName string) error

func (*Safe) Remove

func (s *Safe) Remove(name string) error

func (*Safe) RequireCompatibilityWith added in v0.7.0

func (s *Safe) RequireCompatibilityWith(version string) error

RequireCompatibilityWith returns an error if the Safe version is incompatible with the provided version

func (*Safe) SyncWith added in v0.4.0

func (s *Safe) SyncWith(otherSafe *Safe) error

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.

Jump to

Keyboard shortcuts

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