JIJO recupere el codigo dsps que de claude nukee mi repo LETS GOOO

This commit is contained in:
fede committed 2026-05-11 23:08:14 -03:00
1 parent a35539590a
commit 6c1bc50089
24 files changed
+1260

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package jwtutils
import (
"repuestera_back/controllers/auth"
"github.com/golang-jwt/jwt/v5"
)
func ValidarJWT(tokenString string) (jwt.MapClaims, error) {
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, jwt.ErrSignatureInvalid
}
return auth.JWTSecret, nil
})
if err != nil {
return nil, err
}
claims, ok := token.Claims.(jwt.MapClaims)
if !ok || !token.Valid {
return nil, jwt.ErrSignatureInvalid
}
return claims, nil
}