Documentation ¶
Index ¶
- Variables
- func CompareHashAndPassword(ctx context.Context, hash, password string) error
- func GenerateFromPassword(ctx context.Context, password string) (string, error)
- func GenerateOtp(digits int) (string, error)
- func GenerateTokenHash(emailOrPhone, otp string) string
- func SecureToken(options ...int) string
- type HashCost
Constants ¶
This section is empty.
Variables ¶
View Source
var PasswordHashCost = DefaultHashCost
PasswordHashCost is the current pasword hashing cost for all new hashes generated with GenerateHashFromPassword.
Functions ¶
func CompareHashAndPassword ¶
CompareHashAndPassword compares the hash and password, returns nil if equal otherwise an error. Context can be used to cancel the hashing if the algorithm supports it.
func GenerateFromPassword ¶
GenerateFromPassword generates a password hash from a password, using PasswordHashCost. Context can be used to cancel the hashing if the algorithm supports it.
func GenerateOtp ¶
GenerateOtp generates a random n digit otp
func GenerateTokenHash ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.