1 | <?php |
||
12 | class Verifier |
||
13 | { |
||
14 | /** |
||
15 | * @var HashCalculator |
||
16 | */ |
||
17 | private $calculator; |
||
18 | |||
19 | /** |
||
20 | * @var null|int |
||
21 | */ |
||
22 | private $maxDelay = null; |
||
23 | |||
24 | /** |
||
25 | * @var MonitorInterface |
||
26 | */ |
||
27 | private $monitor; |
||
28 | |||
29 | /** |
||
30 | * @var HeaderValidator |
||
31 | */ |
||
32 | private $validator; |
||
33 | |||
34 | 105 | public function __construct() |
|
42 | |||
43 | /** |
||
44 | * @param int $maxDelay |
||
45 | * |
||
46 | * @return Verifier |
||
47 | */ |
||
48 | 7 | public function setMaximumDelay($maxDelay) |
|
54 | |||
55 | /** |
||
56 | * @param MonitorInterface $monitor |
||
57 | * |
||
58 | * @return Verifier |
||
59 | */ |
||
60 | 7 | public function setMonitor(MonitorInterface $monitor) |
|
66 | |||
67 | /** |
||
68 | * @param MessageInterface $message |
||
69 | * @param string $secret |
||
70 | * |
||
71 | * @return bool Signature verification outcome. |
||
72 | * |
||
73 | * @throws \InvalidArgumentException When $message is an implementation of |
||
74 | * MessageInterface that cannot be |
||
75 | * serialized and thus neither verified. |
||
76 | */ |
||
77 | 105 | public function verify(MessageInterface $message, $secret) |
|
93 | |||
94 | /** |
||
95 | * @param MessageInterface $message |
||
96 | * |
||
97 | * @return MessageInterface |
||
98 | */ |
||
99 | 84 | private function withoutUnsignedHeaders(MessageInterface $message) |
|
111 | |||
112 | /** |
||
113 | * @param MessageInterface $message |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | 84 | private function delayed(MessageInterface $message) |
|
124 | } |
||
125 |