1 | <?php |
||
9 | class WebhookAuthenticator |
||
10 | { |
||
11 | protected static $xsollaSubnets = [ |
||
12 | '159.255.220.240/28', |
||
13 | '185.30.20.16/29', |
||
14 | '185.30.21.0/24', |
||
15 | '185.30.21.16/29', |
||
16 | ]; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $projectSecretKey; |
||
22 | |||
23 | /** |
||
24 | * @param string $projectSecretKey |
||
25 | */ |
||
26 | public function __construct($projectSecretKey) |
||
30 | |||
31 | /** |
||
32 | * @param WebhookRequest $webhookRequest |
||
33 | * @param bool $checkClientIp |
||
34 | * |
||
35 | * @throws InvalidClientIpException |
||
36 | * @throws InvalidSignatureException |
||
37 | */ |
||
38 | public function authenticate(WebhookRequest $webhookRequest, $checkClientIp = true) |
||
45 | |||
46 | /** |
||
47 | * @param string $clientIp |
||
48 | * |
||
49 | * @throws InvalidClientIpException |
||
50 | */ |
||
51 | public function authenticateClientIp($clientIp) |
||
61 | |||
62 | /** |
||
63 | * @param WebhookRequest $webhookRequest |
||
64 | * |
||
65 | * @throws InvalidSignatureException |
||
66 | */ |
||
67 | public function authenticateSignature(WebhookRequest $webhookRequest) |
||
85 | } |
||
86 |