password

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TemplateFile is the name of a pass template
	TemplateFile = ".pass-template"
)

Variables

View Source
var (
	// ErrGitInit is returned if git is already initialized
	ErrGitInit = fmt.Errorf("git is already initialized")
	// ErrGitNotInit is returned if git is not initialized
	ErrGitNotInit = fmt.Errorf("git is not initialized")
	// ErrGitNoRemote is returned if git has no origin remote
	ErrGitNoRemote = fmt.Errorf("git has no remote origin")
)
View Source
var (
	// ErrExistsFailed is returend if we can't check for existence
	ErrExistsFailed = fmt.Errorf("Failed to check for existence")
	// ErrNotFound is returned if an entry was not found
	ErrNotFound = fmt.Errorf("Entry is not in the password store")
	// ErrEncrypt is returned if we failed to encrypt an entry
	ErrEncrypt = fmt.Errorf("Failed to encrypt")
	// ErrDecrypt is returned if we failed to decrypt and entry
	ErrDecrypt = fmt.Errorf("Failed to decrypt")
	// ErrSneaky is returned if the user passes a possible malicious path to gopass
	ErrSneaky = fmt.Errorf("you've attempted to pass a sneaky path to gopass. go home")
)

Functions

This section is empty.

Types

type FsckCallback

type FsckCallback func(string) bool

FsckCallback is a callback to ask the user to confirm certain fsck corrective actions

type ImportCallback

type ImportCallback func(string) bool

ImportCallback is a callback to ask the user if he wants to import a certain recipients public key into his keystore

type RecipientCallback

type RecipientCallback func(string, []string) ([]string, error)

RecipientCallback is a callback to verify the list of recipients

type RootStore

type RootStore struct {
	AutoPush    bool              `json:"autopush"`    // push to git remote after commit
	AutoPull    bool              `json:"autopull"`    // pull from git before push
	AutoImport  bool              `json:"autoimport"`  // import missing public keys w/o asking
	AlwaysTrust bool              `json:"alwaystrust"` // always trust public keys when encrypting
	NoConfirm   bool              `json:"noconfirm"`   // do not confirm recipients when encrypting
	PersistKeys bool              `json:"persistkeys"` // store recipient keys in store
	LoadKeys    bool              `json:"loadkeys"`    // load missing keys from store
	ClipTimeout int               `json:"cliptimeout"` // clear clipboard after seconds
	NoColor     bool              `json:"nocolor"`     // disable colors in output
	Path        string            `json:"path"`        // path to the root store
	SafeContent bool              `json:"safecontent"` // avoid showing passwords in terminal
	Mount       map[string]string `json:"mounts,omitempty"`
	Version     string            `json:"version"`
	ImportFunc  ImportCallback    `json:"-"`
	FsckFunc    FsckCallback      `json:"-"`
	Debug       bool              `json:"-"`
	// contains filtered or unexported fields
}

RootStore is the public facing password store

func NewRootStore

func NewRootStore(path string) (*RootStore, error)

NewRootStore creates a new store

func (*RootStore) AddMount

func (r *RootStore) AddMount(alias, path string, keys ...string) error

AddMount adds a new mount

func (*RootStore) AddRecipient

func (r *RootStore) AddRecipient(store, rec string) error

AddRecipient adds a single recipient to the given store

func (*RootStore) Copy

func (r *RootStore) Copy(from, to string) error

Copy will copy one entry to another location. Multi-store copies are supported. Each entry has to be decoded and encoded for the destination to make sure it's encrypted for the right set of recipients.

func (*RootStore) Delete

func (r *RootStore) Delete(name string) error

Delete will remove an single entry from the store

func (*RootStore) Exists

func (r *RootStore) Exists(name string) (bool, error)

Exists checks the existence of a single entry

func (*RootStore) First added in v1.0.1

func (r *RootStore) First(name string) ([]byte, error)

First returns the first line of the plaintext of a single key

func (*RootStore) Format

func (r *RootStore) Format(maxDepth int) (string, error)

Format will pretty print all entries in this store and all substores

func (*RootStore) Fsck

func (r *RootStore) Fsck(check, force bool) error

Fsck checks the stores integrity

func (*RootStore) Get

func (r *RootStore) Get(name string) ([]byte, error)

Get returns the plaintext of a single key

func (*RootStore) GetTemplate added in v1.1.0

func (r *RootStore) GetTemplate(name string) ([]byte, error)

GetTemplate will return the content of the named template

func (*RootStore) Git

func (r *RootStore) Git(store string, args ...string) error

Git runs arbitrary git commands on this store and all substores

func (*RootStore) GitInit

func (r *RootStore) GitInit(store, sk string) error

GitInit initializes the git repo

func (*RootStore) HasTemplate added in v1.1.0

func (r *RootStore) HasTemplate(name string) bool

HasTemplate returns true if the template exists

func (*RootStore) Init

func (r *RootStore) Init(alias, path string, ids ...string) error

Init tries to initalize a new password store location matching the object

func (*RootStore) Initialized

func (r *RootStore) Initialized() bool

Initialized checks on disk if .gpg-id was generated and thus returns true.

func (*RootStore) IsDir

func (r *RootStore) IsDir(name string) bool

IsDir checks if a given key is actually a folder

func (*RootStore) List

func (r *RootStore) List(maxDepth int) ([]string, error)

List will return a flattened list of all tree entries

func (*RootStore) ListRecipients

func (r *RootStore) ListRecipients(store string) []string

ListRecipients lists all recipients for the given store

func (*RootStore) LookupTemplate added in v1.1.0

func (r *RootStore) LookupTemplate(name string) ([]byte, bool)

LookupTemplate will lookup and return a template

