mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-05 21:19:25 +09:00
db, api/v1: revoke rather than delete an ephemeral pre-auth key in use
The v1 list now hides revoked keys, so keys revoked through v2 also drop out of `headscale preauthkeys list`.
This commit is contained in:
1 parent
044b6b61fb
commit
f26853dc7f
5 files changed
+114
-5
No files matched your search
@@ -202,9 +202,14 @@ func registerPreAuthKeys(api huma.API, b Backend) {
|
||||
|
||||
out := &listPreAuthKeysOutput{}
|
||||
|
||||
out.Body.PreAuthKeys = make([]PreAuthKey, len(preAuthKeys))
|
||||
out.Body.PreAuthKeys = make([]PreAuthKey, 0, len(preAuthKeys))
|
||||
for i := range preAuthKeys {
|
||||
out.Body.PreAuthKeys[i] = preAuthKeyToResponse(&preAuthKeys[i])
|
||||
if preAuthKeys[i].Revoked == nil {
|
||||
out.Body.PreAuthKeys = append(
|
||||
out.Body.PreAuthKeys,
|
||||
preAuthKeyToResponse(&preAuthKeys[i]),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return out, nil
|
||||
|
||||
Reference in new issue
Block a user