Expand description
Yubico OTP verification library.
§Example
use yubico_otp::{client::Client, params::ApiCredentials, params::ValidationOption};
use std::process::ExitCode;
#[tokio::main]
async fn main() -> Result<ExitCode, Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let creds = ApiCredentials::from_base64_secret(
"your_client_id".into(),
"your_base64_secret_key",
)?;
let client = Client::new(&client, creds);
let opt = ValidationOption::default();
let (status, resp) = client
.verify(std::env::args().nth(1).expect("OTP missing"), &opt)
.await?;
eprintln!("Status: {:?}", status);
eprintln!("Response: {:?}", resp);
Ok(if status.is_ok() {
ExitCode::SUCCESS
} else {
ExitCode::FAILURE
})
}Modules§
- client
- Async verify client for Yubico OTP.
- modhex
- Modhex encoding/decoding.
- params
- Options and parameters for the verify request.
- response
- Response from the verify request.
Enums§
- Error
- Errors that can occur during the verify request.