util

package
v0.0.0-...-9d4902c Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MySecret string = "fir&1*~#^2^#s0^=)_^7%b34"

This should be in an env file in production

Variables

This section is empty.

Functions

func Decode

func Decode(s string) []byte

func DecodeMD5

func DecodeMD5(s string) string

func DecryptAES

func DecryptAES(text string) (string, error)

Decrypt method is to extract back the encrypted text

func Descrypt

func Descrypt(hashedPwd string, plainPwd []byte) bool

func Encode

func Encode(b []byte) string

func EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 md5 encryption

func Encript

func Encript(pwd []byte) string

func EncryptAES

func EncryptAES(text string) (string, error)

Encrypt method is to encrypt or hide any classified text

func GenerateToken

func GenerateToken(username, password string, remember bool) (string, error)

GenerateToken generate tokens used for auth

func GetPage

func GetPage(c *gin.Context) int

GetPage get page parameters

func GetPwd

func GetPwd() []byte

func Message

func Message(status bool, message string) map[string]interface{}

func Respond

func Respond(w http.ResponseWriter, data map[string]interface{})

func Setup

func Setup()

Setup Initialize the util

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

ParseToken parsing token

Jump to

Keyboard shortcuts

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