Documentation ¶
Index ¶
- Constants
- Variables
- func Builder(_ context.Context, c any) (secrets.Keeper, error)
- type Config
- type LowSecurity
- func (s *LowSecurity) CopySecret(ctx context.Context, id string, location string) (secrets.Secret, error)
- func (s *LowSecurity) DeleteSecret(ctx context.Context, id string) error
- func (s *LowSecurity) GetSecret(ctx context.Context, id string) (secrets.Secret, error)
- func (s *LowSecurity) GetSecretsByName(ctx context.Context, name string) ([]secrets.Secret, error)
- func (s *LowSecurity) ListLocations(context.Context) ([]string, error)
- func (s *LowSecurity) ListSecrets(ctx context.Context, location string) ([]string, error)
- func (s *LowSecurity) MoveSecret(ctx context.Context, id string, location string) (secrets.Secret, error)
- func (s *LowSecurity) SetSecret(ctx context.Context, secret secrets.Secret) (secrets.Secret, error)
- type Secret
Constants ¶
const ConfigType = "low"
ConfigType is the name of the config type for the low-security secret keeper.
Variables ¶
var ErrUnsupportedVersion = errors.New("unsupported low security file version")
ErrUnsupportedVersion is returned when the low security file version is not supported.
Functions ¶
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 ¶
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 ¶
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.
type Secret ¶
Secret is a secrets.Secret implementation that wraps secrets.Single with a settable id and with YAML marshalling and unmarshalling.
func (*Secret) MarshalYAML ¶
MarshalYAML marshals the secret to YAML.
func (*Secret) UnmarshalYAML ¶
UnmarshalYAML unmarshals the secret from YAML.