Documentation ¶
Overview ¶
Package provides an implementation to generate one-time password values based on the TOTP (Time-Based One-Time Password) and HOTP (HMAC-Based One-Time Password) algorithms as defined into the RFC4226 and RFC6238 specifications
Index ¶
- Constants
- func HOTP(h func() hash.Hash, key []byte, count uint64, digits int) (string, error)
- func TOTP(h func() hash.Hash, key []byte, t time.Time, interval int, digits int) (string, error)
- func TOTPFromBase32(h func() hash.Hash, decodedKey string, t time.Time, interval int, digits int) (string, error)
Constants ¶
View Source
const ( DefaultInterval = 30 DefaultDigits = 6 )
Variables ¶
This section is empty.
Functions ¶
func HOTP ¶
HOTP generates an HOTP (HMAC-Based One-Time Password) value as defined into the RFC4226 Note: if the hash function is nil, defaults to SHA1 Reference: https://datatracker.ietf.org/doc/html/rfc4226
func TOTP ¶
TOTP generates a TOTP (Time-Based One-Time Password) value as defined into the RFC6238 Note: if the hash function is nil, defaults to SHA1 Reference: https://datatracker.ietf.org/doc/html/rfc6238
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.