Documentation
¶
Index ¶
- func IsValid(secret, code string, period uint, digits int, algorithm Algorithm) (bool, error)
- func NewHOTP(key []byte, counter int64, digits int, algorithm Algorithm) string
- func NewTOTP(secret string, period uint, digits int, algorithm Algorithm) (string, error)
- func Verify(secret, code string, period uint, digits int) (bool, error)
- type Algorithm
- type GoogleOTP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValid ¶
OTP Code Valid secret: base32 encoded secret key code: OTP code period: time period digits: number of digits algorithm: hash algorithm
func NewHOTP ¶
HOTP: An HMAC-Based One-Time Password Algorithm https://datatracker.ietf.org/doc/html/rfc4226 HOTP(K,C) = Truncate(HMAC-SHA-1(K,C))
func NewTOTP ¶
TOTP: Time-Based One-Time Password Algorithm https://datatracker.ietf.org/doc/html/rfc6238 TOTP(K,T) = HOTP(K,C)
Types ¶
type GoogleOTP ¶
type GoogleOTP struct {
Secret string
OtpAuthURL string
Digits int
Algorithm Algorithm
QrCodeURL string
}
Google One-Time Password
func NewGoogleOTP ¶
New One-time Password For Google Authenticator key: the seed of base32 encoded secret key issuer: the issuer of the account accountName: the name of the account digits: number of digits , default is 6
Click to show internal directories.
Click to hide internal directories.