secrets

package
Version: v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Ident is the header of the deprecated Gopass MIME secret.
	Ident = "GOPASS-SECRET-1.0"
)

Variables

View Source
var ErrNoYAML = fmt.Errorf("no YAML marker")

ErrNoYAML is returned when no YAML section is found.

View Source
var ErrNotSupported = fmt.Errorf("not supported")

ErrNotSupported is returned when a method is not supported.

Functions

func New

func New() gopass.Secret

New creates a new secret.

Types

type AKV added in v1.15.0

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

AKV is the new Key-Value implementation that will replace KV.

func NewAKV added in v1.15.0

func NewAKV() *AKV

NewAKV creates a new AKV instances.

func NewAKVWithData added in v1.15.0

func NewAKVWithData(pw string, kvps map[string][]string, body string, converted bool) *AKV

NewKVWithData returns a new KV secret populated with data.

func ParseAKV added in v1.15.0

func ParseAKV(in []byte) *AKV

ParseAKV tries to parse an AKV secret.

func (*AKV) Add added in v1.15.0

func (a *AKV) Add(key string, value any) error

Add appends data to a given key.

func (*AKV) Body added in v1.15.0

func (a *AKV) Body() string

Body returns the body.

func (*AKV) Bytes added in v1.15.0

func (a *AKV) Bytes() []byte

Bytes returns the raw string as bytes.

func (*AKV) Del added in v1.15.0

func (a *AKV) Del(key string) bool

Del removes a given key and all of its values.

func (*AKV) FromMime added in v1.15.0

func (a *AKV) FromMime() bool

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

func (*AKV) Get added in v1.15.0

func (a *AKV) Get(key string) (string, bool)

Get returns the value of the requested key, if found.

func (*AKV) Keys added in v1.15.0

func (a *AKV) Keys() []string

Keys returns all the parsed keys.

func (*AKV) Password added in v1.15.0

func (a *AKV) Password() string

Password returns the password.

func (*AKV) SafeStr added in v1.15.0

func (a *AKV) SafeStr() string

SafeStr always returnes "(elided)".

func (*AKV) Set added in v1.15.0

func (a *AKV) Set(key string, value any) error

Set writes a single key.

func (*AKV) SetPassword added in v1.15.0

func (a *AKV) SetPassword(p string)

SetPassword updates the password.

func (*AKV) Values added in v1.15.0

func (a *AKV) Values(key string) ([]string, bool)

Values returns all values for that key.

func (*AKV) Write added in v1.15.0

func (a *AKV) Write(buf []byte) (int, error)

Write appends the buffer to the secret's body.

type PermanentError

type PermanentError struct {
	Err error
}

PermanentError signal that parsing should not attempt other formats.

func (*PermanentError) Error

func (p *PermanentError) Error() string

type YAML

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

YAML is a gopass secret that contains a parsed YAML data structure. This is a legacy data type that is discouraged for new users as YAML is neither trivial nor intuitive for users manually editing secrets (e.g. unquoted phone numbers being parsed as octal and such).

Format ------ Line | Description

  0 | Password
1-n | Body
n+1 | Separator ("---")
n+2 | YAML content.

func ParseYAML

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

ParseYAML will try to parse a YAML secret.

func (*YAML) Add added in v1.12.0

func (y *YAML) Add(key string, value any) error

Add doesn't work since as per YAML specification keys must be unique.

func (*YAML) Body

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 first value of a single key.

func (*YAML) Keys

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

Keys returns all keys.

func (*YAML) Password

func (y *YAML) Password() string

Password returns the password.

func (*YAML) SafeStr added in v1.12.5

func (y *YAML) SafeStr() string

SafeStr always returnes "(elided)".

func (*YAML) Set

func (y *YAML) Set(key string, value any) error

Set sets a key to a given value.

func (*YAML) SetPassword

func (y *YAML) SetPassword(v string)

SetPassword updates the password.

func (*YAML) Values added in v1.12.0

func (y *YAML) Values(key string) ([]string, bool)

Values returns Get since as per YAML specification keys must be unique.

func (*YAML) Write

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

Write appends the buffer to the secret's body.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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