server

package
v0.0.0-...-8c1ffaf Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenJWT

func GenJWT(usr struct {
	Rollno int
	Email  string
	Batch  string
	Role   string
}) (string, error)

Generate a JWT for a given user (rollno, batch, role)

func Respond

func Respond(w http.ResponseWriter, payload interface{}, statusCode int, args ...interface{})

func SendOTP

func SendOTP(emailid string, details interface{}, job string) (string, error)

SendOTP performs these functions 1) generate OTP, 2) save it along with other details in the database with an expiry time and, 3) the send it

func ValidateJWT

func ValidateJWT(r *http.Request) (int, jwt.MapClaims, error)

This authorizes a request (with a token) and returns the claims if successful else returns errors and a status code

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