lugnut 0.0.4

An OTP Generator for Rust
Documentation

MIT/Apache-2 licensed

Lugnut is still experimental and under construction.

Lugnut is a one-time password generator that supports specification compliant HOTP and TOTP generation and verification.

[dependencies]
lugnut = "0.1.0
use lugnut::hotp::Hotp;

let key = String::from("SuperSecretKey");
let counter = 100;

let mut hotp = Hotp::new();
let code = hotp.generate(key, counter).expect("error generating hotp");
let verified = hotp.verify(code, key, counter).expect("error verifying hotp");

assert!(verified);
use lugnut::totp::Totp;

let key = String::from("SuperSecretKey");

let mut totp = Totp::new();
let code = totp.generate(key).expect("error generating totp");
let verified = totp.verify(code, key).expect("error verifying totp");
assert!(verified);