Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 2 | public function decryptData(string $sessionKey, string $iv, string $encrypted): array |
|
37 | { |
||
38 | 2 | $decrypted = AES::decrypt( |
|
39 | 2 | base64_decode($encrypted, false), |
|
40 | 2 | base64_decode($sessionKey, false), |
|
41 | 2 | base64_decode($iv, false) |
|
42 | ); |
||
43 | |||
44 | 2 | $decrypted = json_decode($decrypted, true); |
|
45 | |||
46 | 2 | if (!$decrypted) { |
|
47 | 1 | throw new DecryptException('The given payload is invalid.'); |
|
48 | } |
||
49 | |||
50 | 1 | return $decrypted; |
|
51 | } |
||
53 |