定制 mincdev/php-otpauth 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mincdev/php-otpauth

最新稳定版本:1.0.1

Composer 安装命令:

composer require mincdev/php-otpauth

包简介

A library for genrating a 2 factor authentication QR code

README 文档

README

A library for generating a 2 factor authentication QR code to use with Google Authenticator, Authy, etc.

Secure QRCode Creation

This library has secure QRCode creation because of the fact that the QRCode is generated locally on your server. This means that the user's secret is not passed to any third party or remote server in order to generate a code. This was inspired by the stack overflow answer by kravietz as seen here

Installation (Composer)

composer require mincdev/php-otpauth

Dependencies

This library requires the tc-lib-barcode library found at https://github.com/tecnickcom/tc-lib-barcode.

Note: The tc-lib-barcode library is maintained and owned by a separate entity.

Generating a QR Code

You can generate a QR code which can be scanned by Google Authenticator, Authy, etc. by using the below.

$otpAuth = new OtpAuthenticator();

$userName = "MrDoe";
$appName = "My Awesome App";

// Store this secret somewhere safe, as you'll need it to validate the pin later
$userSecret = $otpAuth->newSecret();

$qrBase64 = $otpAuth->getQR($userName, $appName, $userSecret);

Validating a PIN

Once your user logs in, you can validate their pin by making use of the following:

$otpAuth = new OtpAuthenticator();
$isValid = $otpAuth->validate($userSecret, $pinCode);

统计信息

  • 总下载量: 23.67k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固