Conditions | 1 |
Paths | 1 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function validate(string $signature, string $domain, string $data): void |
||
21 | { |
||
22 | // Validate webhook secret presence |
||
23 | $secret = $this->secretProvider->getSecret($domain); |
||
24 | throw_if(empty($secret), WebhookFailed::missingSigningSecret()); |
||
25 | |||
26 | // Validate webhook signature |
||
27 | throw_unless( |
||
28 | $this->isWebhookSignatureValid($signature, $data, $secret), |
||
29 | WebhookFailed::invalidSignature($signature) |
||
30 | ); |
||
45 |