aboutsummaryrefslogtreecommitdiff
path: root/lib/crypto/qolmaccount.cpp
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-04-19 16:07:57 +0200
committerTobias Fella <fella@posteo.de>2021-12-01 21:34:52 +0100
commitea617d31cf3f72f76fd49c0a20f445a78678fe5f (patch)
treea99a186670eb3b50588411fe6d4eb9ddad2dfcb4 /lib/crypto/qolmaccount.cpp
parentbc4ef60c29709a6f782f6e75e1f040f250fb8bd7 (diff)
downloadlibquotient-ea617d31cf3f72f76fd49c0a20f445a78678fe5f.tar.gz
libquotient-ea617d31cf3f72f76fd49c0a20f445a78678fe5f.zip
Apply suggestions from code review
Co-authored-by: Tobias Fella <9750016+TobiasFella@users.noreply.github.com>
Diffstat (limited to 'lib/crypto/qolmaccount.cpp')
-rw-r--r--lib/crypto/qolmaccount.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/crypto/qolmaccount.cpp b/lib/crypto/qolmaccount.cpp
index 4f007e2f..8b964c9f 100644
--- a/lib/crypto/qolmaccount.cpp
+++ b/lib/crypto/qolmaccount.cpp
@@ -151,9 +151,9 @@ size_t QOlmAccount::maxNumberOfOneTimeKeys() const
size_t QOlmAccount::generateOneTimeKeys(size_t numberOfKeys) const
{
- const size_t randomLen = olm_account_generate_one_time_keys_random_length(m_account, numberOfKeys);
- QByteArray randomBuffer = getRandom(randomLen);
- const auto error = olm_account_generate_one_time_keys(m_account, numberOfKeys, randomBuffer.data(), randomLen);
+ const size_t randomLength = olm_account_generate_one_time_keys_random_length(m_account, numberOfKeys);
+ QByteArray randomBuffer = getRandom(randomLength);
+ const auto error = olm_account_generate_one_time_keys(m_account, numberOfKeys, randomBuffer.data(), randomLength);
if (error == olm_error()) {
throw lastError(m_account);
@@ -219,12 +219,12 @@ std::optional<QOlmError> QOlmAccount::removeOneTimeKeys(const std::unique_ptr<QO
return std::nullopt;
}
-OlmAccount *Quotient::QOlmAccount::data()
+OlmAccount *QOlmAccount::data()
{
return m_account;
}
-DeviceKeys QOlmAccount::getDeviceKeys() const
+DeviceKeys QOlmAccount::deviceKeys() const
{
DeviceKeys deviceKeys;
deviceKeys.userId = m_userId;
@@ -243,7 +243,7 @@ DeviceKeys QOlmAccount::getDeviceKeys() const
UploadKeysJob *QOlmAccount::createUploadKeyRequest(const OneTimeKeys &oneTimeKeys)
{
- auto deviceKeys = getDeviceKeys();
+ auto deviceKeys = deviceKeys();
if (oneTimeKeys.curve25519().isEmpty()) {
return new UploadKeysJob(deviceKeys);
@@ -253,9 +253,7 @@ UploadKeysJob *QOlmAccount::createUploadKeyRequest(const OneTimeKeys &oneTimeKey
auto temp = signOneTimeKeys(oneTimeKeys);
QHash<QString, QVariant> oneTimeKeysSigned;
for (const auto &[keyId, key] : asKeyValueRange(temp)) {
- QVariant keyVar;
- keyVar.setValue(key);
- oneTimeKeysSigned[keyId] = keyVar;
+ oneTimeKeysSigned[keyId] = QVariant::fromValue(key);
}
return new UploadKeysJob(deviceKeys, oneTimeKeysSigned);