Add support for "pgp-tokens" parameters to init.

There are thorough unit tests that read the returned
encrypted tokens, seal the vault, and unseal it
again to ensure all works as expected.
This commit is contained in:
Jeff Mitchell
2015-08-25 09:32:45 -07:00
parent 41ec36e2a3
commit d2023234b9
5 changed files with 528 additions and 6 deletions

View File

@@ -19,6 +19,10 @@ func (c *Sys) Init(opts *InitRequest) (*InitResponse, error) {
"secret_threshold": opts.SecretThreshold,
}
if len(opts.SecretPGPKeys) != 0 {
body["secret_pgp_keys"] = opts.SecretPGPKeys
}
r := c.c.NewRequest("PUT", "/v1/sys/init")
if err := r.SetJSONBody(body); err != nil {
return nil, err
@@ -38,6 +42,7 @@ func (c *Sys) Init(opts *InitRequest) (*InitResponse, error) {
type InitRequest struct {
SecretShares int
SecretThreshold int
SecretPGPKeys []string
}
type InitStatusResponse struct {