1 | <?php |
||
9 | class Authenticator |
||
10 | { |
||
11 | /** |
||
12 | * @var Calculator |
||
13 | */ |
||
14 | private $calculator; |
||
15 | |||
16 | 72 | public function __construct() |
|
20 | |||
21 | /** |
||
22 | * @param MessageInterface $message |
||
23 | * @param string $secret |
||
24 | * |
||
25 | * @return MessageInterface The signed message. |
||
26 | * |
||
27 | * @throws \InvalidArgumentException When $message is an implementation of |
||
28 | * MessageInterface that cannot be |
||
29 | * serialized and thus neither signed. |
||
30 | */ |
||
31 | 70 | public function sign(MessageInterface $message, $secret) |
|
45 | |||
46 | /** |
||
47 | * @param MessageInterface $message |
||
48 | * @param string $secret |
||
49 | * |
||
50 | * @return bool Signature verification outcome. |
||
51 | * |
||
52 | * @throws \InvalidArgumentException When $message is an implementation of |
||
53 | * MessageInterface that cannot be |
||
54 | * serialized and thus neither verified. |
||
55 | */ |
||
56 | 72 | public function verify(MessageInterface $message, $secret) |
|
80 | |||
81 | /** |
||
82 | * @param MessageInterface $message |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | 70 | private function getSignedHeadersString(MessageInterface $message) |
|
104 | } |
||
105 |