| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 84 | public function verify(RequestInterface $request, string $secret): bool |
|
| 28 | { |
||
| 29 | 84 | if (false === $matches = $this->validator->conforms($request)) { |
|
|
|
|||
| 30 | 81 | return false; |
|
| 31 | } |
||
| 32 | |||
| 33 | 57 | $clientSideSignature = $matches[Specification::AUTH_HEADER][1]; |
|
| 34 | |||
| 35 | 57 | $serverSideSignature = HashCalculator::hmac( |
|
| 36 | 57 | RequestSerializer::serialize($this->withoutUnsignedHeaders($request)), |
|
| 37 | 57 | $secret |
|
| 38 | ); |
||
| 39 | |||
| 40 | 57 | return \hash_equals($serverSideSignature, $clientSideSignature); |
|
| 41 | } |
||
| 56 |