{"id":17117084,"url":"https://github.com/enygma/yubikey","last_synced_at":"2025-04-04T22:06:20.770Z","repository":{"id":7204488,"uuid":"8509498","full_name":"enygma/yubikey","owner":"enygma","description":"PHP library to interface with the Yubikey REST API","archived":false,"fork":false,"pushed_at":"2024-06-05T14:16:00.000Z","size":74,"stargazers_count":76,"open_issues_count":11,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-30T08:18:14.279Z","etag":null,"topics":["php","security","token","yubikey"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"apache/hive","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enygma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2013-03-01T20:18:02.000Z","updated_at":"2024-08-07T12:39:22.000Z","dependencies_parsed_at":"2023-11-29T17:47:32.488Z","dependency_job_id":"19d6e1a8-5f01-4441-bd11-257011bba398","html_url":"https://github.com/enygma/yubikey","commit_stats":{"total_commits":80,"total_committers":10,"mean_commits":8.0,"dds":"0.42500000000000004","last_synced_commit":"bc0a30da2b20fe4cdb75d04714050f52c2ddde9a"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enygma%2Fyubikey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enygma%2Fyubikey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enygma%2Fyubikey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enygma%2Fyubikey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enygma","download_url":"https://codeload.github.com/enygma/yubikey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256112,"owners_count":20909240,"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":["php","security","token","yubikey"],"created_at":"2024-10-14T17:50:34.078Z","updated_at":"2025-04-04T22:06:20.747Z","avatar_url":"https://github.com/enygma.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Yubikey PHP Library\n=======================\n\n[![Travis-CI Build Status](https://secure.travis-ci.org/enygma/yubikey.png?branch=master)](http://travis-ci.org/enygma/yubikey)\n[![Codacy Badge](https://www.codacy.com/project/badge/6b73c56a21734a6d93dae6019f733c5e)](https://www.codacy.com)\n[![Code Climate](https://codeclimate.com/github/enygma/yubikey/badges/gpa.svg)](https://codeclimate.com/github/enygma/yubikey)\n[![Total Downloads](https://img.shields.io/packagist/dt/enygma/yubikey.svg?style=flat-square)](https://packagist.org/packages/enygma/yubikey)\n\nThis library lets you easily interface with the Yubico REST API for validating\nthe codes created by the Yubikey.\n\n### Requirements:\n\n- An API as requested from the Yubico site\n- A client ID requested from Yubico\n- A Yubikey to test out the implementation\n\n### Installation\n\nUse the followng command to install the library via Composer:\n\n```\ncomposer require enygma/yubikey\n```\n\n### Usage:\n\nLook at the `test.php` example script to see how to use it. This can be executed like:\n\n`php test.php [generated key]`\n\nExample code:\n\n```php\n\u003c?php\n$apiKey = 'dGVzdGluZzEyMzQ1Njc4OTA=';\n$clientId = '12345';\n\n$v = new \\Yubikey\\Validate($apiKey, $clientId);\n$response = $v-\u003echeck($inputtedKey);\n\necho ($response-\u003esuccess() === true) ? 'success!' : 'you failed. aw.';\n?\u003e\n```\n\n### HTTP vs HTTPS\n\nBy default the library will try to use a `HTTPS` request to the host given. If you need to disable this for some reason\n(like no SSL support), you can use the `setUseSecure` method and set it to false:\n\n```php\n$v = new \\Yubikey\\Validate($apiKey, $clientId);\n$v-\u003esetUseSecure(false);\n```\n\n### Overriding hosts\n\nThe library comes with a set of hostnames for the Yubico external API servers (api.yubico.com through api5.yubico.com). If\nyou ever have a need to override these, you can use `setHosts`:\n\n```php\n$v = new \\Yubikey\\Validate($apiKey, $clientId);\n$v-\u003esetHosts(array(\n    'api.myhost1.com',\n    'api1.myhost.com'\n));\n```\nRemember, this will *overwrite* the current hosts in the class, so be sure you don't still need those. If you just want to add\nanother host, look at the `addHost` method.\n\n### Multi-Server Requests:\n\nAdditonally, the library also supports simultaneous connections to multiple servers. By default it will only make\nthe request to the first server in the `hosts` list. You can enable the multi-server checking with a second parameter on\nthe `check()` method:\n\n```php\n\u003c?php\n$v = new \\Yubikey\\Validate($apiKey, $clientId);\n$response = $v-\u003echeck($inputtedKey, true);\n\necho ($response-\u003esuccess() === true) ? 'success!' : 'you failed. aw.';\n?\u003e\n````\n\nThis will make multiple requests and return the pass/fail status of the aggregate responses from each. So, if you have all but one\nserver pass, the overall response will be a fail. If all return `OK` though, you're in the clear.\n\n### \"First in\" result\n\nAdditionally, you can also switch on and off this aggregation of the results and go with only the \"first in\" response. You do this\nwith a flag on the `success` checking method:\n\n```php\n\u003c?php\n$v = new \\Yubikey\\Validate($apiKey, $clientId);\n$response = $v-\u003echeck($inputtedKey, true);\n\necho ($response-\u003esuccess(true) === true) ? 'success!' : 'you failed. aw.';\n?\u003e\n````\n\n**NOTE:** This will still work without multi-server checking. The \"first in\" will just always be the single response.\n\n\n@author Chris Cornutt \u003cccornutt@phpdeveloper.org\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenygma%2Fyubikey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenygma%2Fyubikey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenygma%2Fyubikey/lists"}