diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-07-07 14:47:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-07 14:47:41 +0900 |
commit | 6c9d895c03b9d0e7ffbf5bace3994536ff3215be (patch) | |
tree | d80e9fe022e631d76fae641eddc264f7306996de /lib/settings.cpp | |
parent | f58819e4e930ee66e790eccaedf551f807956d72 (diff) | |
parent | d5b4e6440dae82eebc86657dd2f828edaf81b180 (diff) | |
download | libquotient-6c9d895c03b9d0e7ffbf5bace3994536ff3215be.tar.gz libquotient-6c9d895c03b9d0e7ffbf5bace3994536ff3215be.zip |
Merge pull request #329 from a-andreyev/aa13q-e2ee-enc-mng
E2EE: Introduce EncryptionManager with uploadIdentityKeys and uploadOneTimeKeys API.
Diffstat (limited to 'lib/settings.cpp')
-rw-r--r-- | lib/settings.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/settings.cpp b/lib/settings.cpp index 124d7042..5f10299c 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -90,6 +90,7 @@ 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 { @@ -114,7 +115,7 @@ 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); } @@ -124,3 +125,22 @@ void AccountSettings::clearAccessToken() legacySettings.remove(QStringLiteral("device_id")); // Force the server to 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? +} |