utils

package
v0.0.0-...-01f85aa Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const JavascriptISOString = "2006-01-02T15:04:05.999Z07:00"

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

Function checks the plaintext string and hash string and returns either true or false depending.

func ConnectDB

func ConnectDB(databaseHost, databasePort, databaseUser, databasePassword, databaseName, databaseSchemaName string) (*sql.DB, error)

func DumpRequest

func DumpRequest(writer io.Writer, header string, r *http.Request) error

func GenerateJWTTokenPair

func GenerateJWTTokenPair(hmacSecret []byte, uuid string, d time.Duration) (string, string, error)

GenerateJWTTokenPair Generate the `access token` and `refresh token` for the secret key.

func HashPassword

func HashPassword(password string) (string, error)

Function takes the plaintext string and returns a hash string.

func HashPasswordAlgorithm

func HashPasswordAlgorithm() string

Function returns the algorithm used for hashing.

func JavascriptISOStringToTime

func JavascriptISOStringToTime(s string) (time.Time, error)

JavascriptISOStringToTime is a utility function which will take a string formatted using the Javascript `toUTCString()` function and return a Golang time object.

func JsonPrettyPrint

func JsonPrettyPrint(in string) string

Code provided by https://stackoverflow.com/a/36544455

func ProcessJWTToken

func ProcessJWTToken(hmacSecret []byte, reqToken string) (string, error)

ProcessJWTToken validates either the `access token` or `refresh token` and returns either the `uuid` if success or error on failure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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