承接 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.72k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-19