utils

package
v0.0.0-...-d8ec886 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(ttl time.Duration, payload interface{}, privateKey string) (string, error)

func Decode

func Decode(s string) (string, error)

func Encode

func Encode(s string) string

func HashPassword

func HashPassword(password string) (string, error)

func ParseTemplateDir

func ParseTemplateDir(dir string) (*template.Template, error)

func RandomEmail

func RandomEmail() string

RandomEmail generates a random email

func RandomInt

func RandomInt(min, max int64) int64

RandomInt generates a random integer between min and max

func RandomOwner

func RandomOwner() string

RandomOwner generates a random owner name

func RandomString

func RandomString(n int) string

RandomString generates a random string of length n

func SendEmail

func SendEmail(user *models.DBUserResponse, data *EmailData, templateName string, config config.Config) error

TODO -> another service

func ToDoc

func ToDoc(v interface{}) (doc *bson.D, err error)

func ValidateToken

func ValidateToken(token string, publicKey string) (interface{}, error)

func VerifyPassword

func VerifyPassword(hashedPassword string, candidatePassword string) error

Types

type EmailData

type EmailData struct {
	URL       string
	FirstName string
	Subject   string
}

Jump to

Keyboard shortcuts

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