Lexiconga/backend/Token.php

18 lines
375 B
PHP
Raw Normal View History

2017-12-24 20:00:45 +01:00
<?php
require_once('./vendor/firebase/php-jwt/src/JWT.php');
use \Firebase\JWT\JWT;
class Token {
private $key;
function _construct() {
$this->key = 'ˈkɑːn.læŋ.ɪŋ_4eva';
}
public function encode ($data) {
return JWT::encode($data, $this->key);
}
public function decode ($token) {
return JWT::decode($token, $this->key, array('HS256'));
}
}