low

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigType = "low"

ConfigType is the name of the config type for the low-security secret keeper.

Variables

View Source
var ErrUnsupportedVersion = errors.New("unsupported low security file version")

ErrUnsupportedVersion is returned when the low security file version is not supported.

Functions

func Builder

func Builder(_ context.Context, c any) (secrets.Keeper, error)

Builder builds a new low-security secret keeper.

Types

type Config

type Config struct {
	// Path is the path to the low-level configuration file.
	Path string `mapstructure:"path" yaml:"path"`
}

Config is the configuration for the low-security secret keeper.

type LowSecurity

type LowSecurity struct {
	// LoaderSaver is the loader/saver to use for the secrets.
	fssafe.LoaderSaver
}

LowSecurity is a secret keeper for storing secrets in plain text. Only suitable for very low value secrets.

func NewLowSecurity

func NewLowSecurity(path string) *LowSecurity

NewLowSecurity creates a new low security secret keeper at the given path.

func NewLowSecurityCustom

func NewLowSecurityCustom(ls fssafe.LoaderSaver) *LowSecurity

NewLowSecurityCustom creates a new low security secret keeper with the given loader/saver.

func (*LowSecurity) CopySecret

func (s *LowSecurity) CopySecret(
	ctx context.Context,
	id string,
	location string,
) (secrets.Secret, error)

CopySecret copies the secret with the given ID from the low security file to the given location.

func (*LowSecurity) DeleteSecret

func (s *LowSecurity) DeleteSecret(
	ctx context.Context,
	id string,
) error

DeleteSecret deletes the secret with the given ID from the low security file.

func (*LowSecurity) GetSecret

func (s *LowSecurity) GetSecret(
	ctx context.Context,
	id string,
) (secrets.Secret, error)

GetSecret returns the secret with the given ID from the low security file.

func (*LowSecurity) GetSecretsByName

func (s *LowSecurity) GetSecretsByName(
	ctx context.Context,
	name string,
) ([]secrets.Secret, error)

GetSecretsByName returns all the secrets with the given name from the low security file.

func (*LowSecurity) ListLocations

func (s *LowSecurity) ListLocations(context.Context) ([]string, error)

ListLocations returns all the locations listed in the low security file.

func (*LowSecurity) ListSecrets

func (s *LowSecurity) ListSecrets(
	ctx context.Context,
	location string,
) ([]string, error)

ListSecrets returns all the secrets listed in the low security file for the given location.

func (*LowSecurity) MoveSecret

func (s *LowSecurity) MoveSecret(
	ctx context.Context,
	id string,
	location string,
) (secrets.Secret, error)

MoveSecret moves the secre to a new location.

func (*LowSecurity) SetSecret

func (s *LowSecurity) SetSecret(
	ctx context.Context,
	secret secrets.Secret,
) (secrets.Secret, error)

SetSecret sets the secret with the given ID in the low security file.

type Secret

type Secret struct {
	secrets.Single
	// contains filtered or unexported fields
}

Secret is a secrets.Secret implementation that wraps secrets.Single with a settable id and with YAML marshalling and unmarshalling.

func (*Secret) ID

func (s *Secret) ID() string

ID returns the secret ID.

func (*Secret) MarshalYAML

func (s *Secret) MarshalYAML() (interface{}, error)

MarshalYAML marshals the secret to YAML.

func (*Secret) SetID

func (s *Secret) SetID(id string)

SetID sets the secret ID.

func (*Secret) UnmarshalYAML

func (s *Secret) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML unmarshals the secret from YAML.

Jump to

Keyboard shortcuts

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