From 9a6ac6e3e6dc610293670c68429c8361de195978 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Wed, 13 Oct 2021 23:23:07 +0200 Subject: [PATCH] Reword errSingleUseAuthKeyHasBeenUsed --- preauth_keys.go | 4 ++-- preauth_keys_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/preauth_keys.go b/preauth_keys.go index cc849fc..ed83253 100644 --- a/preauth_keys.go +++ b/preauth_keys.go @@ -11,7 +11,7 @@ import ( const errorAuthKeyNotFound = Error("AuthKey not found") const errorAuthKeyExpired = Error("AuthKey expired") -const errorAuthKeyNotReusableAlreadyUsed = Error("AuthKey not reusable already used") +const errSingleUseAuthKeyHasBeenUsed = Error("AuthKey has already been used") // PreAuthKey describes a pre-authorization key usable in a particular namespace type PreAuthKey struct { @@ -111,7 +111,7 @@ func (h *Headscale) checkKeyValidity(k string) (*PreAuthKey, error) { } if len(machines) != 0 { - return nil, errorAuthKeyNotReusableAlreadyUsed + return nil, errSingleUseAuthKeyHasBeenUsed } // missing here validation on current usage diff --git a/preauth_keys_test.go b/preauth_keys_test.go index 37f2e4d..53616bb 100644 --- a/preauth_keys_test.go +++ b/preauth_keys_test.go @@ -87,7 +87,7 @@ func (*Suite) TestAlreadyUsedKey(c *check.C) { h.db.Save(&m) p, err := h.checkKeyValidity(pak.Key) - c.Assert(err, check.Equals, errorAuthKeyNotReusableAlreadyUsed) + c.Assert(err, check.Equals, errSingleUseAuthKeyHasBeenUsed) c.Assert(p, check.IsNil) }