Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function decryptData(string $sessionKey, string $iv, string $encrypted): array |
||
18 | { |
||
19 | $decrypted = AES::decrypt( |
||
20 | base64_decode($encrypted, false), |
||
21 | base64_decode($sessionKey, false), |
||
22 | base64_decode($iv, false) |
||
23 | ); |
||
24 | |||
25 | $decrypted = json_decode($decrypted, true); |
||
26 | |||
27 | if (!$decrypted) { |
||
28 | throw new \Exception("The given payload is invalid."); |
||
29 | } |
||
30 | |||
31 | return $decrypted; |
||
32 | } |
||
34 |