Yubikey client API library, validation protocol version 2.0.
Enables integration with the Yubico validation platform, so you can use Yubikey's one-time-password in your Rust application, allowing a user to authenticate via Yubikey.
Add this to your Cargo.toml
toml
[dependencies]
yubico = "0.2"
```rust extern crate yubico;
use yubico::Yubico; use yubico::config::*;
fn main() { let yubi = Yubico::new("CLIENTID", "APIKEY"); let result = yubi.verify("OTP", Config::default()); match result { Ok(answer) => println!("{}", answer), Err(e) => println!("Error: {}", e), } } ```
```rust extern crate yubico;
use yubico::Yubico; use yubico::config::*;
fn main() { let yubi = Yubico::new("CLIENTID", "APIKEY");
let config = Config::default().setapihosts(vec!["https://api.example.com/verify".into()]); let result = yubi.verify("OTP", config); match result { Ok(answer) => println!("{}", answer), Err(e) => println!("Error: {}", e), } } ```