Skip to content

lbwa/otp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

otps

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.

Features

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

Installation

cargo add otps

Getting started

use otps::TotpBuilder;

let mut totp_cleint = TotpBuilder::new()
  .base32_secret("GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ")
  .build()
  .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

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.

License

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