Documentation ¶
Index ¶
- Variables
- func CompareHashAndPassword(hashData string, password []byte) error
- func GenerateHash(c ArgonConfig, password []byte, randSrc io.Reader) (string, error)
- func GenerateOTPPassword(secret string) (string, error)
- func NewOTP() (string, string)
- func ValidateOTP(logger *zap.Logger, secret string, pass string) bool
- type ArgonConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPasswordConfig = ArgonConfig{
Time: argonTime,
Memory: argonMemory,
Threads: argonThreads,
KeyLen: argonKeyLen,
}
View Source
var (
ErrMismatchedHashAndPassword = errors.New("ponc/authentication: hashedPassword is not the hash of the given password")
)
View Source
var OTPOpts = totp.ValidateOpts{ Period: otpPeriod, Skew: otpSkew, Digits: otpDigits, Algorithm: otp.AlgorithmSHA256, }
Functions ¶
func CompareHashAndPassword ¶
CompareHashAndPassword is used to compare a user-inputted password to a hash to see if the password matches.
func GenerateHash ¶
GenerateHash is used to generate a new password hash for storing and comparing at a later date. randSrc should be nil for normal use and set to a math/rand.Reader for testing.
func GenerateOTPPassword ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.