{"id":13513048,"url":"https://github.com/wisespace-io/yubico-rs","last_synced_at":"2025-04-06T00:10:40.425Z","repository":{"id":13916983,"uuid":"75007403","full_name":"wisespace-io/yubico-rs","owner":"wisespace-io","description":"Yubikey client API library, Challenge-Response \u0026 Configuration","archived":false,"fork":false,"pushed_at":"2024-04-03T19:25:40.000Z","size":127,"stargazers_count":53,"open_issues_count":1,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T23:09:44.752Z","etag":null,"topics":["authentication","otp","rust","yubico-otp","yubikey"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wisespace-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-28T19:34:05.000Z","updated_at":"2025-03-27T22:06:13.000Z","dependencies_parsed_at":"2024-01-13T22:15:31.972Z","dependency_job_id":"c30d4d83-094c-492c-bea0-5a2ab1db3f64","html_url":"https://github.com/wisespace-io/yubico-rs","commit_stats":{"total_commits":73,"total_committers":8,"mean_commits":9.125,"dds":0.4657534246575342,"last_synced_commit":"d927c95e993c497a12f3a663a07f4b3f7aab9d48"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisespace-io%2Fyubico-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisespace-io%2Fyubico-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisespace-io%2Fyubico-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisespace-io%2Fyubico-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wisespace-io","download_url":"https://codeload.github.com/wisespace-io/yubico-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415973,"owners_count":20935387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","otp","rust","yubico-otp","yubikey"],"created_at":"2024-08-01T04:00:36.986Z","updated_at":"2025-04-06T00:10:40.407Z","avatar_url":"https://github.com/wisespace-io.png","language":"Rust","funding_links":[],"categories":["Libraries / Clients"],"sub_categories":["Third-party Tools"],"readme":"# Yubico \u0026emsp; [![Build Status]][travis] [![Latest Version]][crates.io] [![MIT licensed]][MIT] [![Apache-2.0 licensed]][APACHE]\n\n[Build Status]: https://travis-ci.org/wisespace-io/yubico-rs.png?branch=master\n[travis]: https://travis-ci.org/wisespace-io/yubico-rs\n[Latest Version]: https://img.shields.io/crates/v/yubico.svg\n[crates.io]: https://crates.io/crates/yubico\n[MIT licensed]: https://img.shields.io/badge/License-MIT-blue.svg\n[MIT]: ./LICENSE-MIT\n[Apache-2.0 licensed]: https://img.shields.io/badge/License-Apache%202.0-blue.svg\n[APACHE]: ./LICENSE-APACHE\n\n**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.**\n\n---\n\n## Current features\n\n- [X] Synchronous Yubikey client API library, [validation protocol version 2.0](https://developers.yubico.com/yubikey-val/Validation_Protocol_V2.0.html).\n- [X] Asynchronous Yubikey client API library relying on [Tokio](https://github.com/tokio-rs/tokio)\n\n**Note:** The USB-related features have been moved to a sepatated repository, [yubico-manager](https://github.com/wisespace-io/yubico-manager)\n\n## Usage\n\nAdd this to your Cargo.toml\n\n```toml\n[dependencies]\nyubico = \"0.9\"\n```\n\nThe following are a list of Cargo features that can be enabled or disabled:\n\n- online-tokio (enabled by default): Provides integration to Tokio using futures.\n\nYou can enable or disable them using the example below:\n\n  ```toml\n  [dependencies.yubico]\n  version = \"0.9\"\n  # don't include the default features (online-tokio)\n  default-features = false\n  # cherry-pick individual features\n  features = []\n  ```\n\n[Request your api key](https://upgrade.yubico.com/getapikey/).\n\n### OTP with Default Servers\n\n```rust\nextern crate yubico;\n\nuse yubico::config::*;\nuse yubico::verify;\n\nfn main() {\n   let config = Config::default()\n       .set_client_id(\"CLIENT_ID\")\n       .set_key(\"API_KEY\");\n\n   match verify(\"OTP\", config) {\n      Ok(answer) =\u003e println!(\"{}\", answer),\n      Err(e) =\u003e println!(\"Error: {}\", e),\n   }\n}\n```\n\n## OTP with custom API servers\n\n```rust\nextern crate yubico;\n\nuse yubico::verify;\nuse yubico::config::*;\n\nfn main() {\n   let config = Config::default()\n       .set_client_id(\"CLIENT_ID\")\n       .set_key(\"API_KEY\")\n       .set_api_hosts(vec![\"https://api.example.com/verify\".into()]);\n\n   match verify(\"OTP\", config) {\n      Ok(answer) =\u003e println!(\"{}\", answer),\n      Err(e) =\u003e println!(\"Error: {}\", e),\n   }\n}\n```\n\n### Asynchronous OTP validation\n\n```rust\n#![recursion_limit=\"128\"]\nextern crate futures;\nextern crate tokio;\nextern crate yubico;\n\nuse futures::future::Future;\nuse yubico::verify_async;\nextern crate yubico;\n\nuse std::io::stdin;\nuse yubico::config::Config;\n\nfn main() {\n    println!(\"Please plug in a yubikey and enter an OTP\");\n\n    let client_id = std::env::var(\"YK_CLIENT_ID\")\n        .expect(\"Please set a value to the YK_CLIENT_ID environment variable.\");\n\n    let api_key = std::env::var(\"YK_API_KEY\")\n        .expect(\"Please set a value to the YK_API_KEY environment variable.\");\n\n    let otp = read_user_input();\n\n    let config = Config::default()\n        .set_client_id(client_id)\n        .set_key(api_key);\n\n    tokio::run(verify_async(otp, config)\n        .unwrap()\n        .map(|_|{\n            println!(\"Valid OTP.\");\n        })\n        .map_err(|err|{\n            println!(\"Invalid OTP. Cause: {:?}\", err);\n        }))\n}\n\nfn read_user_input() -\u003e String {\n    let mut buf = String::new();\n\n    stdin()\n        .read_line(\u0026mut buf)\n        .expect(\"Could not read user input.\");\n\n    buf\n}\n```\n\n## Docker\n\nFor convenience and reproducibility, a Docker image can be generated via the provided repo's Dockerfile.\n\nBuild:\n```bash\n$ docker build -t yubico-rs .\n...\nSuccessfully built 983cc040c78e                                                                           \nSuccessfully tagged yubico-rs:latest\n```\n\nRun:\n```bash\n$ docker run --rm -it -e YK_CLIENT_ID=XXXXX -e YK_API_KEY=XXXXXXXXXXXXXX yubico-rs:latest\nPlease plug in a yubikey and enter an OTP\nccccccXXXXXXXXXXXXXXXXXXXX\nThe OTP is valid.\n```\n\n## Changelog\n\n    - 0.10.0: Upgrade to `tokio` 1.1 and `reqwest` 0.11\n    - 0.9.2: (Yanked) Dependencies update\n    - 0.9.1: Set HTTP Proxy (Basic-auth is optional)\n    - 0.9.0: Moving to `tokio` 0.2 and `reqwest` 0.10\n    - 0.9.0-alpha.1: Moving to `futures` 0.3.0-alpha.19 \n    - 0.8: Rename the `sync` and `async` modules to `sync_verifier` and `async_verifier` to avoid the use of the `async` reserved keyword.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwisespace-io%2Fyubico-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwisespace-io%2Fyubico-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwisespace-io%2Fyubico-rs/lists"}