store

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const KeyTemplateName = "_keys"

KeyTemplateName is the name of the value that configures the default set of key settings.

Variables

View Source
var (

	// ErrNameNotFound is returned by Get if the named secret does not exist.
	ErrNameNotFound = errors.New("name not found")
)

Functions

This section is empty.

Types

type EntryMap

type EntryMap map[string]ValueList

EntryMap represents the contents of the file.

type FileStore

type FileStore string

FileStore stores an EntryMap in a YAML file on local disk.

func NewFileStore

func NewFileStore(filename string) FileStore

NewFileStore constructs a FileStore for a specific filename.

func (FileStore) Get

func (f FileStore) Get(name string) (ValueList, error)

Get a value.

func (FileStore) GetAll

func (f FileStore) GetAll() (EntryMap, error)

GetAll returns all of the entries in the file.

func (FileStore) GetKeyIds

func (f FileStore) GetKeyIds() ([]Key, error)

GetKeyIds returns the keys specified by the template entry.

func (FileStore) Put

func (f FileStore) Put(name string, values ValueList) error

Put a value.

type Key

type Key struct {
	// KeyID is the key that a value is encrypted under. This identifies which key the
	// KeyManager should use.
	KeyID string `yaml:"key_id,omitempty"`
	// KeyManager indicates which key manager provided this key.
	KeyManager string `yaml:"key_manager,omitempty"`
	// Algorithm used for cryptographic operations.
	Algorithm string `yaml:"algorithm"`
}

Key defines key and crypto settings for a particular value.

type Sort added in v0.1.4

type Sort func(v ValueList)

Sort is a function that rearranges a ValueList in place.

func SortByKmsRegion added in v0.1.4

func SortByKmsRegion(regions []string) Sort

SortByKmsRegion returns a Sort that will order a ValueList such that the head of the list contains Values in the same order as the regions passed to this function.

type Value

type Value struct {
	// Key references the key and cryptographic settings for this Value.
	Key `yaml:",inline"`

	// KeyCiphertext is the encryption key that Ciphertext is encrypted with, but encrypted with a
	// key that only the Provider has.
	KeyCiphertext string `yaml:"key_ciphertext,omitempty"`
	// Ciphertext is the plaintext encrypted with the ephemeral key.
	Ciphertext string `yaml:"ciphertext,omitempty"`
}

Value is one entry in the file.

func (*Value) GetCiphertext

func (v *Value) GetCiphertext() ([]byte, error)

GetCiphertext returns the base64-decoded ciphertext.

func (*Value) GetKeyCiphertext

func (v *Value) GetKeyCiphertext() ([]byte, error)

GetKeyCiphertext returns the base64-decoded encrypted key.

type ValueList

type ValueList []Value

ValueList represents a list of Values.

func (ValueList) FilterByKeyManager

func (v ValueList) FilterByKeyManager(manager string) ValueList

FilterByKeyManager returns a new ValueList consisting only of the Values corresponding to a specific key manager.

Jump to

Keyboard shortcuts

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