1 | <?php |
||
8 | final class ResponseSignatureMiddleware |
||
9 | { |
||
10 | const SIGNATURE_ALGORITHM = OPENSSL_ALGO_SHA256; |
||
11 | const VERIFY_IS_VALID = 1; |
||
12 | const VERIFY_IS_INVALID = 0; |
||
13 | const VERIFY_IS_ERROR = -1; |
||
14 | |||
15 | /** |
||
16 | * @var Certificate |
||
17 | */ |
||
18 | private $publicKey; |
||
19 | |||
20 | /** |
||
21 | * @param Certificate $publicKey |
||
22 | */ |
||
23 | public function __construct(Certificate $publicKey) |
||
27 | |||
28 | /** |
||
29 | * @param ResponseInterface $response |
||
30 | * |
||
31 | * @return ResponseInterface |
||
32 | * @throws \Exception |
||
33 | */ |
||
34 | public function __invoke(ResponseInterface $response) |
||
58 | |||
59 | /** |
||
60 | * @param ResponseInterface $response |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | private function createSignatureDataFromHeaders(ResponseInterface $response) |
||
73 | |||
74 | /** |
||
75 | * @param ResponseInterface $response |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | private function convertHeadersToSignatureData(ResponseInterface $response) |
||
104 | } |
||
105 |