<?php
use \Firebase\JWT\JWT;
class Token
{
    static private $key = "td%Fs;y~KgLeT'jYWJ#7L*'";
    static function crearToken($id){
        $c = time();
        $token = array(
            "sub" => $id,
            "iat" => $c
        );
        return JWT::encode($token, Token::$key);
    }

    static function decode($token){
        try{
            return JWT::decode($token, Token::$key, array('HS256'));

        }catch (Exception $e){
            return false;
        }
    }
}