utils

package
v0.0.0-...-b9171e1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestingDomains []string = []string{"localhost"}

TODO USE CONFIG TO STORE Array

Functions

func BindBody

func BindBody(body map[string]interface{}, data interface{}) bool

INFO Should not use this utility low security

func CheckBoolAndReturnString

func CheckBoolAndReturnString(b bool, trueString string, falseString string) (bool, string)

func CreateChallenge

func CreateChallenge(publicKeyStr string) (string, models.Challenge, error)

func CreateVerification

func CreateVerification(entityId uuid.UUID, args ...interface{}) models.Verification

Args Type, UserID, Email

func EncodeToString

func EncodeToString(max int) string

func GenerateChallengeExpiryDate

func GenerateChallengeExpiryDate() time.Time

func GenerateCode

func GenerateCode() string

func GenerateToken

func GenerateToken(str string) string

func GenerateTokenExpiryDate

func GenerateTokenExpiryDate() time.Time

func GenerateVerificationExpiryDate

func GenerateVerificationExpiryDate() time.Time

func GenerateVerificationUrl

func GenerateVerificationUrl(id string, code string) (string, bool)

func GetEnv

func GetEnv(varNameString string, defaultValue string) string

func IsEmailDomainTesting

func IsEmailDomainTesting(email string) bool

func IsEmailValid

func IsEmailValid(email string) bool

func IsPublicKeyValid

func IsPublicKeyValid(publicKey string) bool

func IsTestingDomain

func IsTestingDomain(domain string) bool

func IsUUIDValid

func IsUUIDValid(u string) bool

func NewUUID

func NewUUID() uuid.UUID

func NewUUIDStr

func NewUUIDStr() string

func ParseAndSet

func ParseAndSet(c *gin.Context, args []models.Args, key string, defaultValue interface{})

func ParseArgs

func ParseArgs(args []models.Args, key string, defaultValue interface{}) interface{}

func PgErrorCodeAndMessage

func PgErrorCodeAndMessage(err error) (string, string)

func SendMailByElasticMail

func SendMailByElasticMail(toEmail, emailSubject, bodyHtml string) (bool, string)

TODO: To update

func SolveChallenge

func SolveChallenge(challenge models.Challenge) (string, bool)

func SolveChallengeString

func SolveChallengeString(str string) (string, bool)

func StrToUUID

func StrToUUID(s string) uuid.UUID

func TimeNowAfterDays

func TimeNowAfterDays(days int) time.Time

func UUIDToStr

func UUIDToStr(id uuid.UUID) string

func VerifySignature

func VerifySignature(publicKeyStr string, signatureStr string, message string) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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