exported API errors

This commit is contained in:
Grigoriy Mikhalkin 2022-07-29 17:35:21 +02:00
parent f9c4d577e2
commit 911e6ba6de
10 changed files with 57 additions and 57 deletions

View file

@ -14,7 +14,7 @@ const (
apiPrefixLength = 7
apiKeyLength = 32
errAPIKeyFailedToParse = Error("Failed to parse ApiKey")
ErrAPIKeyFailedToParse = Error("Failed to parse ApiKey")
)
// APIKey describes the datamodel for API keys used to remotely authenticate with
@ -116,7 +116,7 @@ func (h *Headscale) ExpireAPIKey(key *APIKey) error {
func (h *Headscale) ValidateAPIKey(keyStr string) (bool, error) {
prefix, hash, found := strings.Cut(keyStr, ".")
if !found {
return false, errAPIKeyFailedToParse
return false, ErrAPIKeyFailedToParse
}
key, err := h.GetAPIKey(prefix)