gopass: Index | Files

package secret

import ""


Package Files

kv.go secret.go yaml.go

type Secret Uses

type Secret struct {
    // contains filtered or unexported fields

Secret is a decoded secret

func New Uses

func New(password, body string) *Secret

New creates a new secret

func Parse Uses

func Parse(buf []byte) (*Secret, error)

Parse decodes an secret. It will always return a valid secret. If decoding the body to YAML is may return an error which can be ignored.

func (*Secret) Body Uses

func (s *Secret) Body() string

Body returns the body of a secret. If the body was valid YAML it returns an empty string

func (*Secret) Bytes Uses

func (s *Secret) Bytes() ([]byte, error)

Bytes encodes an secret

func (*Secret) Data Uses

func (s *Secret) Data() map[string]interface{}

Data returns the data of a secret. Unless the body was valid YAML, it returns an map

func (*Secret) DeleteKey Uses

func (s *Secret) DeleteKey(key string) error

DeleteKey key will delete a single key from an decoded map

func (*Secret) Equal Uses

func (s *Secret) Equal(other store.Secret) bool

Equal returns true if two secrets are equal

func (*Secret) Password Uses

func (s *Secret) Password() string

Password returns the first line from a secret

func (*Secret) SetBody Uses

func (s *Secret) SetBody(b string) error

SetBody sets a new body possibly erasing an decoded YAML map

func (*Secret) SetPassword Uses

func (s *Secret) SetPassword(pw string)

SetPassword sets a new password (i.e. the first line)

func (*Secret) SetValue Uses

func (s *Secret) SetValue(key, value string) error

SetValue sets a key to a given value. Will fail if an non-empty body exists

func (*Secret) String Uses

func (s *Secret) String() string

String encodes and returns a string representation of a secret

func (*Secret) Value Uses

func (s *Secret) Value(key string) (string, error)

Value returns the value of the given key if the body contained valid YAML

Package secret imports 10 packages (graph). Updated 2019-03-28. Refresh now. Tools for package owners.