otp_offline 0.2.0

Library for offline verification of YubiKey OTPs.
Documentation
use std::time::SystemTime;

mod modhex;
mod otp;
mod simple_store;
mod store;

fn main() {
    let mut store = simple_store::Store::create("test.txt").unwrap();

    // read in the input
    loop {
        let mut otp = String::new();
        _ = std::io::stdin().read_line(&mut otp);

        let otp = otp.trim();

        let now = SystemTime::now();

        let result = store.validate(otp);
        let elapsed = now.elapsed().unwrap();

        match result {
            Ok(()) => println!(">>VALID<<"),
            Err(err) => println!("{err}"),
        }

        println!("Took {}us", elapsed.as_micros());
    }
}