mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-31 02:08:57 +00:00
CS fixes
This commit is contained in:
@@ -113,8 +113,9 @@ class BtcPaymentController extends BasePageController
|
||||
|
||||
public static function verify_webhook($data, $hmac_header): bool
|
||||
{
|
||||
# Calculate HMAC
|
||||
// Calculate HMAC
|
||||
$calculated_hmac = base64_encode(hash_hmac('sha256', $data, config('nntmux.btcpay_webhook_secret'), true));
|
||||
|
||||
return hash_equals($hmac_header, $calculated_hmac);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -377,13 +377,13 @@ Route::post('2faVerify', function () {
|
||||
})->name('2faVerify')->middleware('2fa');
|
||||
|
||||
Route::post('btcpay/webhook', function (Illuminate\Http\Request $request) {
|
||||
# Extract the signature header
|
||||
// Extract the signature header
|
||||
$hmac_header = $_SERVER['btcpay-sig'];
|
||||
|
||||
# Get the raw body
|
||||
// Get the raw body
|
||||
$data = file_get_contents('php://input');
|
||||
|
||||
# Compare HMACs
|
||||
// Compare HMACs
|
||||
$verified = BtcPaymentController::verify_webhook($data, $hmac_header);
|
||||
if ($verified) {
|
||||
$payload = json_decode($request->getContent(), true);
|
||||
@@ -411,13 +411,13 @@ Route::post('btcpay/webhook', function (Illuminate\Http\Request $request) {
|
||||
}
|
||||
});
|
||||
Route::get('btcpay/webhook', function (Illuminate\Http\Request $request) {
|
||||
# Extract the signature header
|
||||
// Extract the signature header
|
||||
$hmac_header = $_SERVER['btcpay-sig'];
|
||||
|
||||
# Get the raw body
|
||||
// Get the raw body
|
||||
$data = file_get_contents('php://input');
|
||||
|
||||
# Compare HMACs
|
||||
// Compare HMACs
|
||||
$verified = BtcPaymentController::verify_webhook($data, $hmac_header);
|
||||
if ($verified) {
|
||||
$payload = json_decode($request->getContent(), true);
|
||||
|
||||
Reference in New Issue
Block a user