utils

package
v0.0.0-...-66bd6c2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

github.com/bartmika/mulberry-server/pkg/utils/jwt.go

github.com/bartmika/mulberry-server/pkg/utils/password.go

Index

Constants

This section is empty.

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 string) (*sql.DB, error)

func GenerateJWTTokenPair

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

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 JsonPrettyPrint

func JsonPrettyPrint(in string) string

Utility function nicely prints string data of JSON formatted contents. SOURCE: https://stackoverflow.com/a/36544455

func ProcessJWTToken

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

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