client/tailscale/keys: fix client.Keys unmarshalling

Signed-off-by: Author Name hbowron@gmail.com
Signed-off-by: Harry Bowron <harry@bolt.com>

Fixes #7020
pull/7049/head
Harry Bowron 2 years ago committed by GitHub
parent 6e5faff51e
commit c1daa42c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,14 +55,14 @@ func (c *Client) Keys(ctx context.Context) ([]string, error) {
return nil, handleErrorResponse(b, resp) return nil, handleErrorResponse(b, resp)
} }
var keys []struct { var keys struct {
ID string `json:"id"` Keys []*Key `json:"keys"`
} }
if err := json.Unmarshal(b, &keys); err != nil { if err := json.Unmarshal(b, &keys); err != nil {
return nil, err return nil, err
} }
ret := make([]string, 0, len(keys)) ret := make([]string, 0, len(keys.Keys))
for _, k := range keys { for _, k := range keys.Keys {
ret = append(ret, k.ID) ret = append(ret, k.ID)
} }
return ret, nil return ret, nil

Loading…
Cancel
Save