300) { http_response_code(400); exit; } $expected = 'v1=' . hash_hmac('sha256', $timestamp . '.' . $body, $secret); if (!hash_equals($expected, $signature)) { http_response_code(401); exit; } // Use a database/queue uniqueness constraint on $webhookId before processing. $event = json_decode($body, true, flags: JSON_THROW_ON_ERROR); error_log(sprintf('Verified FileFast event %s (%s)', $webhookId, $event['type'] ?? 'unknown')); http_response_code(204);