client/tailscale: revert CreateKey API change, add Client.CreateKeyWithExpiry

The client/tailscale is a stable-ish API we try not to break. Revert
the Client.CreateKey method as it was and add a new
CreateKeyWithExpiry method to do the new thing. And document the
expiry field and enforce that the time.Duration can't be between in
range greater than 0 and less than a second.

Updates #7143
Updates #8124 (reverts it, effectively)

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-05-12 18:50:30 -07:00
committed by Brad Fitzpatrick
parent 678bb92bb8
commit 4664318be2
5 changed files with 20 additions and 13 deletions
+1 -2
View File
@@ -1198,8 +1198,7 @@ func resolveAuthKey(ctx context.Context, v, tags string) (string, error) {
},
}
const defaultExpiry = 0
authkey, _, err := tsClient.CreateKey(ctx, caps, defaultExpiry)
authkey, _, err := tsClient.CreateKey(ctx, caps)
if err != nil {
return "", err
}