Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JwtClaim ¶
type JwtClaim struct { Email string jwt.RegisteredClaims }
JwtClaim adds email as a claim to the token JwtClaim is a struct that holds the Email of the user, as well as the StandardClaims
type JwtWrapper ¶
type JwtWrapper struct { SecretKey string // key used for signing the JWT token Issuer string // Issuer of the JWT token ExpirationMinutes int64 // Number of minutes the JWT token will be valid fot ExpirationHours int64 // Expiration time of the JWT token in hours }
JwtWrapper wraps the signing key and the issuer JwtWrapper is a struct that holds the secret key, issuer and expiration time for a JWT token
func (*JwtWrapper) GenerateToken ¶
func (j *JwtWrapper) GenerateToken(email string) (signedToken string, err error)
GenerateToken generates a JWT token GenerateToken takes an email as an argument and returns a signed JWT token and an error
func (*JwtWrapper) RefreshToken ¶
func (j *JwtWrapper) RefreshToken(email string) (signedtoken string, err error)
RefreshToken generates a refresh jwt token RefreshToken takes an email as an argument and returns a signed JWT token and an error
func (*JwtWrapper) ValidateToken ¶
func (j *JwtWrapper) ValidateToken(signedToken string) (claims *JwtClaim, err error)
ValidateToken validates the JWT token ValidateToken takes a signed JWT token as an argument and returns the JwtClaim and an error