wildwolf / yubico-otp
PHP 7兼容的官方php-yubico客户端替代品
3.0.3
2024-02-19 23:37 UTC
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-09-23 03:07:30 UTC
README
PHP 7/8兼容的官方 php-yubico 客户端替代品。
安装
composer require wildwolf/yubico-otp
用法
$otp = new WildWolf\Yubico\OTP($id, $secret); $response = null; $result = $otp->verify($code, null, &$response);
位置
$id
和$secret
是客户端 ID 和密钥;您需要 注册 以获取它们;$code
是要验证的OTP代码(它看起来可能像ccccccjknjjnfffttntuknrfnkednknkfjegcrhhkuut
;有关其格式,请参阅OTP::parsePasswordOTP()
);$result
是验证结果(成功为true
,失败为false
);$response
是来自Yubico的原始响应(详情)。
verify()
如果响应未通过基本合理性检查,则可抛出 OTPBadResponseException
,如果响应签名验证失败,则抛出 OTPTamperedResponseException
,如果与OTP服务器通信出现问题时,则抛出 OTPTransportException
。