This commit is contained in:
Yuri Kuznetsov
2024-11-24 11:23:32 +02:00
parent 6f981ea5a7
commit d9faf23b81
2 changed files with 11 additions and 3 deletions
@@ -71,12 +71,11 @@ class Hmac implements Login
$string = $request->getMethod() . ' ' . $request->getResourcePath();
// As of v8.4.1.
if ($hash === hash_hmac('sha256', $string, $secretKey)) {
if ($hash === ApiKey::hash($secretKey, $string)) {
return Result::success($user);
}
// To become a legacy.
if ($hash === ApiKey::hash($secretKey, $string)) {
if ($hash === ApiKey::hashLegacy($secretKey, $string)) {
return Result::success($user);
}
+9
View File
@@ -39,6 +39,15 @@ class ApiKey
{}
public static function hash(string $secretKey, string $string = ''): string
{
return hash_hmac('sha256', $string, $secretKey);
}
/**
* @deprecated
* @internal
*/
public static function hashLegacy(string $secretKey, string $string = ''): string
{
return hash_hmac('sha256', $string, $secretKey, true);
}