. */ namespace SP\Core\Crypt; /** * Class SecureCookie * * @package SP\Core\Crypt */ class UUIDCookie extends Cookie { /** * Nombre de la cookie */ const COOKIE_NAME = 'SYSPASS_UUID'; /** * Creates a cookie and sets its data * * @param string $signKey Signing key * @return string */ public static function createCookie($signKey) { $uuid = uniqid('', true); $cookie = new self(self::COOKIE_NAME); if ($cookie->setCookie($cookie->sign($uuid, $signKey))) { return $uuid; } return false; } /** * Loads cookie data * * @param string $signKey Signing key * @return bool|string */ public static function loadCookie($signKey) { $cookie = new self(self::COOKIE_NAME); $data = $cookie->getCookie(); return $data !== false ? $cookie->getCookieData($data, $signKey) : false; } }