All Projects → enygma → yubikey

enygma / yubikey

Licence: MIT license
PHP library to interface with the Yubikey REST API

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to yubikey

Multiotp
multiOTP open source strong two factor authentication PHP library, OATH certified, with TOTP, HOTP, Mobile-OTP, YubiKey, SMS, QRcode provisioning, etc.
Stars: ✭ 173 (+154.41%)
Mutual labels:  yubikey
Git-Secret
Go scripts for finding sensitive data like API key / some keywords in the github repository
Stars: ✭ 156 (+129.41%)
Mutual labels:  token
colonySale
Colony Token and Crowdsale Contracts
Stars: ✭ 27 (-60.29%)
Mutual labels:  token
Nginx Sso
SSO authentication provider for the auth_request nginx module
Stars: ✭ 195 (+186.76%)
Mutual labels:  yubikey
Lam
LDAP Account Manager
Stars: ✭ 223 (+227.94%)
Mutual labels:  yubikey
token-cli
Command line utility for interacting with OAuth2 infrastructure to generate tokens
Stars: ✭ 19 (-72.06%)
Mutual labels:  token
Piv Go
Keys and certificates for YubiKeys, written in Go
Stars: ✭ 172 (+152.94%)
Mutual labels:  yubikey
ucsf-vpn
Linux command-line client to manage a UCSF VPN connection
Stars: ✭ 30 (-55.88%)
Mutual labels:  yubikey
Libfido2
Provides library functionality for FIDO 2.0, including communication with a device over USB.
Stars: ✭ 244 (+258.82%)
Mutual labels:  yubikey
verify-apple-id-token
Verify the Apple id token on the server side.
Stars: ✭ 49 (-27.94%)
Mutual labels:  token
Go Ykpiv
Golang interface to manage Yubikeys, including a crypto.Signer & crypto.Decrypter interface
Stars: ✭ 196 (+188.24%)
Mutual labels:  yubikey
Python Fido2
Provides library functionality for FIDO 2.0, including communication with a device over USB.
Stars: ✭ 222 (+226.47%)
Mutual labels:  yubikey
T-REX
T-REX is a suite of smart contracts implementing the EIP 3643 and developed by Tokeny to manage and transfer financial assets on the Ethereum blockchain
Stars: ✭ 79 (+16.18%)
Mutual labels:  token
Yubioath Android
Yubico Authenticator for Android
Stars: ✭ 176 (+158.82%)
Mutual labels:  yubikey
firebase id token
A Ruby gem to verify the signature of Firebase ID Tokens.
Stars: ✭ 138 (+102.94%)
Mutual labels:  token
Yubico Piv Tool
Command line tool for the YubiKey PIV application
Stars: ✭ 172 (+152.94%)
Mutual labels:  yubikey
go-jwt-issuer
Microservice generates the pair of JSON web tokens - access-token and refresh-token are signed by user identifier.
Stars: ✭ 30 (-55.88%)
Mutual labels:  token
hedera-hts-demo
This is a demonstration UI for the Hedera Token Service. Written in JavaScript and Vue.JS
Stars: ✭ 66 (-2.94%)
Mutual labels:  token
lexertk
C++ Lexer Toolkit Library (LexerTk) https://www.partow.net/programming/lexertk/index.html
Stars: ✭ 26 (-61.76%)
Mutual labels:  token
mitome.in
Explore OpenPGP and other cryptography as an alternative for seals (mitome-in)
Stars: ✭ 30 (-55.88%)
Mutual labels:  yubikey

Yubikey PHP Library

Travis-CI Build Status Codacy Badge Code Climate Total Downloads

This library lets you easily interface with the Yubico REST API for validating the codes created by the Yubikey.

Requirements:

  • An API as requested from the Yubico site
  • A client ID requested from Yubico
  • A Yubikey to test out the implementation

Installation

Use the followng command to install the library via Composer:

composer require enygma/yubikey

Usage:

Look at the test.php example script to see how to use it. This can be executed like:

php test.php [generated key]

Example code:

<?php
$apiKey = 'dGVzdGluZzEyMzQ1Njc4OTA=';
$clientId = '12345';

$v = new \Yubikey\Validate($apiKey, $clientId);
$response = $v->check($inputtedKey);

echo ($response->success() === true) ? 'success!' : 'you failed. aw.';
?>

HTTP vs HTTPS

By default the library will try to use a HTTPS request to the host given. If you need to disable this for some reason (like no SSL support), you can use the setUseSecure method and set it to false:

$v = new \Yubikey\Validate($apiKey, $clientId);
$v->setUseSecure(false);

Overriding hosts

The library comes with a set of hostnames for the Yubico external API servers (api.yubico.com through api5.yubico.com). If you ever have a need to override these, you can use setHosts:

$v = new \Yubikey\Validate($apiKey, $clientId);
$v->setHosts(array(
    'api.myhost1.com',
    'api1.myhost.com'
));

Remember, this will overwrite the current hosts in the class, so be sure you don't still need those. If you just want to add another host, look at the addHost method.

Multi-Server Requests:

Additonally, the library also supports simultaneous connections to multiple servers. By default it will only make the request to the first server in the hosts list. You can enable the multi-server checking with a second parameter on the check() method:

<?php
$v = new \Yubikey\Validate($apiKey, $clientId);
$response = $v->check($inputtedKey, true);

echo ($response->success() === true) ? 'success!' : 'you failed. aw.';
?>

This will make multiple requests and return the pass/fail status of the aggregate responses from each. So, if you have all but one server pass, the overall response will be a fail. If all return OK though, you're in the clear.

"First in" result

Additionally, you can also switch on and off this aggregation of the results and go with only the "first in" response. You do this with a flag on the success checking method:

<?php
$v = new \Yubikey\Validate($apiKey, $clientId);
$response = $v->check($inputtedKey, true);

echo ($response->success(true) === true) ? 'success!' : 'you failed. aw.';
?>

NOTE: This will still work without multi-server checking. The "first in" will just always be the single response.

@author Chris Cornutt [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].