added shamir keys
This commit is contained in:
parent
13780f1c74
commit
be0f532628
14 changed files with 238 additions and 43 deletions
|
|
@ -83,14 +83,14 @@ func (c *Client) GetKey(ctx context.Context, id string) (key schema.Key, err err
|
|||
return
|
||||
}
|
||||
|
||||
func (c *Client) CreateKey(ctx context.Context, key schema.NewKey) (err error) {
|
||||
func (c *Client) CreateKey(ctx context.Context, newKey schema.NewKey) (key schema.Key, err error) {
|
||||
buf := new(bytes.Buffer)
|
||||
path := keyPath
|
||||
err = key.Validate()
|
||||
err = newKey.Validate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = json.NewEncoder(buf).Encode(key)
|
||||
err = json.NewEncoder(buf).Encode(newKey)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ func (c *Client) CreateKey(ctx context.Context, key schema.NewKey) (err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = c.c.Do(req, nil)
|
||||
_, err = c.c.Do(req, &key)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue