public function __construct($key, $algorithm = 'HS256', $type = 'JWT')
{
$this->setType($type);
$this->setAlgorithm($algorithm);
$this->setKey($key);
// If it's a certificate, we're a JWS instead
if (is_resource($key)) {
$this->setType('JWS');
}
}