Initial not working attempt
This commit is contained in:
32
src/main.rs
32
src/main.rs
@ -1,3 +1,31 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use clap::Parser;
|
||||
|
||||
/// TOTP - One Time Password generator
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(author, version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// The secret to use
|
||||
#[clap(short, long)]
|
||||
secret: String,
|
||||
|
||||
/// Interval between two numbers generation
|
||||
#[clap(short, long, default_value_t = 30)]
|
||||
topt_step: u64,
|
||||
|
||||
/// Size of generated secret
|
||||
#[clap(short, long, default_value_t = 6)]
|
||||
len: u32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args: Args = Args::parse();
|
||||
|
||||
let number = libotp::totp(
|
||||
&args.secret.to_ascii_uppercase(),
|
||||
args.len,
|
||||
args.topt_step,
|
||||
0,
|
||||
);
|
||||
|
||||
println!("Secret len = {}", number.unwrap());
|
||||
}
|
||||
|
Reference in New Issue
Block a user