texdc/totp
Composer 安装命令:
composer require texdc/totp
包简介
Simple TOTP (RFC 6238)
README 文档
README
TOTP is a simple, compact and bare-bones PHP class for calculating TOTP tokens using the SHA1 default, commonly used for two-factor authentication in mobile apps such as Google Authenticator. It comprises three public methods of which only one is necessary to call to get a token.
Usage
Simply call $totp->getOTP( $secret [, $digits = 6 [, $period = 30 [, $offset = null ]]] )
which returns a string holding the authentication token.
The other two functions are meant to be convenient utilities:
$totp->genSecret( [ $length = 24 ] ) generates a TOTP-compatible pseudorandom secret
in Base32 ASCII, returning a string holding the random secret.
$totp->genURI( $account, $secret [, $digits = null [, $period = null [, $issuer = '' ]]] )
returns a string holding an otpauth:// style URI providing the supplied parameters,
which can be embedded in a QR code image.
NOTE: All arguments are validated and every method may throw an
Assert\AssertionFailedExceptiondetailing the error.
License
TOTP is released under the Creative Commons BY-NC-SA 4.0 license.
Portions Copyright (c) 2014 Robin Leffman. The original source is available on github.
统计信息
- 总下载量: 354
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: CC-BY-NC-SA-4.0
- 更新时间: 2016-05-02