diff --git a/src/Cache.cpp b/src/Cache.cpp
index ee991dc28b55955279bb85f6f8395c6c764f58e1..7996c017d654833c63b3598a81ca4c8030fad7e0 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -720,20 +720,34 @@ Cache::storeSecret(const std::string name, const std::string secret)
 {
         auto settings = UserSettings::instance();
         auto job      = new QKeychain::WritePasswordJob(QCoreApplication::applicationName());
+        job->setAutoDelete(true);
         job->setInsecureFallback(true);
-        job->setKey("matrix." +
-                    QString(QCryptographicHash::hash(settings->profile().toUtf8(),
-                                                     QCryptographicHash::Sha256)) +
-                    "." + name.c_str());
+
+        // job->setSettings(new QSettings(job));
+        job->setKey(
+          "matrix." +
+          QString(QCryptographicHash::hash(settings->profile().toUtf8(), QCryptographicHash::Sha256)
+                    .toBase64()) +
+          "." + QString::fromStdString(name));
+
         job->setTextData(QString::fromStdString(secret));
-        QObject::connect(job, &QKeychain::Job::finished, job, [name, this](QKeychain::Job *job) {
-                if (job->error()) {
-                        nhlog::db()->warn(
-                          "Storing secret '{}' failed: {}", name, job->errorString().toStdString());
-                } else {
-                        emit secretChanged(name);
-                }
-        });
+        QObject::connect(
+          job,
+          &QKeychain::WritePasswordJob::finished,
+          this,
+          [name, this](QKeychain::Job *job) {
+                  if (job->error()) {
+                          nhlog::db()->warn("Storing secret '{}' failed: {}",
+                                            name,
+                                            job->errorString().toStdString());
+                  } else {
+                          // if we emit the signal directly, qtkeychain breaks and won't execute new
+                          // jobs. You can't start a job from the finish signal of a job.
+                          QTimer::singleShot(100, [this, name] { emit secretChanged(name); });
+                          nhlog::db()->info("Storing secret '{}' successful", name);
+                  }
+          },
+          Qt::ConnectionType::DirectConnection);
         job->start();
 }
 
@@ -744,10 +758,11 @@ Cache::deleteSecret(const std::string name)
         QKeychain::DeletePasswordJob job(QCoreApplication::applicationName());
         job.setAutoDelete(false);
         job.setInsecureFallback(true);
-        job.setKey("matrix." +
-                   QString(QCryptographicHash::hash(settings->profile().toUtf8(),
-                                                    QCryptographicHash::Sha256)) +
-                   "." + name.c_str());
+        job.setKey(
+          "matrix." +
+          QString(QCryptographicHash::hash(settings->profile().toUtf8(), QCryptographicHash::Sha256)
+                    .toBase64()) +
+          "." + QString::fromStdString(name));
         // FIXME(Nico): Nested event loops are dangerous. Some other slots may resume in the mean
         // time!
         QEventLoop loop;
@@ -765,10 +780,11 @@ Cache::secret(const std::string name)
         QKeychain::ReadPasswordJob job(QCoreApplication::applicationName());
         job.setAutoDelete(false);
         job.setInsecureFallback(true);
-        job.setKey("matrix." +
-                   QString(QCryptographicHash::hash(settings->profile().toUtf8(),
-                                                    QCryptographicHash::Sha256)) +
-                   "." + name.c_str());
+        job.setKey(
+          "matrix." +
+          QString(QCryptographicHash::hash(settings->profile().toUtf8(), QCryptographicHash::Sha256)
+                    .toBase64()) +
+          "." + QString::fromStdString(name));
         // FIXME(Nico): Nested event loops are dangerous. Some other slots may resume in the mean
         // time!
         QEventLoop loop;
diff --git a/src/Olm.cpp b/src/Olm.cpp
index e4ab0aa13c84a4e61c1fba0c3a808cde16e38565..40c87f9f66c46b30015ea360a254423197fbee90 100644
--- a/src/Olm.cpp
+++ b/src/Olm.cpp
@@ -425,6 +425,8 @@ handle_olm_message(const OlmMessage &msg, const UserKeyCache &otherUserDeviceKey
                                                     }
                                             });
 
+                                        nhlog::crypto()->info("Storing secret {}",
+                                                              secret_name->second);
                                         cache::client()->storeSecret(secret_name->second,
                                                                      e->content.secret);