Documentation
¶
Overview ¶
Package otpgen implements functions to generate TOTP/HOTP codes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HOTP ¶
type HOTP struct {
Secret string // Secret key (required)
Digits int //OTP digit count (default: 6)
Counter int64 // Counter value (default: 0)
}
HOTP represents HMAC-Based One-Time Password Algorithm See https://datatracker.ietf.org/doc/html/rfc4226
type TOTP ¶
type TOTP struct {
Secret string // Secret key (required)
Digits int // OTP digit count (default: 6)
Algorithm string // OTP Algorithm ("SHA1" or "SHA256" or "SHA512")
Period int64 // Period for which OTP is valid (seconds) (default: 30)
UnixTime int64 // (Optional) Unix Timestamp (default: Current unix timestamp)
}
TOTP represents Time-based OTP. See https://datatracker.ietf.org/doc/html/rfc6238
Click to show internal directories.
Click to hide internal directories.