aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmaccount.cpp
AgeCommit message (Collapse)Author
2022-06-04Address Sonar warningsAlexey Rusakov
2022-05-31Tweak QOlmAccount and data structures aroundAlexey Rusakov
This is mainly to plug the definition of a string-to-variant map for one-time keys (see https://spec.matrix.org/v1.2/client-server-api/#key-algorithms) into the CS API generated code (see the "shortcut OneTimeKeys" commit for gtad.yaml); but along with it came considerable streamlining of code in qolmaccount.cpp. Using std::variant to store that map also warranted converters.h to gain support for that type (even wider than toJson() that is already in dev - a non-trivial merge from dev is in order).
2022-05-16QOlmExpected and associated refactoringAlexey Rusakov
As mentioned in the commit introducing `Expected`, `QOlmExpected` is simply an alias for `Expected<T, QOlmError>`. This simplifies quite a few function signatures in `QOlm*` classes and collapses unwieldy `std::holds_alternative<>`/`std::get<>` constructs into a neat contextual bool cast and an invocation of `operator*` or `value()`/`error()` accessors that don't need to specify the type. While refactoring the code, I found a couple of cases of mismatching `uint32_t` and `qint32_t` in return values; a couple of cases where `decrypt()` returns `QString` which is in fact `QByteArray` (e.g., in `QOlmSession::decrypt()`); there's a repetitive algorithm in `Connection::Private::sessionDecryptPrekey()` and `sessionDecryptGeneral()`
2022-05-16QOlmAccount::needsSave() shouldn't be constAlexey Rusakov
Making Qt signals const is an impossible commitment - once the signal is out, you can't control if any called slot will change the emitting class or not. The code compiles but const-ness is not preserved.
2022-05-16Optimise #includes for QOlm* classesAlexey Rusakov
2022-02-16Use QHash instead of QMapAlexey Rusakov
We don't seem to need sorted associative containers in those cases.
2022-02-16CleanupAlexey Rusakov
A note on switching to QLatin1String for JSON key constants - this is more concise and barely affects (if at all) runtime performance (padding each QChar with zeros is trivial for assignment; and comparison can be done directly with the same performance as for two QStrings).
2022-02-06Update lib/e2ee/qolmaccount.cppTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2021-12-25Apply suggestionsTobias Fella
2021-12-24Apply suggestionsTobias Fella
2021-12-07Rename "crypto" -> "e2ee"Tobias Fella