Documentation ¶
Index ¶
- Constants
- Variables
- func ComparePasswords(password string, hashedPassword string) error
- func HashPassword(password string) (string, error)
- func IsValidPassword(password string) bool
- func RandomAmount() int64
- func RandomCurrency() string
- func RandomEmail() string
- func RandomHex(n int) (string, error)
- func RandomInt(min, max int64) int64
- func RandomString(n int) string
- func RandomUsername() string
- type Config
Constants ¶
View Source
const MinPasswordLength = 8
Variables ¶
View Source
var PasswordValidationMessage = fmt.Sprintf("Password should be at least %d characters with at least 1 uppercase, 1 lowercase and 1 special character.", MinPasswordLength)
Functions ¶
func ComparePasswords ¶
ComparePasswords checks if the input password and hashed password are the same or not.
func HashPassword ¶
HashPassword turns input password string into a hash.
func IsValidPassword ¶
ValidatePassword checks if password is valid according to the requirements.
func RandomString ¶
RandomString generates a random string of n characters.
Types ¶
type Config ¶
type Config struct { DBDriver string `mapstructure:"DB_DRIVER"` DBSource string `mapstructure:"DB_SOURCE"` ServerAddress string `mapstructure:"SERVER_ADDRESS"` TokenSymmetricKey string `mapstructure:"TOKEN_SYMMETRIC_KEY"` AccessTokenDuration time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"` RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"` }
Config has all configurations of the application. Viper reads the values from a config file or from environment variables. https://github.com/spf13/viper
func LoadConfig ¶
LoadConfig reads configuration from a file or environment variables.
Click to show internal directories.
Click to hide internal directories.