utils

package
v0.0.0-...-0ca10ff Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CIPHER_KEY = "w!z%C*F)J@NcRfUjXn2r5u8x/A?D(G+K"

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encrypted string) (string, error)

https://gist.github.com/brettscott/2ac58ab7cb1c66e2b4a32d6c1c3908a7 Decrypt decrypts cipher text string into plain text string

func Encrypt

func Encrypt(unencrypted string) (string, error)

Encrypt encrypts plain text string into cipher text string

func GenerateSign

func GenerateSign(data interface{}) string

func HashPassword

func HashPassword(password string) (hash, salt, algorithm string, err error)

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, message string)

func RespondWithSuccess

func RespondWithSuccess(w http.ResponseWriter, code int, data interface{})

func TokenGenerator

func TokenGenerator(userId string, email string, tokenType string) (tokenString string, err error)

generate tokens

Types

type Response

type Response struct {
	Status  string      `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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