public function secureDir($chunkDir, $credentials)
    {
        $dir = $this->getDir() . $chunkDir;

        if ($credentials['method'] == 'none') {
            return array();
        } elseif ($credentials['method'] == 'user') {
            return array(
                'login' => $credentials['login'],
                'password' => $credentials['password'],
            );
        }

        $user = 'yc';
        $password = substr(md5(microtime()), 0, 10);

        $this->filesystem->dumpFile(
            $dir . '.htpasswd',
            sprintf('%s:%s', $user, crypt($password, md5($password)))
        );

        return array(
            'login' => $user,
            'password' => $password,
        );
    }