Bump stripe-php from 21.0.0 to 21.3.2

This commit is contained in:
johnnyq
2026-09-29 18:19:21 -04:00
parent 391d9c32ff
commit db033eca77
91 changed files with 1656 additions and 178 deletions

View File

@@ -42,6 +42,13 @@ abstract class WebhookSignature
$header
);
}
if (empty($secret)) {
throw Exception\SignatureVerificationException::factory(
'No webhook secret value was provided. It should start with `whsec_`',
$payload,
$header
);
}
// Check if expected signature is found in list of signatures from
// header
@@ -124,6 +131,27 @@ abstract class WebhookSignature
return $signatures;
}
/**
* Compute the `Stripe-Signature` header for a given webhook body & secret. Useful for signing payloads in unit tests.
*
* @param string $payload the webhook body to sign
* @param string $secret the webhook endpoint's signing secret
* @param null|int $timestamp unix timestamp to use (defaults to current time)
*
* @return string the full `Stripe-Signature` header value
*/
public static function generateSignatureHeader($payload, $secret, $timestamp = null)
{
if (null === $timestamp) {
$timestamp = \time();
}
$scheme = self::EXPECTED_SCHEME;
$signedPayload = "{$timestamp}.{$payload}";
$signature = self::computeSignature($signedPayload, $secret);
return "t={$timestamp},{$scheme}={$signature}";
}
/**
* Computes the signature for a given payload and secret.
*