refacto
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"time"
|
||||
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
@@ -36,11 +37,11 @@ type UserClaims struct {
|
||||
}
|
||||
|
||||
func (account Account) CreateToken(ttl time.Duration, key string) (token string, err error) {
|
||||
expires_at := jwt.NewNumericDate(time.Now().Add(ttl))
|
||||
expiresAt := jwt.NewNumericDate(time.Now().Add(ttl))
|
||||
claims := UserClaims{
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
Subject: account.ID,
|
||||
ExpiresAt: expires_at,
|
||||
ExpiresAt: expiresAt,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user