config = $appConfig; } /** * Generate token for the object * * @param array $object - object to signature * * @return string */ public function GetHash($object) { return \Firebase\JWT\JWT::encode($object, $this->config->GetSKey()); } /** * Create an object from the token * * @param string $token - token * * @return array */ public function ReadHash($token) { $result = null; $error = null; if ($token === null) { return [$result, "token is empty"]; } try { $result = \Firebase\JWT\JWT::decode($token, $this->config->GetSKey(), array("HS256")); } catch (\UnexpectedValueException $e) { $error = $e->getMessage(); } return [$result, $error]; } }