ideo/otpauth
Composer 安装命令:
composer require ideo/otpauth
包简介
Provides necessary processing for TOTP.
README 文档
README
Provides necessary processing for TOTP.
For pin generation and authentication, it is based on the implementation of google-authenticator.
Usage
Generation of QR code for TOTP compatible applications.
$keyGenerator = new KeyGenerator();
$qrCodeGenerator = new QrCodeGenerator();
// Generate keys randomly, save this key in association with the target account.
$keyBytes = $keyGenerator->generateRandom(10);
$qrDataUri = $qrCodeGenerator->getQrCodeDataUri($keyBytes, 'sample@foo.bar', 'Sample');
Authentication using pin.
// It reads the key of the target account and compares it with the input pin.
$passcodeGenerator = new PasscodeGenerator(new HMacSigner($keyBytes));
$counter = new TotpCounter();
$time = time();
$valid = $passcodeGenerator->verifyTimeoutCode($pin, $counter->getValueAtTime($time));
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2017-11-26