| Conditions | 4 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | public function authenticate($requestContent, $webhookSecret) |
||
| 8 | { |
||
| 9 | $matches = []; |
||
| 10 | $matched = preg_match('/^{"Content":(.*),"HashCode":"(.*)"}$/', $requestContent, $matches); |
||
| 11 | |||
| 12 | if ($matched === 1 && isset($matches[1]) && isset($matches[2])) { |
||
| 13 | return $matches[2] === strtoupper(hash_hmac('sha256', $matches[1], $webhookSecret)); |
||
| 14 | } |
||
| 15 | |||
| 16 | return false; |
||
| 17 | } |
||
| 19 |