github.com/tommi2day/gomodules@v1.13.2-0.20240423190010-b7d55d252a27/pwlib/password_profiles.go (about)

     1  package pwlib
     2  
     3  const (
     4  	// UpperChar allowed charsets upper
     5  	UpperChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     6  	// LowerChar allowed charsets lower
     7  	LowerChar = "abcdefghijkmlnopqrstuvwxyz"
     8  	// Digits allowed charsets digits
     9  	Digits = "0123456789"
    10  	// SpecialChar allowed charsets special
    11  	SpecialChar = "!?()-_="
    12  	// AllChars allowed charsets combined
    13  	AllChars = UpperChar + LowerChar + Digits + SpecialChar
    14  )
    15  
    16  // PasswordCharset defines the allowed characters to choose
    17  type PasswordCharset struct {
    18  	// UpperChar allowed charsets upper
    19  	UpperChar string
    20  	// LowerChar allowed charsets lower
    21  	LowerChar string
    22  	// Digits allowed charsets digits
    23  	Digits string
    24  	// SpecialChar allowed charsets special
    25  	SpecialChar string
    26  	// AllChars allowed charsets combined
    27  	AllChars string
    28  }
    29  
    30  // PasswordProfile struct for password profile
    31  type PasswordProfile struct {
    32  	Length    int
    33  	Upper     int
    34  	Lower     int
    35  	Digits    int
    36  	Special   int
    37  	Firstchar bool
    38  }
    39  
    40  var charset = PasswordCharset{UpperChar, LowerChar, Digits, SpecialChar, UpperChar + LowerChar + Digits + SpecialChar}