vault

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(addr *url.URL) *Client

func (*Client) Health

func (c *Client) Health(ctx context.Context) (*http.Response, error)

func (*Client) Init

func (c *Client) Init(ctx context.Context, opts *InitRequest) (*InitResponse, error)

func (*Client) Unseal

func (c *Client) Unseal(ctx context.Context, opts *UnsealRequest) (*UnsealResponse, error)

type EncryptionBackend

type EncryptionBackend interface {
	Type() string
	Version() string
	Encrypt(ctx context.Context, plaintext string) (string, error)
	Decrypt(ctx context.Context, data string) (string, error)
}

type InitData

type InitData struct {
	EncryptionType    string
	EncryptionVersion string
	RootToken         string
	UnsealKeys        []string
}

type InitRequest

type InitRequest struct {
	SecretShares    int `json:"secret_shares"`
	SecretThreshold int `json:"secret_threshold"`
}

type InitResponse

type InitResponse struct {
	Keys       []string `json:"keys"`
	KeysBase64 []string `json:"keys_base64"`
	RootToken  string   `json:"root_token"`
}

type StorageBackend

type StorageBackend interface {
	WriteInitData(ctx context.Context, data *InitData) error
	ReadInitData(ctx context.Context) (*InitData, error)
}

type UnsealRequest

type UnsealRequest struct {
	Key string `json:"key"`
}

type UnsealResponse

type UnsealResponse struct {
	Sealed   bool `json:"sealed"`
	T        int  `json:"t"`
	N        int  `json:"n"`
	Progress int  `json:"progress"`
}

type VaultClient

type VaultClient interface {
	Health(ctx context.Context) (*http.Response, error)
	Init(ctx context.Context, opts *InitRequest) (*InitResponse, error)
	Unseal(ctx context.Context, opts *UnsealRequest) (*UnsealResponse, error)
}

type VaultInit

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

func NewVaultInit

func NewVaultInit(client VaultClient, encryption EncryptionBackend, storage StorageBackend, once bool, checkInterval time.Duration) *VaultInit

func (*VaultInit) Start

func (vi *VaultInit) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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