1 | <?php |
||
12 | class Verifier |
||
13 | { |
||
14 | /** |
||
15 | * @var HashCalculator |
||
16 | */ |
||
17 | private $calculator; |
||
18 | |||
19 | /** |
||
20 | * @var MonitorInterface |
||
21 | */ |
||
22 | private $monitor; |
||
23 | |||
24 | /** |
||
25 | * @var HeaderValidator |
||
26 | */ |
||
27 | private $validator; |
||
28 | |||
29 | 98 | public function __construct() |
|
38 | |||
39 | /** |
||
40 | * @param MonitorInterface $monitor |
||
41 | * |
||
42 | * @return Verifier |
||
43 | */ |
||
44 | 7 | public function setMonitor(MonitorInterface $monitor) |
|
50 | |||
51 | /** |
||
52 | * @param MessageInterface $message |
||
53 | * @param string $secret |
||
54 | * |
||
55 | * @return bool Signature verification outcome. |
||
56 | * |
||
57 | * @throws \InvalidArgumentException When $message is an implementation of |
||
58 | * MessageInterface that cannot be |
||
59 | * serialized and thus neither verified. |
||
60 | */ |
||
61 | 98 | public function verify(MessageInterface $message, $secret) |
|
74 | |||
75 | /** |
||
76 | * @param MessageInterface $message |
||
77 | * |
||
78 | * @return MessageInterface |
||
79 | */ |
||
80 | 77 | private function withoutUnsignedHeaders(MessageInterface $message) |
|
92 | } |
||
93 |