| Total Complexity | 5 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class Helper |
||
| 11 | { |
||
| 12 | protected const ALGORITHM_HS256 = 'HS256'; |
||
| 13 | |||
| 14 | public static function generate(string $clientId, string $clientKey, string $serverKey): string |
||
| 15 | { |
||
| 16 | return JWT::encode( |
||
| 17 | [ |
||
| 18 | 'sub' => $clientId, |
||
| 19 | 'clientKey' => $clientKey, |
||
| 20 | ], // payload PHP object or array |
||
| 21 | $serverKey, // key The secret key. |
||
| 22 | self::ALGORITHM_HS256, // alg The signing algorithm. |
||
| 23 | ); |
||
| 24 | } |
||
| 25 | |||
| 26 | public static function decode(string $jwt, string $serverKey): Payload |
||
| 43 | } |
||
| 44 | } |
||
| 45 |