leaf

package
v1.15.13 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var ErrInvalidHash = fmt.Errorf("recipients.hash invalid")

ErrInvalidHash indicates an outdated value of `recipients.hash`.

View Source
var Sep = "/"

Sep is the separator used in lists to separate folders from entries.

Functions

func GetFsckFunc

func GetFsckFunc(ctx context.Context) store.FsckCallback

GetFsckFunc will return the fsck confirmation callback or a default one returning true. Note: will never return nil.

func HasCheckRecipients

func HasCheckRecipients(ctx context.Context) bool

HasCheckRecipients returns true if check recipients has been set in this context.

func HasFsckCheck

func HasFsckCheck(ctx context.Context) bool

HasFsckCheck returns true if a value for fsck check has been set in this context.

func HasFsckForce

func HasFsckForce(ctx context.Context) bool

HasFsckForce returns true if a value for fsck force has been set in this context.

func HasFsckFunc

func HasFsckFunc(ctx context.Context) bool

HasFsckFunc returns true if a fsck func has been set in this context.

func IsCheckRecipients

func IsCheckRecipients(ctx context.Context) bool

IsCheckRecipients will return the value of the check recipients flag or the default value (false).

func IsFsckCheck

func IsFsckCheck(ctx context.Context) bool

IsFsckCheck returns the value of fsck check.

func IsFsckDecrypt

func IsFsckDecrypt(ctx context.Context) bool

IsFsckDecrypt will return the value for the decrypt during fsck, defaulting to false.

func IsFsckForce

func IsFsckForce(ctx context.Context) bool

IsFsckForce returns the value of fsck force.

func IsNoGitOps

func IsNoGitOps(ctx context.Context) bool

IsNoGitOps returns the value for NoGitOps from the context or the default (false).

func IsPubkeyUpdate added in v1.14.10

func IsPubkeyUpdate(ctx context.Context) bool

IsPubkeyUpdate returns true if we should update all exported recipients pub keys.

func WithCheckRecipients

func WithCheckRecipients(ctx context.Context, cr bool) context.Context

WithCheckRecipients will return a context with the flag for check recipients set.

func WithFsckCheck

func WithFsckCheck(ctx context.Context, check bool) context.Context

WithFsckCheck returns a context with the flag for fscks check set.

func WithFsckDecrypt

func WithFsckDecrypt(ctx context.Context, d bool) context.Context

WithFsckDecrypt will return a context with the value for the decrypt during fsck flag set.

func WithFsckForce

func WithFsckForce(ctx context.Context, force bool) context.Context

WithFsckForce returns a context with the flag for fsck force set.

func WithFsckFunc

func WithFsckFunc(ctx context.Context, imf store.FsckCallback) context.Context

WithFsckFunc will return a context with the fsck confirmation callback set.

func WithNoGitOps

func WithNoGitOps(ctx context.Context, d bool) context.Context

WithNoGitOps returns a context with the value for NoGitOps set. This will skip any git operations in concurrent goroutines.

func WithPubkeyUpdate added in v1.14.10

func WithPubkeyUpdate(ctx context.Context, d bool) context.Context

WithPubkeyUpdate returns a context with the selection to update all exported recipients pub keys set.

Types

type ErrorSeverity added in v1.15.3

type ErrorSeverity int

ErrorSeverity provides a way for a function to specify how severe of an error it experienced.

func (ErrorSeverity) String added in v1.15.3

func (e ErrorSeverity) String() string

type InvalidRecipientsError added in v1.15.3

type InvalidRecipientsError struct {
	Invalid map[string]error
}

InvalidRecipientsError is a custom error type that contains a list of invalid recipients with their check failures.

func (InvalidRecipientsError) Error added in v1.15.3

func (e InvalidRecipientsError) Error() string

func (InvalidRecipientsError) IsError added in v1.15.3

func (e InvalidRecipientsError) IsError() bool

IsError returns true if this multi error contains any underlying errors.

type Store

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

Store is a password store.

func Init

func Init(ctx context.Context, alias, path string) (*Store, error)

Init initializes this sub store.

func New

func New(ctx context.Context, alias, path string) (*Store, error)

New creates a new store.

func (*Store) AddRecipient

func (s *Store) AddRecipient(ctx context.Context, id string) error

AddRecipient adds a new recipient to the list.

func (*Store) Alias

func (s *Store) Alias() string

Alias returns the value of alias.

func (*Store) CheckRecipients added in v1.15.3

func (s *Store) CheckRecipients(ctx context.Context) error

CheckRecipients makes sure all existing recipients are valid.

func (*Store) Concurrency added in v1.14.0

func (s *Store) Concurrency() int

Concurrency returns the number of concurrent operations allowed by this stores crypto implementation (e.g. usually 1 for GPG).

func (*Store) Convert

func (s *Store) Convert(ctx context.Context, cryptoBe backend.CryptoBackend, storageBe backend.StorageBackend, move bool) error

Convert will convert an existing store to a new store with possibly different set of crypto and storage backends. Please note that it will happily convert to the same set of backends if requested.

func (*Store) Copy

func (s *Store) Copy(ctx context.Context, 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) Crypto

func (s *Store) Crypto() backend.Crypto

Crypto returns the crypto backend.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, name string) error

Delete will remove an single entry from the store.

func (*Store) Equals

func (s *Store) Equals(other *Store) bool

Equals returns true if this storage has the same on-disk path as the other.

func (*Store) Exists

func (s *Store) Exists(ctx context.Context, name string) bool

Exists checks the existence of a single entry.

