Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TOTPGenerate ¶
type TOTPGenerate struct {
// Name of the issuing Organization/Company/application.
Issuer string
// Name of the User's Account (eg, email address)
AccountName string
// Number of seconds a TOTP hash is valid for. Defaults to 30 seconds.
Period uint
// Size in size of the generated Secret. Defaults to 20 bytes.
SecretSize uint
// Secret to store. Defaults to a randomly generated secret of SecretSize. You should generally leave this empty.
// Secret []byte
// Digits to request. Defaults to 6.
Digits otp.Digits
// Algorithm to use for HMAC. Defaults to SHA1.
Algorithm otp.Algorithm
}
func (*TOTPGenerate) CreateSecretKey ¶
func (t *TOTPGenerate) CreateSecretKey() (*otp.Key, error)
create totp secret key
type TOTPValidate ¶
type TOTPValidate struct {
//OTP Generated by authenticator application
Token string
//secret key
Secret string
// Number of seconds a TOTP hash is valid for. Defaults to 30 seconds.
Period uint
// Periods before or after the current time to allow. Value of 1 allows up to Period
// of either side of the specified time. Defaults to 0 allowed skews. Values greater
// than 1 are likely sketchy.
Skew uint
// Digits to request. Defaults to 6.
Digits otp.Digits
// Algorithm to use for HMAC. Defaults to SHA1.
Algorithm otp.Algorithm
}
func (*TOTPValidate) ValidateTOTP ¶
func (v *TOTPValidate) ValidateTOTP() (bool, error)
validate totp code
Click to show internal directories.
Click to hide internal directories.