secrets

package
v1.9.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// PayloadVersion represents the version of the SB API
	PayloadVersion = "1.0"
)

Variables

This section is empty.

Functions

func IsEnc

func IsEnc(str string) bool

IsEnc returns true if a string respects the ENC[<handle>] format

func Retriable added in v0.6.0

func Retriable(err error) bool

Retriable can be used to evaluate whether an error should be retried

func SetSecretBackendArgs added in v0.5.0

func SetSecretBackendArgs(args []string)

SetSecretBackendArgs set the secretBackendArgs var

func SetSecretBackendCommand added in v0.4.0

func SetSecretBackendCommand(command string)

SetSecretBackendCommand set the secretBackendCommand var

Types

type Decryptor

type Decryptor interface {
	Decrypt([]string) (map[string]string, error)
}

Decryptor is used to decrypt encrypted secrets Decryptor is implemented by SecretBackend

type DecryptorError added in v0.6.0

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

DecryptorError describes the error returned by a Decryptor

func NewDecryptorError added in v0.6.0

func NewDecryptorError(err error, retriable bool) *DecryptorError

NewDecryptorError returns a new DecryptorError

func (*DecryptorError) Error added in v0.6.0

func (e *DecryptorError) Error() string

Error implements the Error interface

func (*DecryptorError) IsRetriable added in v0.6.0

func (e *DecryptorError) IsRetriable() bool

IsRetriable returns wether the error is retriable

func (*DecryptorError) Unwrap added in v0.6.0

func (e *DecryptorError) Unwrap() error

Unwrap implements the Error interface

type DummyDecryptor added in v0.6.0

type DummyDecryptor struct {
	mock.Mock
	// contains filtered or unexported fields
}

DummyDecryptor can be used in other packages to mock the secret backend

func NewDummyDecryptor added in v0.6.0

func NewDummyDecryptor(maxRetries int) *DummyDecryptor

NewDummyDecryptor returns a dummy decryptor for tests maxRetries is the number of retries before returning a nil error If maxRetries < 0 Decrypt directly returns a permanent error If maxRetries == 0 Decrypt directly returns a nil error If maxRetries > 0 Decrypt returns a retriable error until it's called maxRetries-times then returns a nil error

func (*DummyDecryptor) Decrypt added in v0.6.0

func (d *DummyDecryptor) Decrypt(secrets []string) (map[string]string, error)

Decrypt is used for testing

type Secret added in v0.5.0

type Secret struct {
	Value    string `json:"value,omitempty"`
	ErrorMsg string `json:"error,omitempty"`
}

Secret defines the structure for secrets in JSON output

type SecretBackend

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

SecretBackend retrieves secrets from secret backend binary SecretBackend implements the Decryptor interface

func NewSecretBackend

func NewSecretBackend() *SecretBackend

NewSecretBackend returns a new SecretBackend instance

func (*SecretBackend) Decrypt

func (sb *SecretBackend) Decrypt(encrypted []string) (map[string]string, error)

Decrypt tries to decrypt a given string slice using the secret backend command

Jump to

Keyboard shortcuts

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