summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cache.cpp')
-rw-r--r--src/Cache.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp

index 7efae881..dac0b23a 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp
@@ -167,14 +167,14 @@ Cache::Cache(const QString &userId, QObject *parent) void Cache::setup() { - UserSettings settings; + auto settings = UserSettings::instance(); nhlog::db()->debug("setting up cache"); cacheDirectory_ = QString("%1/%2%3") .arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)) .arg(QString::fromUtf8(localUserId_.toUtf8().toHex())) - .arg(QString::fromUtf8(settings.profile().toUtf8().toHex())); + .arg(QString::fromUtf8(settings->profile().toUtf8().toHex())); bool isInitial = !QFile::exists(cacheDirectory_); @@ -578,12 +578,12 @@ Cache::restoreOlmAccount() void Cache::storeSecret(const std::string &name, const std::string &secret) { - UserSettings settings; + auto settings = UserSettings::instance(); QKeychain::WritePasswordJob job(QCoreApplication::applicationName()); job.setAutoDelete(false); job.setInsecureFallback(true); job.setKey("matrix." + - QString(QCryptographicHash::hash(settings.profile().toUtf8(), + QString(QCryptographicHash::hash(settings->profile().toUtf8(), QCryptographicHash::Sha256)) + "." + name.c_str()); job.setTextData(QString::fromStdString(secret)); @@ -603,12 +603,12 @@ Cache::storeSecret(const std::string &name, const std::string &secret) void Cache::deleteSecret(const std::string &name) { - UserSettings settings; + auto settings = UserSettings::instance(); QKeychain::DeletePasswordJob job(QCoreApplication::applicationName()); job.setAutoDelete(false); job.setInsecureFallback(true); job.setKey("matrix." + - QString(QCryptographicHash::hash(settings.profile().toUtf8(), + QString(QCryptographicHash::hash(settings->profile().toUtf8(), QCryptographicHash::Sha256)) + "." + name.c_str()); QEventLoop loop; @@ -622,12 +622,12 @@ Cache::deleteSecret(const std::string &name) std::optional<std::string> Cache::secret(const std::string &name) { - UserSettings settings; + auto settings = UserSettings::instance(); QKeychain::ReadPasswordJob job(QCoreApplication::applicationName()); job.setAutoDelete(false); job.setInsecureFallback(true); job.setKey("matrix." + - QString(QCryptographicHash::hash(settings.profile().toUtf8(), + QString(QCryptographicHash::hash(settings->profile().toUtf8(), QCryptographicHash::Sha256)) + "." + name.c_str()); QEventLoop loop;