mutt

package module
v0.0.0-...-9333a66 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 B64ToByte

func B64ToByte(b string) ([]byte, error)

func ByteToB64

func ByteToB64(b []byte) string

func CheckParamString

func CheckParamString(fields ...string) bool

func Decrypt

func Decrypt(key, text []byte) ([]byte, error)

func Encrypt

func Encrypt(key, text []byte) ([]byte, error)

TODO: encryption needed

func NewRandom

func NewRandom() *random

==================================================================== NEW RANDOM

func PasswdCompare

func PasswdCompare(hashedPaswd []byte, plainPasswd []byte) error

func PasswdHash

func PasswdHash(pwd []byte) ([]byte, error)

func Random

func Random(length int) string

Random creates alphanumeric random string with length

func RandomInt

func RandomInt(min, max int) int

RandomInt will return int between min, max

func RandomInt64

func RandomInt64(min, max int64) int64

func RandomString

func RandomString(b []byte, length int) string

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"`
}

func NewUser

func NewUser(b []byte) (*User, error)

func (*User) Bytes

func (u *User) Bytes() ([]byte, error)

func (*User) Load

func (u *User) Load(d []byte) error

func (*User) Reset

func (u *User) Reset()

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

type UserEmail struct {
	Email      string        `json:"email"`
	Verified   bool          `json:"verified"`
	VerifiedOn atype.TimeInt `json:"verifiedOn"`
}

func (*UserEmail) Reset

func (u *UserEmail) Reset()

func (*UserEmail) Verify

func (u *UserEmail) Verify(verified bool)

type UserEvent

type UserEvent struct {
	Time    atype.TimeInt `json:"time"`
	Message string        `json:"message"`
}

type UserName

type UserName struct {
	DisplayName string `json:"disp"`
	FirstName   string `json:"fn"`
	LastName    string `json:"ln"`
}

func (*UserName) Reset

func (u *UserName) Reset()

func (*UserName) Set

func (u *UserName) Set(DispN, Fn, Ln string)

Jump to

Keyboard shortcuts

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