utils

package
v0.0.0-...-af438c1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func FirstN

func FirstN(s string, n int) string

@utils Return first n chars of a string https://stackoverflow.com/a/41604514/17126147

func GenerateGavatarUrl

func GenerateGavatarUrl(email string) string

func GenerateHashSecret

func GenerateHashSecret(secret, token string) (string, error)

func GenerateJWT

func GenerateJWT(user user.User) (string, int64, error)

func GenerateSlug

func GenerateSlug(title string) string

generate a unique slug for a post @TODO do more validations and checking

func HashPassword

func HashPassword(password string) (string, error)

func IsEmailValid

func IsEmailValid(e string) bool

func IsInternalMail

func IsInternalMail(email string) bool

func LogFatal

func LogFatal(fields interface{})

func LogInfo

func LogInfo(fields interface{})

func LogWarn

func LogWarn(fields interface{})

func SendEmailWithToken

func SendEmailWithToken(email, url string) (error, bool)

func SendRefreshToken

func SendRefreshToken(user user.User) (string, int64, error)

func ValidateHash

func ValidateHash(value, hash string) bool

func ValidateRefreshToken

func ValidateRefreshToken(tokenString string) (interface{}, interface{}, interface{}, error)

func VerifyToken

func VerifyToken(tokenString string) (user.User, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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