You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Verifies the CR-Signature header on incoming ComfinoPay webhook requests. Uses hash_equals() for timing-safe comparison.
*/
final class WebhookSignatureVerifier
{
/**
* Verifies the CR-Signature header on incoming ComfinoPay webhook requests. An empty API key is rejected outright: it would reduce the expected signature
* to a hash of the payload alone, which any caller can compute without knowing a secret, so every forged request would verify. Host platforms commonly
* resolve an unconfigured key field to an empty string, which makes this the difference between failing closed and an authentication bypass.
*
* @param string $signature The signature header value
* @param string $apiKey The API key
* @param string $payload The received request payload to verify
*
* @return bool True if the signature is valid, false otherwise
*/
public function verify(string $signature, string $apiKey, string $payload): bool