Total Complexity | 2 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | final class AuthenticationToken |
||
7 | { |
||
8 | const ALGORITHM_HS256 = 'HS256'; |
||
9 | |||
10 | public static function generate($clientId, $clientKey, $serverKey) |
||
11 | { |
||
12 | return JWT::encode( |
||
13 | [ |
||
14 | 'sub' => $clientId, |
||
15 | 'clientKey' => $clientKey, |
||
16 | ], |
||
17 | $serverKey, |
||
18 | self::ALGORITHM_HS256 |
||
19 | ); |
||
20 | } |
||
21 | |||
22 | public static function decode($string, $serverKey) |
||
28 | ); |
||
29 | } |
||
31 |