wrapperr/models/methods.go
Aune 787b00aebc File restructure
Different components moved to packages which are imported. More proper and clean compared to previous implementation.
2022-11-29 12:43:01 +01:00

20 lines
398 B
Go

package models
import (
"errors"
"time"
)
// Different types of error returned by the VerifyToken function
var (
ErrInvalidToken = errors.New("token is invalid")
ErrExpiredToken = errors.New("token has expired")
)
// Valid checks if the token payload is valid or not
func (payload *Payload) Valid() error {
if time.Now().After(payload.ExpiredAt) {
return ErrExpiredToken
}
return nil
}