wildwolf / yubico-otp
PHP 7-friendly alternative to the official php-yubico client
Fund package maintenance!
www.paypal.com/donate/?hosted_button_id=SAG6877JDJ3KU
send.monobank.ua/jar/7rosVfiwKM
Installs: 18 682
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 1
Open Issues: 1
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-openssl: *
Requires (Dev)
- phpunit/phpunit: ^9.5.11
- psalm/plugin-phpunit: ^0.18.4
- vimeo/psalm: ^5.22.1
This package is auto-updated.
Last update: 2024-11-04 03:14:01 UTC
README
PHP 7/8-friendly alternative to the official php-yubico client.
Installation
composer require wildwolf/yubico-otp
Usage
$otp = new WildWolf\Yubico\OTP($id, $secret); $response = null; $result = $otp->verify($code, null, &$response);
Where:
$id
,$secret
are the Client ID and the secret key; you will need to sign up for them;$code
is the OTP code to verify (it will look something likeccccccjknjjnfffttntuknrfnkednknkfjegcrhhkuut
; seeOTP::parsePasswordOTP()
for its format);$result
is the verification result (true
for success,false
for failure);$response
is the raw response from Yubico (details).
verify()
can throw OTPBadResponseException
if the response fails the basic sanity checks, OTPTamperedResponseException
if the response signature fails to validate, OTPTransportException
in case of the issues talking to the OTP server.