mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 02:43:05 +00:00
Reword errSingleUseAuthKeyHasBeenUsed
This commit is contained in:
parent
dd1e425d02
commit
9a6ac6e3e6
2 changed files with 3 additions and 3 deletions
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
const errorAuthKeyNotFound = Error("AuthKey not found")
|
const errorAuthKeyNotFound = Error("AuthKey not found")
|
||||||
const errorAuthKeyExpired = Error("AuthKey expired")
|
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
|
// PreAuthKey describes a pre-authorization key usable in a particular namespace
|
||||||
type PreAuthKey struct {
|
type PreAuthKey struct {
|
||||||
|
@ -111,7 +111,7 @@ func (h *Headscale) checkKeyValidity(k string) (*PreAuthKey, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(machines) != 0 {
|
if len(machines) != 0 {
|
||||||
return nil, errorAuthKeyNotReusableAlreadyUsed
|
return nil, errSingleUseAuthKeyHasBeenUsed
|
||||||
}
|
}
|
||||||
|
|
||||||
// missing here validation on current usage
|
// missing here validation on current usage
|
||||||
|
|
|
@ -87,7 +87,7 @@ func (*Suite) TestAlreadyUsedKey(c *check.C) {
|
||||||
h.db.Save(&m)
|
h.db.Save(&m)
|
||||||
|
|
||||||
p, err := h.checkKeyValidity(pak.Key)
|
p, err := h.checkKeyValidity(pak.Key)
|
||||||
c.Assert(err, check.Equals, errorAuthKeyNotReusableAlreadyUsed)
|
c.Assert(err, check.Equals, errSingleUseAuthKeyHasBeenUsed)
|
||||||
c.Assert(p, check.IsNil)
|
c.Assert(p, check.IsNil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue