whatbox/recaptcha-password-check
最新稳定版本:1.0.0
Composer 安装命令:
composer require whatbox/recaptcha-password-check
包简介
PHP client for Google's reCAPTCHA password check API
README 文档
README
PHP port of Google's Java API client for the reCAPTCHA Enterprise Password Check API.
A privacy-respecting solution to check username, password pairs against known breaches without leaking customer usernames or passwords to the breach database.
Similar to Have I Been Pwned, but a commercial API with fewer false positives by considering username and password together, instead of password alone.
Requirements
- PHP 8.1+
- Composer
Installation
composer install
Usage
<?php use ReCaptcha\PasswordCheck\Client\ReCaptchaPasswordCheckClient; use ReCaptcha\PasswordCheck\PasswordCheckVerification; $verification = PasswordCheckVerification::create($username, $password); $client = new ReCaptchaPasswordCheckClient(); $result = $client->completeVerification( $projectId, $apiKey, $verification, // Optional: If you use reCAPTCHA bot protection, you can attach this password check to the // reCaptcha Token and feed Google additional data in exchange for more accurate bot scores // expectedAction: 'login', // eventOverrides: [ // 'siteKey' => $siteKey, // 'token' => $recaptchaToken, // ] ); if ($result->areCredentialsLeaked()) { // Prompt the user to reset their password. }
Running tests
composer test
Project structure
src/Crypto– Elliptic-curve primitive, hash type enum, and supported curves.src/Utils– Username canonicalization, PHP Scrypt, and bit-prefix helpers.src/Client– High-level HTTP client for Google reCAPTCHA Password Check.tests/– PHPUnit test suite mirroring the upstream reference coverage.
License
Apache 2.0 – consistent with the upstream Google reference implementations.
统计信息
- 总下载量: 252
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2025-12-01