mysof/password-check

使用 haveibeenpwned.com API 检查提供的密码是否安全的简单类

1.1.0 2024-09-13 07:55 UTC

This package is auto-updated.

Last update: 2024-09-13 07:56:51 UTC


README

这是一个简单的类,用于利用 havibeenpwned.com API 检查密码是否安全。

此 API 不需要身份验证即可进行密码检查。

使用示例

此示例使用 Symfony HTTP 客户端,但也可以使用任何其他实现 \Symfony\Contracts\HttpClient\HttpClientInterface 的客户端。

$checker = new \MySof\PasswordCheck(
    \Symfony\Component\HttpClient\HttpClient::create()
);

if ($checker->isSafe("password")) {
    print "Password is clean";
} else {
    print "Password has been pwned";
}

有关 API 的更多信息,请参阅 https://haveibeenpwned.com/API/v3#PwnedPasswords