Documentation ¶
Index ¶
- Constants
- Variables
- func New() gopass.Secret
- type KV
- func (k *KV) Add(key string, value any) error
- func (k *KV) Body() string
- func (k *KV) Bytes() []byte
- func (k *KV) Del(key string) bool
- func (k *KV) FromMime() bool
- func (k *KV) Get(key string) (string, bool)
- func (k *KV) Keys() []string
- func (k *KV) Password() string
- func (k *KV) SafeStr() string
- func (k *KV) Set(key string, value any) error
- func (k *KV) SetPassword(p string)
- func (k *KV) Values(key string) ([]string, bool)
- func (k *KV) Write(buf []byte) (int, error)
- type PermanentError
- type Plain
- func (p *Plain) Add(_ string, _ any) error
- func (p *Plain) Body() string
- func (p *Plain) Bytes() []byte
- func (p *Plain) Del(_ string) bool
- func (p *Plain) Get(key string) (string, bool)
- func (p *Plain) Getbuf() string
- func (p *Plain) Keys() []string
- func (p *Plain) Password() string
- func (p *Plain) SafeStr() string
- func (p *Plain) Set(_ string, _ any) error
- func (p *Plain) SetPassword(value string)
- func (p *Plain) Values(key string) ([]string, bool)
- func (p *Plain) Write(buf []byte) (int, error)
- func (p *Plain) WriteString(in string)
- type YAML
- func (y *YAML) Add(key string, value any) error
- func (y *YAML) Body() string
- func (y *YAML) Bytes() []byte
- func (y *YAML) Del(key string) bool
- func (y *YAML) Get(key string) (string, bool)
- func (y *YAML) Keys() []string
- func (y *YAML) Password() string
- func (y *YAML) SafeStr() string
- func (y *YAML) Set(key string, value any) error
- func (y *YAML) SetPassword(v string)
- func (y *YAML) Values(key string) ([]string, bool)
- func (y *YAML) Write(buf []byte) (int, error)
Constants ¶
const (
// Ident is the header of the deprecated Gopass MIME secret.
Ident = "GOPASS-SECRET-1.0"
)
Variables ¶
var ErrMultiKey = fmt.Errorf("multiple identical keys not supported")
ErrMultiKey is returned when a key is found multiple times.
var ErrNoYAML = fmt.Errorf("no YAML marker")
ErrNoYAML is returned when no YAML section is found.
var ErrNotSupported = fmt.Errorf("not supported")
ErrNotSupported is returned when a method is not supported.
Functions ¶
Types ¶
type KV ¶
type KV struct {
// contains filtered or unexported fields
}
KV is a secret that contains a password line (maybe empty), any number of lines of key-value pairs (defined as: contains a colon) and any number of free text lines. This is the default secret format gopass uses and encourages. It should be compatible with most other password store implementations and works well with our vanity features (e.g. accessing single entries in secret).
Format ------ Line | Description ---- | -----------
0 | Password. Must contain the "password" or be empty. Can not be omitted. 1-n | Key-Value pairs, e.g. "key: value". Can be omitted but the secret | might get parsed as a "Plain" secret if zero key-value pairs are found. n+1 | Body. Can contain any number of characters that will be parsed as | UTF-8 and appended to an internal string. Note: Technically this can | be any kind of binary data but we neither support nor test this with | non-text data. Also we do not intent do support any kind of streaming | access, i.e. this is not intended for huge files.
Example ------- Line | Content ---- | -------
0 | foobar 1 | hello: world 2 | gopass: secret 3 | Yo 4 | Hi
This would be parsed as a KV secret that contains:
- password: "foobar"
- key-value pairs:
- "hello": "world"
- "gopass": "secret"
- body: "Yo\nHi"
func NewKVWithData ¶
NewKVWithData returns a new KV secret populated with data.
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 Plain ¶
type Plain struct {
// contains filtered or unexported fields
}
Plain is a fallback secret type that is used if none of the other secret parsers accept the input. This secret only contains a byte slice of the input data. We attempt to support retrieving and even writing the password by looking for the first line break. The body (everything after the first line break) can also be retrieved. Key-value operations are not supported.
DO NOT use this, if possible.
func ParsePlain ¶
ParsePlain never fails and always returns a Plain secret.
func (*Plain) SetPassword ¶
SetPassword updates the first line.
func (*Plain) WriteString ¶
WriteString append a string to the internal buffer.
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 (*YAML) Add ¶ added in v1.12.0
Add doesn't work since as per YAML specification keys must be unique.