fix(service,token): incorrect algorithm being used to parse
This commit is contained in:
@@ -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) {
|
func (svc Token) Parse(tokenStr string) (*jwt.Token, error) {
|
||||||
svc.assert.NotNil(svc.publicKey)
|
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
|
return svc.publicKey, nil
|
||||||
}, jwt.WithValidMethods([]string{jwt.SigningMethodES256.Alg()}))
|
}, jwt.WithValidMethods([]string{(&jwt.SigningMethodEd25519{}).Alg()}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Join(errors.New("service: invalid token"), err)
|
return nil, errors.Join(errors.New("service: invalid token"), err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user