Skip to content

Commit

Permalink
Reword errSingleUseAuthKeyHasBeenUsed
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfont committed Oct 13, 2021
1 parent dd1e425 commit 9a6ac6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions preauth_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion preauth_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 9a6ac6e

Please sign in to comment.