Files
ladill-woo-manager/app/Services/Woo/WooWebhookVerifier.php
T
isaaccladandCursor ffe0b9d877
Deploy Ladill Woo Manager / deploy (push) Failing after 2s
Scaffold Ladill Woo Manager for WooCommerce order fulfillment.
Standalone app with SSO shell, WordPress plugin connect flow, webhook ingest,
fulfillment inbox, and plugin activation API — no payment processing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 22:39:38 +00:00

27 lines
613 B
PHP

<?php
namespace App\Services\Woo;
use App\Models\WooStore;
use Illuminate\Http\Request;
class WooWebhookVerifier
{
public function verify(Request $request, WooStore $store): bool
{
$signature = (string) $request->header('X-WC-Webhook-Signature', '');
if ($signature === '') {
return false;
}
$secret = (string) $store->webhook_secret;
if ($secret === '') {
return false;
}
$expected = base64_encode(hash_hmac('sha256', $request->getContent(), $secret, true));
return hash_equals($expected, $signature);
}
}