secrets

package
v0.47.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchSecret = errors.New("no such secret")

ErrNoSuchSecret indicates that the secret does not exist

Functions

This section is empty.

Types

type Secret

type Secret struct {
	// Name is the name of the secret
	Name string `json:"name"`
	// ID is the unique secret ID
	ID string `json:"id"`
	// Metadata stores other metadata on the secret
	Metadata map[string]string `json:"metadata,omitempty"`
	// CreatedAt is when the secret was created
	CreatedAt time.Time `json:"createdAt"`
	// Driver is the driver used to store secret data
	Driver string `json:"driver"`
	// DriverOptions is other metadata needed to use the driver
	DriverOptions map[string]string `json:"driverOptions"`
}

Secret defines a secret

type SecretsDriver

type SecretsDriver interface {
	// List lists all secret ids in the secrets data store
	List() ([]string, error)
	// Lookup gets the secret's data bytes
	Lookup(id string) ([]byte, error)
	// Store stores the secret's data bytes
	Store(id string, data []byte) error
	// Delete deletes a secret's data from the driver
	Delete(id string) error
}

SecretsDriver interfaces with the secrets data store. The driver stores the actual bytes of secret data, as opposed to the secret metadata. Currently only the unencrypted filedriver is implemented.

type SecretsManager

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

SecretsManager holds information on handling secrets

func NewManager

func NewManager(rootPath string) (*SecretsManager, error)

NewManager creates a new secrets manager rootPath is the directory where the secrets data file resides

func (*SecretsManager) Delete

func (s *SecretsManager) Delete(nameOrID string) (string, error)

Delete removes all secret metadata and secret data associated with the specified secret. Delete takes a name, ID, or partial ID.

func (*SecretsManager) List

func (s *SecretsManager) List() ([]Secret, error)

List lists all secrets.

func (*SecretsManager) Lookup

func (s *SecretsManager) Lookup(nameOrID string) (*Secret, error)

Lookup gives a secret's metadata given its name, ID, or partial ID.

func (*SecretsManager) LookupSecretData

func (s *SecretsManager) LookupSecretData(nameOrID string) (*Secret, []byte, error)

LookupSecretData returns secret metadata as well as secret data in bytes. The secret data can be looked up using its name, ID, or partial ID.

func (*SecretsManager) Store

func (s *SecretsManager) Store(name string, data []byte, driverType string, driverOpts map[string]string) (string, error)

Store takes a name, creates a secret and stores the secret metadata and the secret payload. It returns a generated ID that is associated with the secret. The max size for secret data is 512kB.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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