PHPSecureSession\SecureHandler::getKey PHP Method

getKey() protected method

Get the encryption and authentication keys from cookie
protected getKey ( string $name ) : string
$name string
return string
    protected function getKey($name)
    {
        if (empty($_COOKIE[$name])) {
            $key = random_bytes(64);
            // 32 for encryption and 32 for authentication
            $cookieParam = session_get_cookie_params();
            setcookie($name, base64_encode($key), $cookieParam['lifetime'] > 0 ? time() + $cookieParam['lifetime'] : 0, $cookieParam['path'], $cookieParam['domain'], $cookieParam['secure'], $cookieParam['httponly']);
        } else {
            $key = base64_decode($_COOKIE[$name]);
        }
        return $key;
    }