Documentation
¶
Overview ¶
package sops provides convinience methods for using https://github.com/mozilla/sops as a library
Index ¶
- type SopsData
- func (d *SopsData) Data() map[string]string
- func (s *SopsData) Decrypt() (*SopsData, error)
- func (s *SopsData) Encrypt(m keys.MasterKey) (*SopsData, error)
- func (d *SopsData) IsEncrypted() bool
- func (d SopsData) MarshalJSON() ([]byte, error)
- func (d SopsData) MarshalYAML() (interface{}, error)
- func (d *SopsData) NeedsKey() bool
- func (d *SopsData) UnmarshalJSON(data []byte) error
- func (d *SopsData) UnmarshalYAML(unmarshal func(interface{}) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SopsData ¶
type SopsData struct {
// contains filtered or unexported fields
}
SopsData is a wrapper around sops data. It can be embedded in other structs. It has been tested with stldib json and https://github.com/go-yaml/yaml
func (*SopsData) Data ¶
Data returns the data. It may or may not be encrypted. Use IsEncrypted() to check
func (*SopsData) Decrypt ¶
Decrypt the data. The data must have been encrypted using encrypt. You must have access to the key used to encrypt the data.
func (*SopsData) Encrypt ¶
Encrypt the data. If the data was decrypted before using Decrypt, then a key is not needed. However, always use NeedsKey to check. Must have access to the key used to decrypt or the one passed in. If the data was decrypted using Decrypt and a key is passed to this function, then the key passed in is used to encrypt.
func (*SopsData) IsEncrypted ¶
IsEncrypted checks if the data is encrypted.
func (SopsData) MarshalJSON ¶
MarshalJSON encodes the data as JSON
func (SopsData) MarshalYAML ¶
MarshalYAML encodes the data as YAML
func (*SopsData) NeedsKey ¶
NeedsKey checks if a key should be provided to encrypt. Generally, a key is only needed the first time data is encrypted. if the data comes from a call to Decrypt, then a key is not needed. However, one should always check.
func (*SopsData) UnmarshalJSON ¶
UnmarshalJSON decodes the data from JSON
func (*SopsData) UnmarshalYAML ¶
UnmarshalYAML decodes the data from YAML