fix(service,token): incorrect algorithm being used to parse

This commit is contained in:
Guz
2025-06-16 07:08:46 -03:00
parent efd7867d61
commit 492bbfd653

View File

@@ -87,9 +87,9 @@ func (svc *Token) Issue(user model.User) (string, error) { // TODO: Return a ref
func (svc Token) Parse(tokenStr string) (*jwt.Token, error) {
svc.assert.NotNil(svc.publicKey)
token, err := jwt.Parse(tokenStr, func(t *jwt.Token) (interface{}, error) {
token, err := jwt.Parse(tokenStr, func(t *jwt.Token) (any, error) {
return svc.publicKey, nil
}, jwt.WithValidMethods([]string{jwt.SigningMethodES256.Alg()}))
}, jwt.WithValidMethods([]string{(&jwt.SigningMethodEd25519{}).Alg()}))
if err != nil {
return nil, errors.Join(errors.New("service: invalid token"), err)
}