Documentation ¶
Index ¶
Constants ¶
View Source
const ( CodeLength4 = 4 CodeLength6 = 6 )
legnth of code for otp
View Source
const ( ThresholdOTPResend int = 3 ThresholdOTPValidate int = 10 )
list of otp threshold
View Source
const ( OTPKeyExpiry = time.Hour * 24 // expire time for otp ExpiryTimeDefault = time.Minute * 4 // the default time for expiring otp is 90 seconds ResendTimeDefault = time.Second * 90 ResendTimeAfterThreshold = time.Minute * 30 // the maximum time for otp exiry is 1 day ResendTimeMax = time.Hour * 24 )
list of expiry time
Variables ¶
View Source
var ( ErrCodeLengthInvalid = errors.New("otp: code length is invalid") ErrOTPInvalid = errors.New("otp: password invalid") ErrOTPExpired = errors.New("otp: otp already expired") ErrOTPReachResendMaxAttempt = errors.New("otp: reach maximum resend attempt") ErrOTPReachValidateMaxAttempt = errors.New("otp: reach maximum validate attempt, too many wrong password") ErrOTPNotResendable = errors.New("otp: not resendable") )
list of otp errors
Functions ¶
This section is empty.
Types ¶
type OTP ¶
type OTP struct { UniqueID string `json:"unique_id"` Action authentity.Action `json:"action"` Code string `json:"code"` CreatedAt time.Time `json:"created_at"` ExpiryTime time.Duration `json:"expiry_time"` ExpiredAt time.Time `json:"expired_at"` ResendTime time.Duration `json:"resend_time"` ResendableAt time.Time `json:"resendable_at"` }
OTP struct
func (OTP) IsResendable ¶
IsResendable return whether otp is resendable or not
Click to show internal directories.
Click to hide internal directories.