utils

package
v0.0.0-...-fa3a857 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Source code taken from: https://stackoverflow.com/a/22892986

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 Contains

func Contains(s []string, str string) bool

Checks if a string is present in a slice

func GenerateJWTTokenPair

func GenerateJWTTokenPair(hmacSecret []byte, sessionUuid 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 NewRandomString

func NewRandomString(n int) string

func ProcessBearerToken

func ProcessBearerToken(hmacSecret []byte, tokenString 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