diff options
author | Carl Schwan <carl@carlschwan.eu> | 2021-04-19 16:07:57 +0200 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2021-12-01 21:34:52 +0100 |
commit | ea617d31cf3f72f76fd49c0a20f445a78678fe5f (patch) | |
tree | a99a186670eb3b50588411fe6d4eb9ddad2dfcb4 /lib/crypto/qolmaccount.cpp | |
parent | bc4ef60c29709a6f782f6e75e1f040f250fb8bd7 (diff) | |
download | libquotient-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.cpp | 16 |
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); |