Documentation ¶
Index ¶
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(n int) (string, error)
- func GenerateRandomStringURLSafe(n int) (string, error)
- func ValidatePassword(locksmithPassword PasswordInfo, inputPassword string) (bool, error)
- type PasswordInfo
- type PasswordSession
- type PasswordSessions
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomStringURLSafe ¶
GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func ValidatePassword ¶
func ValidatePassword(locksmithPassword PasswordInfo, inputPassword string) (bool, error)
Types ¶
type PasswordInfo ¶
type PasswordInfo struct { Password string `json:"password" bson:"password"` Salt string `json:"salt" bson:"salt"` WebAuthnCredentials []webauthn.Credential `json:"webauthn" bson:"webauthn"` }
func CompileLocksmithPassword ¶
func CompileLocksmithPassword(password string, saltString ...string) (PasswordInfo, error)
func PasswordInfoFromMap ¶
func PasswordInfoFromMap(passinfo map[string]interface{}) PasswordInfo
func (PasswordInfo) ToMap ¶ added in v0.3.0
func (p PasswordInfo) ToMap() map[string]interface{}
type PasswordSession ¶
type PasswordSession struct { Token string `json:"token" bson:"token"` ExpiresAt int64 `json:"expire" bson:"expire"` }
func PasswordSessionFromJson ¶
func PasswordSessionFromJson(data string) (PasswordSession, error)
func (PasswordSession) FromMap ¶ added in v0.3.0
func (p PasswordSession) FromMap(input map[string]interface{}) PasswordSession
func (PasswordSession) IsExpired ¶
func (p PasswordSession) IsExpired() bool
func (PasswordSession) Marshal ¶
func (p PasswordSession) Marshal() ([]byte, error)
func (PasswordSession) ToMap ¶ added in v0.3.0
func (p PasswordSession) ToMap() map[string]interface{}
type PasswordSessions ¶ added in v0.3.0
type PasswordSessions []PasswordSession
func (PasswordSessions) FromMap ¶ added in v0.3.0
func (p PasswordSessions) FromMap(input []map[string]interface{}) []PasswordSession
func (PasswordSessions) ToMap ¶ added in v0.3.0
func (p PasswordSessions) ToMap() []map[string]interface{}