lugnut

Crates.iolugnut
lib.rslugnut
version0.0.5
sourcesrc
created_at2021-04-13 19:06:22.833815
updated_at2021-05-23 15:42:00.31158
descriptionAn OTP Generator for Rust
homepagehttps://github.com/JayHelton/lugnut
repository
max_upload_size
id383081
size22,894
Jarrett Helton (JayHelton)

documentation

https://github.com/JayHelton/lugnut

README

Lugnut

A One-time Password Crate for Rust

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.

Examples

Add to Cargo.toml

[dependencies]
lugnut = "0.1.0

HOTP

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);

TOTP

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);

Upcoming for Lugnut

  • Better Test Coverage
  • Support for OTP Auth Url generation
  • Support for forward and backward window configuration for TOTP (currently only support one value that is used for both



License

This project is licensed under the MIT License
Commit count: 0

cargo fmt