added shamir keys

This commit is contained in:
ston1th 2023-03-20 21:18:44 +01:00
commit be0f532628
14 changed files with 238 additions and 43 deletions

View file

@ -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
}