A One-time Password Crate for Rust
Lugnut is still experimental and under construction.
Lugnut is a one-time password generator that supports specification compliant HOTP and TOTP generation and verification.
Add to Cargo.toml
toml
[dependencies]
lugnut = "0.1.0
```rust use lugnut::hotp::Hotp;
let key = String::from("SuperSecretKey"); let counter = 100;
let mut hotp = Hotp::new(key, counter); let code = hotp.generate().expect("error generating hotp"); let verified = hotp.verify(code).expect("error verifying hotp");
assert!(verified); ```
```rust use lugnut::totp::Totp;
let key = String::from("SuperSecretKey");
let mut totp = Totp::new(key); let code = totp.generate().expect("error generating totp"); let verified = totp.verify(code).expect("error verifying totp"); assert!(verified); ```
Contributors are always welcome! I would love new ideas and thoughts.
This project is licensed under the MIT License