1 | <?php declare(strict_types = 1); |
||
9 | final class RequestSignatureMiddleware |
||
10 | { |
||
11 | const SIGNATURE_ALGORITHM = OPENSSL_ALGO_SHA256; |
||
12 | |||
13 | /** |
||
14 | * @var PrivateKey |
||
15 | */ |
||
16 | private $privateKey; |
||
17 | |||
18 | /** |
||
19 | * @param PrivateKey $privateKey |
||
20 | */ |
||
21 | public function __construct(PrivateKey $privateKey) |
||
25 | |||
26 | /** |
||
27 | * @param string $data |
||
28 | * @return string |
||
29 | * @throws \Exception |
||
30 | */ |
||
31 | public function sign(string $data): string |
||
38 | /** |
||
39 | * @param RequestInterface $request |
||
40 | * @param array $options |
||
41 | * |
||
42 | * @return Request |
||
43 | */ |
||
44 | public function __invoke(RequestInterface $request, array $options = []) |
||
79 | } |
||
80 |