vault

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultConfigFile is the name of the default config file
	DefaultConfigFile = "vault-config.yml"
)

Variables

This section is empty.

Functions

func XORBase64

func XORBase64(a, b string) ([]byte, error)

XORBase64 takes two base64-encoded strings and XORs the decoded byte slices together, returning the final byte slice. It is an error to pass in two strings that do not have the same length to their base64-decoded byte slice.

func XORBytes

func XORBytes(a, b []byte) ([]byte, error)

XORBytes takes two byte slices and XORs them together, returning the final byte slice. It is an error to pass in two byte slices that do not have the same length.

Types

type Config

type Config struct {
	// how many key parts exist
	SecretShares int
	// how many of these parts are needed to unseal Vault (secretThreshold <= secretShares)
	SecretThreshold int

	// if this root token is set, the dynamic generated will be invalidated and this created instead
	InitRootToken string
	// should the root token be stored in the keyStore
	StoreRootToken bool

	// should the KV backend be tested first to validate access rights
	PreFlightChecks bool
}

Config holds the configuration of the Vault initialization

type KVService

type KVService interface {
	Set(key string, value []byte) error
	Get(key string) ([]byte, error)
}

type Vault

type Vault interface {
	Init() error
	RaftInitialized() (bool, error)
	RaftJoin(leaderAddress string) error
	Sealed() (bool, error)
	Active() (bool, error)
	Unseal() error
	Leader() (bool, error)
	LeaderAddress() (string, error)
	Configure(config map[string]interface{}) error
}

Vault is an interface that can be used to attempt to perform actions against a Vault server.

func New

func New(k KVService, cl *api.Client, config Config) (Vault, error)

New returns a new vault Vault, or an error.

Jump to

Keyboard shortcuts

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