1 | <?php |
||
12 | final class ResponseSignatureMiddleware |
||
13 | { |
||
14 | const SIGNATURE_ALGORITHM = OPENSSL_ALGO_SHA256; |
||
15 | const VERIFY_IS_VALID = 1; |
||
16 | const VERIFY_IS_INVALID = 0; |
||
17 | const VERIFY_IS_ERROR = -1; |
||
18 | |||
19 | /** |
||
20 | * @var Certificate |
||
21 | */ |
||
22 | private $publicKey; |
||
23 | |||
24 | /** |
||
25 | * @param Certificate $publicKey |
||
26 | */ |
||
27 | public function __construct(Certificate $publicKey) |
||
31 | |||
32 | /** |
||
33 | * @param ResponseInterface $response |
||
34 | * |
||
35 | * @return ResponseInterface |
||
36 | * @throws \Exception |
||
37 | */ |
||
38 | public function __invoke(ResponseInterface $response) |
||
62 | |||
63 | /** |
||
64 | * @param ResponseInterface $response |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | private function createSignatureDataFromHeaders(ResponseInterface $response) |
||
77 | |||
78 | /** |
||
79 | * @param ResponseInterface $response |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | private function convertHeadersToSignatureData(ResponseInterface $response) |
||
108 | } |
||
109 |