auth

package
v0.0.0-...-3edba42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 3 Imported by: 0

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.StandardClaims
}

JwtClaim holds Email of the user along with jwt.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 in minutes the JWT token will be valid for
}

JwtWrapper wraps the signing key, issuer and expiration time

func (*JwtWrapper) GenerateToken

func (j *JwtWrapper) GenerateToken(email string) (signedToken string, err error)

Generates a JWT token based on the provided email

func (*JwtWrapper) ValidateToken

func (j *JwtWrapper) ValidateToken(signedToken string) (claims *JwtClaim, err error)

Validates the JWT token and returns its claims

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL