false, 'error' => 'missing_or_invalid_timestamp']; } if (!preg_match('/^sha256=([0-9a-f]{64})$/', $sigHeader, $m)) { return ['ok' => false, 'error' => 'missing_or_invalid_signature']; } $now = (int) round(microtime(true) * 1000); $tsInt = (int) $ts; if (abs($now - $tsInt) > $maxSkewMs) { return ['ok' => false, 'error' => 'timestamp_out_of_range']; } $msg = $ts . '.' . $rawBody; $expected = og_hmac_sha256_hex($secret, $msg); $provided = $m[1]; if (!og_timing_safe_equals($expected, $provided)) { return ['ok' => false, 'error' => 'signature_mismatch']; } return ['ok' => true]; }