func (*RootStore) Move

func (r *RootStore) Move(from, to string) error

Move will move one entry from one location to another. Cross-store moves are supported. Moving an entry will decode it from the old location, encode it for the destination store with the right set of recipients and remove it from the old location afterwards.

func (*RootStore) Prune

func (r *RootStore) Prune(tree string) error

Prune will remove a subtree from the Store

func (*RootStore) RecipientsTree

func (r *RootStore) RecipientsTree(pretty bool) (*tree.Folder, error)

RecipientsTree returns a tree view of all stores' recipients

func (*RootStore) RemoveMount

func (r *RootStore) RemoveMount(alias string) error

RemoveMount removes and existing mount

func (*RootStore) RemoveRecipient

func (r *RootStore) RemoveRecipient(store, rec string) error

RemoveRecipient removes a single recipient from the given store

func (*RootStore) RemoveTemplate added in v1.1.0

func (r *RootStore) RemoveTemplate(name string) error

RemoveTemplate will delete the named template if it exists

func (*RootStore) Set

func (r *RootStore) Set(name string, content []byte, reason string) error

Set encodes and write the ciphertext of one entry to disk

func (*RootStore) SetConfirm

func (r *RootStore) SetConfirm(name string, content []byte, reason string, cb RecipientCallback) error

SetConfirm calls Set with confirmation callback

func (*RootStore) SetTemplate added in v1.1.0

func (r *RootStore) SetTemplate(name string, content []byte) error

SetTemplate will (over)write the content to the template file

func (*RootStore) String

func (r *RootStore) String() string

func (*RootStore) TemplateTree added in v1.1.0

func (r *RootStore) TemplateTree() (*tree.Folder, error)

TemplateTree returns a tree of all templates

func (*RootStore) Tree

func (r *RootStore) Tree() (*tree.Folder, error)

Tree returns the tree representation of the entries

func (*RootStore) UnmarshalJSON

func (r *RootStore) UnmarshalJSON(b []byte) error

UnmarshalJSON implements a custom JSON unmarshaler that will also make sure the store is properly initialized after loading

type Store

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

Store is password store

func NewStore

func NewStore(alias, path string, r *RootStore) (*Store, error)

NewStore creates a new store, copying settings from the given root store

func (*Store) AddRecipient

func (s *Store) AddRecipient(id string) error

AddRecipient adds a new recipient to the list

func (*Store) Copy

func (s *Store) Copy(from, to string) error

Copy will copy one entry to another location. Multi-store copies are supported. Each entry has to be decoded and encoded for the destination to make sure it's encrypted for the right set of recipients.

func (*Store) Delete

func (s *Store) Delete(name string) error

Delete will remove an single entry from the store

func (*Store) Exists

func (s *Store) Exists(name string) (bool, error)

Exists checks the existence of a single entry

func (*Store) Fsck

func (s *Store) Fsck(prefix string, check, force bool) (map[string]uint64, error)

Fsck checks this stores integrity

func (*Store) Get

func (s *Store) Get(name string) ([]byte, error)

Get returns the plaintext of a single key

func (*Store) GetTemplate added in v1.1.0

func (s *Store) GetTemplate(name string) ([]byte, error)

GetTemplate will return the content of the named template

func (*Store) Git

func (s *Store) Git(args ...string) error

Git runs arbitrary git commands on this store and all substores

func (*Store) GitInit

func (s *Store) GitInit(signKey string) error

GitInit initializes this store's git repo and recursively calls GitInit on all substores.

func (*Store) HasTemplate added in v1.1.0

func (s *Store) HasTemplate(name string) bool

HasTemplate returns true if the template exists

func (*Store) Init

func (s *Store) Init(ids ...string) error

Init tries to initalize a new password store location matching the object

func (*Store) Initialized

func (s *Store) Initialized() bool

Initialized returns true if the store is properly initialized

func (*Store) IsDir

func (s *Store) IsDir(name string) bool

IsDir returns true if the entry is folder inside the store

func (*Store) List

func (s *Store) List(prefix string) ([]string, error)

List will list all entries in this store

func (*Store) ListTemplates added in v1.1.0

func (s *Store) ListTemplates(prefix string) []string

ListTemplates will list all templates in this store

func (*Store) LookupTemplate added in v1.1.0

func (s *Store) LookupTemplate(name string) ([]byte, bool)

LookupTemplate will lookup and return a template

func (*Store) Move

func (s *Store) Move(from, to string) error

Move will move one entry from one location to another. Cross-store moves are supported. Moving an entry will decode it from the old location, encode it for the destination store with the right set of recipients and remove it from the old location afterwards.

func (*Store) Prune

func (s *Store) Prune(tree string) error

Prune will remove a subtree from the Store

func (*Store) RemoveRecipient

func (s *Store) RemoveRecipient(id string) error

RemoveRecipient will remove the given recipient from the store

func (*Store) RemoveTemplate added in v1.1.0

func (s *Store) RemoveTemplate(name string) error

RemoveTemplate will delete the named template if it exists

func (*Store) Set

func (s *Store) Set(name string, content []byte, reason string) error

Set encodes and write the ciphertext of one entry to disk

func (*Store) SetConfirm

func (s *Store) SetConfirm(name string, content []byte, reason string, cb RecipientCallback) error

SetConfirm encodes and writes the cipertext of one entry to disk. This method can be passed a callback to confirm the recipients immedeately before encryption.

func (*Store) SetTemplate added in v1.1.0

func (s *Store) SetTemplate(name string, content []byte) error

SetTemplate will (over)write the content to the template file

func (*Store) String

func (s *Store) String() string

String implement fmt.Stringer

Jump to

Keyboard shortcuts

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