DNSBlock
This commit is contained in:
21
app/Utils/JWT.php
Normal file
21
app/Utils/JWT.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use Firebase\JWT\JWT as FirebaseJWT;
|
||||
use Firebase\JWT\Key;
|
||||
|
||||
class JWT
|
||||
{
|
||||
public static function encode($payload)
|
||||
{
|
||||
$key = getenv('JWT_SECRET') ?: 'default_secret';
|
||||
return FirebaseJWT::encode($payload, $key, 'HS256');
|
||||
}
|
||||
|
||||
public static function decode($token)
|
||||
{
|
||||
$key = getenv('JWT_SECRET') ?: 'default_secret';
|
||||
return FirebaseJWT::decode($token, new Key($key, 'HS256'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user