hmac api key check with hex

This commit is contained in:
Yuri Kuznetsov
2024-09-12 13:00:56 +03:00
parent 408a161595
commit 628e7e8131

View File

@@ -70,10 +70,16 @@ class Hmac implements Login
$string = $request->getMethod() . ' ' . $request->getResourcePath();
// To become a legacy.
if ($hash === ApiKey::hash($secretKey, $string)) {
return Result::success($user);
}
// As of v8.4.1.
if ($hash === hash_hmac('sha256', $string, $secretKey)) {
return Result::success($user);
}
return Result::fail(FailReason::HASH_NOT_MATCHED);
}
}