Documentation
¶
Overview ¶
Package hotp implements the HMAC-based One-Time Password (HOTP) algorithm. It provides functionalities to generate codes, validate passcodes, and generate new HOTP keys representing "otpauth" URLs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
Generate creates a new HOTP key containing a secret, issuer, and account name. The secret is either provided via the configuration options or securely generated using a cryptographic random number generator. It returns an *otp.Key, which can be formatted as an "otpauth://hotp/..." URL suitable for QR code generation.
func GenerateCode ¶
GenerateCode generates an HOTP passcode using the provided base32-encoded secret, a counter, and optional configurations. It supports multiple encoders, including the default numerical encoder and a Steam-specific alphanumeric encoder. It returns the generated passcode as a string, or an error if the secret is invalid.
Types ¶
This section is empty.