secrets

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New added in v1.11.0

func New() gopass.Secret

New creates a new secret

Types

type KV

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

KV is a simple key value secret

func NewKV added in v1.11.0

func NewKV() *KV

NewKV creates a new KV secret

func ParseKV

func ParseKV(in []byte) (*KV, error)

ParseKV tries to parse a KV secret

func ParseLegacyMIME added in v1.11.0

func ParseLegacyMIME(buf []byte) (*KV, error)

ParseLegacyMIME is a fallback parser for the transient MIME format TODO Unexport this TODO Add tests

func (*KV) Body added in v1.11.0

func (k *KV) Body() string

Body returns the body

func (*KV) Bytes

func (k *KV) Bytes() []byte

Bytes serializes

func (*KV) Del

func (k *KV) Del(key string) bool

Del removes a key

func (*KV) FromMime added in v1.11.0

func (k *KV) FromMime() bool

FromMime returns which whether this secret was converted from a Mime secret of not

func (*KV) Get

func (k *KV) Get(key string) (string, bool)

Get returns a single key

func (*KV) Keys

func (k *KV) Keys() []string

Keys returns all keys

func (*KV) Password added in v1.11.0

func (k *KV) Password() string

Password returns the password

func (*KV) Set

func (k *KV) Set(key string, value interface{}) error

Set writes a single key

func (*KV) SetPassword added in v1.11.0

func (k *KV) SetPassword(p string)

SetPassword updates the password

func (*KV) Write added in v1.11.0

func (k *KV) Write(buf []byte) (int, error)

Write appends the buffer to the secret's body

type Plain

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

Plain is the fallback secret that only contains plain text

func ParsePlain

func ParsePlain(in []byte) *Plain

ParsePlain never fails and always returns a Plain secret

func (*Plain) Body

func (p *Plain) Body() string

Body contains everything but the first line

func (*Plain) Bytes

func (p *Plain) Bytes() []byte

Bytes returns the complete secret

func (*Plain) Del

func (p *Plain) Del(_ string) bool

Del does nothing

func (*Plain) Get

func (p *Plain) Get(key string) (string, bool)

Get returns the first line (for password) or the empty string

func (*Plain) Getbuf added in v1.11.0

func (p *Plain) Getbuf() string

Getbuf returns everything execpt the first line

func (*Plain) Keys

func (p *Plain) Keys() []string

Keys always returns nil

func (*Plain) Password added in v1.11.0

func (p *Plain) Password() string

Password returns the first line

func (*Plain) Set

func (p *Plain) Set(_ string, _ interface{}) error

Set does nothing

func (*Plain) SetPassword added in v1.11.0

func (p *Plain) SetPassword(value string)

SetPassword updates the first line

func (*Plain) Write added in v1.11.0

func (p *Plain) Write(buf []byte) (int, error)

Write appends to the internal buffer

func (*Plain) WriteString added in v1.11.0

func (p *Plain) WriteString(in string)

WriteString append a string to the internal buffer

type YAML

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

YAML is a YAML secret

func ParseYAML

func ParseYAML(in []byte) (*YAML, error)

ParseYAML will try to parse a YAML secret.

func (*YAML) Body added in v1.11.0

func (y *YAML) Body() string

Body returns the body

func (*YAML) Bytes

func (y *YAML) Bytes() []byte

Bytes serialized this secret

func (*YAML) Del

func (y *YAML) Del(key string) bool

Del removes a single key

func (*YAML) Get

func (y *YAML) Get(key string) (string, bool)

Get returns the value of a single key

func (*YAML) Keys

func (y *YAML) Keys() []string

Keys returns all keys

func (*YAML) Password added in v1.11.0

func (y *YAML) Password() string

Password returns the password

func (*YAML) Set

func (y *YAML) Set(key string, value interface{}) error

Set sets a key to a given value

func (*YAML) SetPassword added in v1.11.0

func (y *YAML) SetPassword(v string)

SetPassword updates the password

func (*YAML) Write added in v1.11.0

func (y *YAML) Write(buf []byte) (int, error)

Write appends the buffer to the secret's body

Jump to

Keyboard shortcuts

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