aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golang-jwt/jwt/v5/errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/golang-jwt/jwt/v5/errors.go')
-rw-r--r--vendor/github.com/golang-jwt/jwt/v5/errors.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors.go b/vendor/github.com/golang-jwt/jwt/v5/errors.go
new file mode 100644
index 0000000..23bb616
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v5/errors.go
@@ -0,0 +1,49 @@
1package jwt
2
3import (
4 "errors"
5 "strings"
6)
7
8var (
9 ErrInvalidKey = errors.New("key is invalid")
10 ErrInvalidKeyType = errors.New("key is of invalid type")
11 ErrHashUnavailable = errors.New("the requested hash function is unavailable")
12 ErrTokenMalformed = errors.New("token is malformed")
13 ErrTokenUnverifiable = errors.New("token is unverifiable")
14 ErrTokenSignatureInvalid = errors.New("token signature is invalid")
15 ErrTokenRequiredClaimMissing = errors.New("token is missing required claim")
16 ErrTokenInvalidAudience = errors.New("token has invalid audience")
17 ErrTokenExpired = errors.New("token is expired")
18 ErrTokenUsedBeforeIssued = errors.New("token used before issued")
19 ErrTokenInvalidIssuer = errors.New("token has invalid issuer")
20 ErrTokenInvalidSubject = errors.New("token has invalid subject")
21 ErrTokenNotValidYet = errors.New("token is not valid yet")
22 ErrTokenInvalidId = errors.New("token has invalid id")
23 ErrTokenInvalidClaims = errors.New("token has invalid claims")
24 ErrInvalidType = errors.New("invalid type for claim")
25)
26
27// joinedError is an error type that works similar to what [errors.Join]
28// produces, with the exception that it has a nice error string; mainly its
29// error messages are concatenated using a comma, rather than a newline.
30type joinedError struct {
31 errs []error
32}
33
34func (je joinedError) Error() string {
35 msg := []string{}
36 for _, err := range je.errs {
37 msg = append(msg, err.Error())
38 }
39
40 return strings.Join(msg, ", ")
41}
42
43// joinErrors joins together multiple errors. Useful for scenarios where
44// multiple errors next to each other occur, e.g., in claims validation.
45func joinErrors(errs ...error) error {
46 return &joinedError{
47 errs: errs,
48 }
49}