Version: v1.0.0 Latest Latest

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

Go to latest
Published: Feb 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0




This section is empty.


View Source
var ErrNotSupportedSecret = errors.New("secret type is required")

ErrNotSupportedSecret an error which is occurred if the type of secreter is missing

View Source
var ErrSecretKeyMissing = errors.New("secret key is required")

ErrSecretKeyMissing an error which is occurred if the type of secret key for encrytpion is missing

View Source
var ErrVaultHostMissing = errors.New("vault host is required")

ErrVaultHostMissing an error which is occurred if the vault is enabled and the Vault host is missing

View Source
var ErrVaultTokenMissing = errors.New("vault token is required")

ErrVaultTokenMissing an error which is occurred if the vault is enabled and the Vault token is missing


This section is empty.


type Config

type Config struct {
	SecretType  SecretType
	SecretKey   string
	VaultConfig VaultConfig

Config config for secreter

type Decrypter

type Decrypter interface {
	Decrypt(opts Options) (string, error)

Decrypter allows decryption of secrets

type Options

type Options struct {
	// Used only for vault
	Key string

	// Plaintext used for encrypt
	Plaintext string

	// CipherText used for decrypt
	CipherText string

Options for encrypt/decrypt

type SecretType

type SecretType int

SecretType the type of the encryption secrets will be stored

const (
	// LocalSecret encryption with base64
	LocalSecret SecretType = iota
	// VaultSecret secrets with hashicorp Vault
	// DebugSecret secrets just plain

func (SecretType) String

func (s SecretType) String() string

type Secreter

type Secreter interface {
	Encrypt(opts Options) (string, error)
	Decrypt(opts Options) (string, error)
	Type() SecretType

Secreter contract for secret providers

func New

func New(ctx context.Context, cfg Config) (Secreter, error)

New factory method to get the proper secreter

type VaultConfig

type VaultConfig struct {
	Enabled bool
	Token   string
	Host    string

VaultConfig it is used in order to be able to interact with transit engine of vault. Token is the one which is needed in order to interact with Vault API

Jump to

Keyboard shortcuts

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