Documentation ¶
Overview ¶
Package vault provides support for accessing Hashicorp's vault service to access private keys.
Index ¶
- Variables
- type Config
- type SystemInitResponse
- type Vault
- func (v *Vault) AddPrivateKey(ctx context.Context, kid string, pem []byte) error
- func (v *Vault) CheckToken(ctx context.Context, token string) error
- func (v *Vault) CreatePolicy(ctx context.Context, name string, path string, capabilities []string) error
- func (v *Vault) CreateToken(ctx context.Context, id string, policies []string, displayName string) error
- func (v *Vault) Mount(ctx context.Context) error
- func (v *Vault) PrivateKey(ctx context.Context, kid string) (string, error)
- func (v *Vault) PublicKey(ctx context.Context, kid string) (string, error)
- func (v *Vault) SetToken(token string)
- func (v *Vault) SystemInit(ctx context.Context, shares int, threshold int) (SystemInitResponse, error)
- func (v *Vault) Unseal(ctx context.Context, key string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyInitialized = errors.New("already initialized") ErrBadRequest = errors.New("bad request") ErrPathInUse = errors.New("path in use") )
Error variables for this set of API calls.
Functions ¶
This section is empty.
Types ¶
type SystemInitResponse ¶
type SystemInitResponse struct { KeysB64 []string `json:"keys_base64"` RootToken string `json:"root_token"` }
SystemInitResponse represents the response from a system init call.
type Vault ¶
type Vault struct {
// contains filtered or unexported fields
}
Vault provides support to access Hashicorp's Vault product for keys.
func (*Vault) AddPrivateKey ¶
AddPrivateKey adds a new private key into vault as PEM encoded.
func (*Vault) CheckToken ¶
CheckToken validates the specified token exists.
func (*Vault) CreatePolicy ¶
func (v *Vault) CreatePolicy(ctx context.Context, name string, path string, capabilities []string) error
CreatePolicy defines a policy inside of Vault.
func (*Vault) CreateToken ¶
func (v *Vault) CreateToken(ctx context.Context, id string, policies []string, displayName string) error
CreateToken creates a new token in Vault.
func (*Vault) PrivateKey ¶
PrivateKey searches the key store for a given kid and returns the private key in pem format.
func (*Vault) PublicKey ¶
PublicKey searches the key store for a given kid and returns the public key in pem format.
func (*Vault) SystemInit ¶
func (v *Vault) SystemInit(ctx context.Context, shares int, threshold int) (SystemInitResponse, error)
SystemInit provides support to initialize a vault system for use.