aboutsummaryrefslogtreecommitdiff
path: root/lib/settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/settings.cpp')
-rw-r--r--lib/settings.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/settings.cpp b/lib/settings.cpp
index f8f1eae5..1278fe33 100644
--- a/lib/settings.cpp
+++ b/lib/settings.cpp
@@ -91,6 +91,8 @@ QMC_DEFINE_SETTING(AccountSettings, bool, keepLoggedIn, "keep_logged_in", false,
static const auto HomeserverKey = QStringLiteral("homeserver");
static const auto AccessTokenKey = QStringLiteral("access_token");
+static const auto EncryptionAccountPickleKey =
+ QStringLiteral("encryption_account_pickle");
QUrl AccountSettings::homeserver() const
{
@@ -112,7 +114,8 @@ QString AccountSettings::accessToken() const
void AccountSettings::setAccessToken(const QString& accessToken)
{
qCWarning(MAIN) << "Saving access_token to QSettings is insecure."
- " Developers, please save access_token separately.";
+ " Developers, do it manually or contribute to share "
+ "QtKeychain logic to libQuotient.";
setValue(AccessTokenKey, accessToken);
}
@@ -123,3 +126,25 @@ void AccountSettings::clearAccessToken()
// re-issue it
remove(AccessTokenKey);
}
+
+QByteArray AccountSettings::encryptionAccountPickle()
+{
+ QString passphrase = ""; // FIXME: add QtKeychain
+ return value("encryption_account_pickle", "").toByteArray();
+}
+
+void AccountSettings::setEncryptionAccountPickle(
+ const QByteArray& encryptionAccountPickle)
+{
+ qCWarning(MAIN)
+ << "Saving encryption_account_pickle to QSettings is insecure."
+ " Developers, do it manually or contribute to share QtKeychain "
+ "logic to libQuotient.";
+ QString passphrase = ""; // FIXME: add QtKeychain
+ setValue("encryption_account_pickle", encryptionAccountPickle);
+}
+
+void AccountSettings::clearEncryptionAccountPickle()
+{
+ remove(EncryptionAccountPickleKey); // TODO: Force to re-issue it?
+}