@rivascva/dt-idl 1.1.109 → 1.1.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/go/auth/jwt.go CHANGED
@@ -26,7 +26,7 @@ func ValidateToken(token string, secret string) (*jwt.Token, ValidationError) {
26
26
  return nil, fmt.Errorf("failed to get the expiration time from the token: %w", err)
27
27
  }
28
28
  if expirationTime.Before(time.Now()) {
29
- return nil, fmt.Errorf("the token has expired: %w", ErrorExpiredToken)
29
+ return nil, ErrorExpiredToken
30
30
  }
31
31
 
32
32
  return parsedToken, nil
@@ -2,6 +2,7 @@ package middlewares
2
2
 
3
3
  import (
4
4
  "context"
5
+ "errors"
5
6
  "net/http"
6
7
  "slices"
7
8
  "strings"
@@ -37,6 +38,10 @@ func GetAuthMiddleware(accessTokenSecret string) func(http.Handler) http.Handler
37
38
 
38
39
  // validate the access token
39
40
  accessToken, err := auth.ValidateToken(arr[1], accessTokenSecret)
41
+ if errors.Is(err, auth.ErrorExpiredToken) {
42
+ write.ResponseWithError(r.Context(), w, http.StatusUnauthorized, "expired access token")
43
+ return
44
+ }
40
45
  if err != nil {
41
46
  write.ResponseWithError(r.Context(), w, http.StatusUnauthorized, "invalid access token")
42
47
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.109",
3
+ "version": "1.1.110",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",