Crates.io | authenticator-rs |
lib.rs | authenticator-rs |
version | 0.2.0 |
source | src |
created_at | 2021-12-14 01:26:40.732357 |
updated_at | 2021-12-14 04:42:04.677161 |
description | The rust implementation for google authenticator with 2fa authentication |
homepage | https://github.com/CrayfishGo/authenticator-rs.git |
repository | |
max_upload_size | |
id | 497512 |
size | 9,917 |
The rust implementation for google authenticator with 2FA authentication
Add this to your Cargo.toml
:
[dependencies]
authenticator-rs = "0.2.0"
use crate::authenticator;
fn main(){
let secret = authenticator::create_secret(32); // create a random secret
let pin_code_rs = authenticator::current_pin_code(secret.as_str(), 6);
match pin_code_rs {
Ok(code) => { println!("Current Pin Code: {}", code) }
Err(e) => { println!("Something has error: {}", e) }
}
}