Documentation ¶
Index ¶
- Constants
- Variables
- func B64ToByte(b string) ([]byte, error)
- func ByteToB64(b []byte) string
- func CheckParamString(fields ...string) bool
- func Decrypt(key, text []byte) ([]byte, error)
- func Encrypt(key, text []byte) ([]byte, error)
- func NewRandom() *random
- func PasswdCompare(hashedPaswd []byte, plainPasswd []byte) error
- func PasswdHash(pwd []byte) ([]byte, error)
- func Random(length int) string
- func RandomInt(min, max int) int
- func RandomInt64(min, max int64) int64
- func RandomString(b []byte, length int) string
- func RandomUpdateSeed() bool
- type User
- type UserCredential
- type UserEmail
- type UserEvent
- type UserName
Constants ¶
View Source
const ( ALPHA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" NUMERIC = "0123456789" ALPHANUMERIC = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ALPHANUMERIC_LOWER = "abcdefghijklmnopqrstuvwxyz0123456789" ALPHANUMERIC_UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" HEX = "0123456789ABCDEF" )
Variables ¶
View Source
var (
ERR_ENC_CIPHER_SHORT = errors.New("encryption cipher too short")
)
Functions ¶
func CheckParamString ¶
func NewRandom ¶
func NewRandom() *random
==================================================================== NEW RANDOM
func PasswdCompare ¶
func PasswdHash ¶
func RandomInt64 ¶
func RandomString ¶
RandomString will take string and length and returns the randomized value within the string. This has better performance than current mathd.NewRand ...
func RandomUpdateSeed ¶
func RandomUpdateSeed() bool
UpdateSeed will update the seed, however be caucious when run in goroutine. Use UseMutex(true) to avoid possible panic.
Types ¶
type User ¶
type User struct { ID string `json:"id"` Credential UserCredential `json:"credential"` Name UserName `json:"name"` Email UserEmail `json:"email"` Enabled bool `json:"enabled"` Events []UserEvent `json:"events"` OtherTokens atype.MapStr `json:"otherTokens"` // OPTIONAL: user's token once logged in Groups atype.MapStr `json:"groups"` // OPTIONAL: user's token once logged in Created atype.TimeInt `json:"created"` LastModified atype.TimeInt `json:"lastModified"` LastLogin atype.TimeInt `json:"lastLogin"` }
type UserCredential ¶
type UserCredential struct { Passwd string `json:"passwd"` // hashed/encrypted user's password Token string `json:"token"` }
func (*UserCredential) NewToken ¶
func (c *UserCredential) NewToken()
func (*UserCredential) SetPasswd ¶
func (c *UserCredential) SetPasswd(pwd string) error
func (*UserCredential) VerifyPasswd ¶
func (c *UserCredential) VerifyPasswd(pwd string) error
type UserEmail ¶
Click to show internal directories.
Click to hide internal directories.