#totp #hotp #otp #authenticator


Out-of-box HOTP and TOTP client to generate one-time password

2 releases

0.1.1 Nov 12, 2023
0.1.0 Nov 12, 2023

#759 in Authentication

22 downloads per month

MIT license

149 lines


Crates.io Tests status docs.rs

This package is a library designed to provide out-of-box HOTP and TOTP clients to generate one-time passwords.


  • HOTP and TOTP implementations are based on RFC4226 and RFC6238
  • Built-in base32 secret decoding


cargo add otps

Getting started

use otps::TotpBuilder;

let mut totp_cleint = TotpBuilder::new()
  .expect("failed to initialize TOTP client");

let totp_code = totp_cleint.generate();

println!("TOTP: {}", totp_code); // 123456

For more examples and detailed usage, refer to the online documentation.


Contributions to this project are welcome and encouraged. If you encounter any bugs or issues, please open an issue on the GitHub repository. If you would like to contribute to the project, please fork the repository and submit a pull request.


This project is licensed under the MIT License. See the LICENSE file for more details.


~284K SLoC