jakobo/hotp-php
Composer 安装命令:
composer require jakobo/hotp-php
包简介
HOTP simplifies One Time Password systems for PHP Authentication
README 文档
README
What is HOTP: HOTP is a class that simplifies One Time Password systems for PHP Authentication. The HOTP/TOTP Algorithms have been around for a bit, so this is a straightforward class to meet the test vector requirements.
What works with HOTP/TOTP: It's been tested to the test vectors, and I've verified the time-sync hashes against the following:
- Android: Mobile-OTP
- iPhone: OATH Token
Why would I use this: Who wouldn't love a simple drop-in class for HMAC Based One Time Passwords? It's a great extra layer of security (creating two-factor auth) and it's pretty darn zippy.
Okay you sold me. Give me some docs:
use jakobo\HOTP\HOTP; // event based $result = HOTP::generateByCounter( $key, $counter ); // time based within a "window" of time $result = HOTP::generateByTime( $key, $window ); // same as generateByTime, but for $min windows before and $max windows after $result = HOTP::generateByTimeWindow( $key, $window, $min, $max );
with $result, you can do all sorts of neat things...
$result->toString(); $result->toHex(); $result->toDec(); // how many digits in your OTP? $result->toHotp( $length );
Development
In order to support multiple PHP versions, a docker file and compose is available.
To build a php docker image with composer (and dependencies):
# Bring up the environment, mounts to /app in the container docker compose up # Get into the PHP environment docker compose exec php bash # Run composer cd /app composer install composer test
jakobo/hotp-php 适用场景与选型建议
jakobo/hotp-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 83.86k 次下载、GitHub Stars 达 50, 最近一次更新时间为 2019 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jakobo/hotp-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jakobo/hotp-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 83.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 51
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-02-18