You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
557 B
PHTML
30 lines
557 B
PHTML
|
10 years ago
|
<?php
|
||
|
|
|
||
|
|
namespace App\Services;
|
||
|
|
|
||
|
|
use Firebase\JWT\JWT as JwtClient;
|
||
|
|
|
||
|
|
class Jwt
|
||
|
|
{
|
||
|
|
private static function getKey()
|
||
|
|
{
|
||
|
|
return Config::get('key');
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function encode($input)
|
||
|
|
{
|
||
|
|
return JwtClient::encode($input, self::getKey());
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function encode_withkey($input, $key)
|
||
|
|
{
|
||
|
|
return JwtClient::encode($input, $key);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function decodeArray($input)
|
||
|
|
{
|
||
|
|
$decoded = JWT::decode($input, self::getKey(), array('HS256'));
|
||
|
|
return $decoded;
|
||
|
|
}
|
||
|
|
}
|