passwords

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package passwords contains the in memory data manipulations for password repo

Index

Constants

View Source
const CSVSeparator = ","

Variables

View Source
var (
	ErrorInvalidID = func(id string) error {
		return errors.New(fmt.Sprintf("Invalid ID:  %s", id))
	}
	ErrorCannotSavePasswordDB = func(err error) error {
		return errors.Wrap(err, "cannot save password")
	}
	ErrorNoPasswords = errors.New("no passwords are available")
)

Functions

func InitPasswordRepo

func InitPasswordRepo(mPassword string) error

InitPasswordRepo initialize the Password repository.

Types

type PasswordDB

type PasswordDB struct {
	Entries map[string]PasswordEntry `json:"entries"`
	Labels  map[string][]string      `json:"labels"`
}

PasswordDB struct represents password db

type PasswordEntry

type PasswordEntry struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

PasswordEntry struct represents entry in the password db

type PasswordRepository

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

PasswordRepository struct handles Password db

func LoadPasswordRepo added in v0.6.0

func LoadPasswordRepo(mPassword string) (*PasswordRepository, error)

LoadPasswordRepo initializes the Password repository.

func (*PasswordRepository) Add

func (p *PasswordRepository) Add(id, uN, password string, labels []string) error

Add method add new password entry to Password db

func (*PasswordRepository) ChangeMasterPassword added in v0.5.0

func (p *PasswordRepository) ChangeMasterPassword(newPassword string) error

func (*PasswordRepository) ChangePasswordEntry added in v0.5.0

func (p *PasswordRepository) ChangePasswordEntry(id string, entry PasswordEntry) error

func (*PasswordRepository) ExportToCSV added in v0.6.0

func (p *PasswordRepository) ExportToCSV(csvFilePath string) error

func (*PasswordRepository) GetPassword

func (p *PasswordRepository) GetPassword(id string, showPassword bool) error

GetPassword method retrieve password entry from Password db

func (*PasswordRepository) GetPasswordEntry added in v0.5.0

func (p *PasswordRepository) GetPasswordEntry(id string) (PasswordEntry, error)

func (*PasswordRepository) ImportFromCSV

func (p *PasswordRepository) ImportFromCSV(csvFilePath string) error

func (*PasswordRepository) Remove added in v0.3.0

func (p *PasswordRepository) Remove(id string) error

func (*PasswordRepository) SearchID

func (p *PasswordRepository) SearchID(id string, showPassword bool) ([]string, error)

SearchID will return the password entries if the password ID contains the provide key

func (*PasswordRepository) SearchLabel

func (p *PasswordRepository) SearchLabel(label string, showPassword bool) ([]string, error)

SearchLabel will return the password ids if the password labels contains the provide label

Jump to

Keyboard shortcuts

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