This library supports the creation of 2FA authentification tokens per TOTP, the verification of said tokens, with configurable time skew, validity time of each token, algorithm and number of digits! Default features are kept as lightweight as possible to ensure small binaries and short compilation time.
Supports parsing otpauth URLs into a totp object, with sane default values.
Be aware that some authenticator apps will accept the
SHA512 algorithms but silently fallback to
SHA1 which will make the
check() function fail due to mismatched algorithms.
Derived from the totp-rs crate with a simpler API and fewer dependencies.
Securely zero secret information when the TOTP struct is dropped; this feature is enabled by default.
serde, enables serde support for the
Generate a token
use SystemTime; use ;