func (*Store) Fsck

func (s *Store) Fsck(ctx context.Context, path string) error

Fsck checks all entries matching the given prefix.

func (*Store) Get

func (s *Store) Get(ctx context.Context, name string) (gopass.Secret, error)

Get returns the plaintext of a single key.

func (*Store) GetRecipients

func (s *Store) GetRecipients(ctx context.Context, name string) (*recipients.Recipients, error)

GetRecipients will load all Recipients from the .gpg-id file for the given secret path.

func (*Store) GetRevision

func (s *Store) GetRevision(ctx context.Context, name, revision string) (gopass.Secret, error)

GetRevision will retrieve a single revision from the backend.

func (*Store) GetTemplate

func (s *Store) GetTemplate(ctx context.Context, name string) ([]byte, error)

GetTemplate will return the content of the named template.

func (*Store) GitInit

func (s *Store) GitInit(ctx context.Context) error

GitInit initializes the git storage.

func (*Store) GitStatus

func (s *Store) GitStatus(ctx context.Context, _ string) error

GitStatus shows the git status output.

func (*Store) HasTemplate

func (s *Store) HasTemplate(ctx context.Context, name string) bool

HasTemplate returns true if the template exists.

func (*Store) ImportMissingPublicKeys

func (s *Store) ImportMissingPublicKeys(ctx context.Context, newrs ...string) error

ImportMissingPublicKeys will try to import any missing public keys from the .public-keys folder in the password store.

func (*Store) Init

func (s *Store) Init(ctx context.Context, path string, ids ...string) error

Init tries to initialize a new password store location matching the object.

func (*Store) IsDir

func (s *Store) IsDir(ctx context.Context, name string) bool

IsDir returns true if the entry is folder inside the store.

func (*Store) IsInitialized

func (s *Store) IsInitialized(ctx context.Context) bool

IsInitialized returns true if the store is properly initialized.

func (s *Store) Link(ctx context.Context, from, to string) error

Link creates a symlink.

func (*Store) List

func (s *Store) List(ctx context.Context, prefix string) ([]string, error)

List will list all entries in this store.

func (*Store) ListRevisions

func (s *Store) ListRevisions(ctx context.Context, name string) ([]backend.Revision, error)

ListRevisions will list all revisions for a secret.

func (*Store) ListTemplates

func (s *Store) ListTemplates(ctx context.Context, prefix string) []string

ListTemplates will list all templates in this store.

func (*Store) Lock added in v1.12.0

func (s *Store) Lock() error

Lock clears the credential caches of all supported backends.

func (*Store) LookupTemplate

func (s *Store) LookupTemplate(ctx context.Context, name string) (string, []byte, bool)

LookupTemplate will lookup and return a template.

func (*Store) Move

func (s *Store) Move(ctx context.Context, from, to string) error

Move will move one entry from one location to another. 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) OurKeyID

func (s *Store) OurKeyID(ctx context.Context) string

OurKeyID returns the key fingprint this user can use to access the store (if any).

func (*Store) Passfile added in v1.14.1

func (s *Store) Passfile(name string) string

Passfile returns the name of gpg file on disk, for the given key/name.

func (*Store) Path

func (s *Store) Path() string

Path returns the value of path.

func (*Store) Prune

func (s *Store) Prune(ctx context.Context, tree string) error

Prune will remove a subtree from the Store.

func (*Store) Recipients

func (s *Store) Recipients(ctx context.Context) []string

Recipients returns the list of recipients of this store.

func (*Store) RecipientsTree

func (s *Store) RecipientsTree(ctx context.Context) map[string][]string

RecipientsTree returns a mapping of secrets to recipients. Note: Usually that is one set of recipients per store, but we offer limited support of different recipients per sub-directory so this is why we are here.

func (*Store) RemoveRecipient

func (s *Store) RemoveRecipient(ctx context.Context, key string) error

RemoveRecipient will remove the given recipient from the store but if this key is not available on this machine we just try to remove it literally.

func (*Store) RemoveTemplate

func (s *Store) RemoveTemplate(ctx context.Context, name string) error

RemoveTemplate will delete the named template if it exists.

func (*Store) SaveRecipients

func (s *Store) SaveRecipients(ctx context.Context, ack bool) error

SaveRecipients persists the current recipients on disk. Setting ack to true will acknowledge an invalid hash and allow updating it.

func (*Store) Set

func (s *Store) Set(ctx context.Context, name string, sec gopass.Byter) error

Set encodes and writes the ciphertext of one entry to disk.

func (*Store) SetRecipients

func (s *Store) SetRecipients(ctx context.Context, rs *recipients.Recipients) error

SetRecipients will update the stored recipients.

func (*Store) SetTemplate

func (s *Store) SetTemplate(ctx context.Context, name string, content []byte) error

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

func (*Store) Storage

func (s *Store) Storage() backend.Storage

Storage returns the storage backend used by this store.

func (*Store) String

func (s *Store) String() string

String implement fmt.Stringer.

func (*Store) TemplateTree

func (s *Store) TemplateTree(ctx context.Context) *tree.Root

TemplateTree returns a tree of all templates.

func (*Store) UpdateExportedPublicKeys added in v1.14.6

func (s *Store) UpdateExportedPublicKeys(ctx context.Context, rs []string) (bool, error)

UpdateExportedPublicKeys will export any possibly missing public keys to the stores .public-keys directory.

func (*Store) Valid

func (s *Store) Valid() bool

Valid returns true if this store is not nil.

Jump to

Keyboard shortcuts

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