Documentation
¶
Index ¶
- Constants
- Variables
- func ContainsKeyboardSequence(password string) error
- func IsKeyboardSequence(password, sequence string) bool
- func IsValidBirthday(dob string) error
- func IsValidEmail(email string) error
- func IsValidName(name string) error
- func IsValidPassword(password string) error
- func IsValidServiceName(service string) bool
- func IsValidUuid(uuid string) bool
- func MatchesRegex(s, pattern string) bool
- func RepeatChar(password string) error
- func TooLong(field interface{}, max int) bool
- func TooShort(field interface{}, min int) bool
Constants ¶
View Source
const ( EmailRegex string = `^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,7}$` EmailMax int = 254 EmailMin int = 6 // min length is 3, tho domain rules make them longer: 6 NameMin int = 1 NameMax int = 32 NameRegex string = `^[\p{L}\p{M}'\-\s]+$` PasswordMin int = 16 PasswordMax int = 64 UpperCase string = `[A-Z]` LowerCase string = `[a-z]` Number string = `[0-9]` SpecialChar string = `[\@\!\#\$\%\^\&\*\(\)\_\+\{\}\:\;\"\'<>\,\.\?\/\|\\\=\-\[\]\~]` KeyboardSequenceMax int = 5 RepeatCharMax int = 4 // allowing 4 for true randomness and ggGg scenarios UuidPattern string = `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$` ServiceNameMin int = 2 ServiceNameMax int = 32 ServiceNameRegex string = `^[a-z0-9_-]+$` )
Variables ¶
View Source
var KeyboardSequences = []string{"`1234567890-=", `~!@#$\%^&*()_+`, "qwertyuiop[]\\", "qwertyuiop{}|", "asdfghjkl;'", "asdfghjkl:\"", "zxcvbnm,./", "zxcvbnm<>?", "1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik,9ol.0p;/-['=]", "!qaz@wsx#edc$rfv%tgb^yhn&ujm*ik,(ol.)p:?_{\"+}", "=[;.-pl,0okm9ijn8uhb7ygv6tfc5rdx4esz3wa2q1]", `}"?+{:>_pl<)okm(ijn*uhb&ygv^tfc\%rdx$esz#wa@q!`, "abcdefghijklmnopqrstuvwxyz"}
includes alphabet
Functions ¶
func IsKeyboardSequence ¶
includes reverse of any sequence
func IsValidBirthday ¶ added in v0.0.15
does not handle empty string, aka a required field, only checks format
func IsValidEmail ¶ added in v0.0.15
func IsValidName ¶ added in v0.0.15
func IsValidPassword ¶ added in v0.0.15
func IsValidServiceName ¶ added in v0.0.40
func IsValidUuid ¶
func MatchesRegex ¶
func RepeatChar ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.