vault

package
v0.0.0-...-3d4a1d9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyAlreadyExists = errors.New("key already exists")
View Source
var ErrNotFound = errors.New("key not found")

ErrNotFound indicates that the specified crypto storage entry couldn't be found.

Functions

This section is empty.

Types

type KVStorage

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

func (KVStorage) DeleteSecret

func (v KVStorage) DeleteSecret(key string) error

func (KVStorage) GetSecret

func (v KVStorage) GetSecret(key string) ([]byte, error)

func (KVStorage) ListKeys

func (v KVStorage) ListKeys() ([]string, error)

ListKeys returns a list of all keys in the vault storage for the given path.

func (KVStorage) Ping

func (v KVStorage) Ping() error

func (KVStorage) StoreSecret

func (v KVStorage) StoreSecret(key string, value []byte) error

type Storage

type Storage interface {
	// Ping checks if the server is available and the credentials are correct.
	Ping() error
	// GetSecret from the storage backend and return its value.
	GetSecret(key string) ([]byte, error)
	// StoreSecret stores the secret under the key in the storage backend.
	StoreSecret(key string, value []byte) error
	// DeleteSecret the key under the given key in the storage backend.
	DeleteSecret(key string) error
	// ListKeys returns a list of all keys in the storage backend.
	ListKeys() ([]string, error)
}

Storage interface containing functions for storing and retrieving keys.

func NewKVStore

func NewKVStore(pathPrefix string) (Storage, error)

NewKVStore creates a new Vault backend using the kv version 1 secret engine: https://www.vaultproject.io/docs/secrets/kv It currently only supports token authentication which should be provided by the token param. If config.Address is empty, the VAULT_ADDR environment should be set. If config.Token is empty, the VAULT_TOKEN environment should be is set.

Jump to

Keyboard shortcuts

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