utils

package
v0.0.0-...-9a2df54 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to the bool value b

func ComparePasswordAndHash

func ComparePasswordAndHash(password, hash string) bool

ComparePasswordAndHash compares a given password to its bcrypt hash

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes a password to bycrypt

func IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to the int value i

func IsBurnerEmail

func IsBurnerEmail(val string) bool

IsBurnerEmail checks if an email is a burner email or not

func IsE164PhoneNumber

func IsE164PhoneNumber(val string) bool

IsE164PhoneNumber validates a number in the E164 Format

func PasswordValidate

func PasswordValidate(pass string, pwdLen int) bool

PasswordValidate: validates plain password against the rules defined below.

upp: at least one upper case letter. low: at least one lower case letter. num: at least one digit. sym: at least one special character. tot: at least theRequired passwordLength as passed in arguement. No empty string or whitespace.

func RandomID

func RandomID(strSize int, randType ...RandType) string

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to the string value s

Types

type RandType

type RandType string
const (
	RandTypeAlphaNum             RandType = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	RandTypeAlphaNumNoSimilarity RandType = "2346789abcdefghijkmnpqrtwxyzABCDEFGHJKLMNPQRTUVWXYZ"
	RandTypeAlpha                RandType = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	RandTypeNumber               RandType = "0123456789"
)

func (RandType) IsValid

func (rt RandType) IsValid() bool

func (RandType) String

func (rt RandType) String() string

Jump to

Keyboard shortcuts

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