util

package
v0.0.0-...-8d76f9d Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SIGNUP = "signup"
	LOGIN  = "login"
)

Variables

This section is empty.

Functions

func GenerateOTP

func GenerateOTP() (int, error)

func HashThis

func HashThis(code int) (string, error)

HashThis returns the bcrypt hash of the code

func HashVerify

func HashVerify(code string, hashedCode string) error

HashVerify checks if the provided code is correct or not

func NormalizeEmail

func NormalizeEmail(email string) string

func ToNullString

func ToNullString(s string) sql.NullString

Types

type Config

type Config struct {
	DBDriver             string        `mapstructure:"DB_DRIVER"`
	DBSource             string        `mapstructure:"DB_SOURCE"`
	ServerAddress        string        `mapstructure:"SERVER_ADDRESS"`
	TwillioAccountSID    string        `mapstructure:"Twillio_Account_SID"`
	TwillioAuthToken     string        `mapstructure:"Twillio_Auth_Token"`
	TokenSymmetricKey    string        `mapstructure:"TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration  time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
	AuthTokenExpiry      time.Duration `mapstructure:"AUTH_TOKEN_EXPIRY"`
}

Config stores all configuration of the application. The values are read by viper from a config file or environment variable.

func LoadConfig

func LoadConfig(path string) (config Config, err error)

LoadConfig reads configuration from file or env variables

type PhoneDetails

type PhoneDetails struct {
	PhoneNumber      string
	Valid            bool
	ValidationErrors []string
}

func VerifyPhone

func VerifyPhone(phoneNumber, accountSid, authToken string) (PhoneDetails, error)

Jump to

Keyboard shortcuts

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