| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function verify($request) |
||
| 27 | { |
||
| 28 | $token = $request->input('signature.token'); |
||
| 29 | $timestamp = $request->input('signature.timestamp'); |
||
| 30 | $signature = $request->input('signature.signature'); |
||
| 31 | |||
| 32 | // check if the timestamp is fresh |
||
| 33 | if (abs(time() - $timestamp) > 15) { |
||
| 34 | return false; |
||
| 35 | } |
||
| 36 | |||
| 37 | // returns true if signature is valid |
||
| 38 | return hash_hmac('sha256', $timestamp.$token, config('services.mailgun.secret')) === $signature; |
||
| 39 | } |
||
| 40 | } |
||
| 41 |