Age | Commit message (Collapse) | Author |
|
It's too easy to incorrectly test the previous return type.
|
|
Too many parameters of the same type in a row.
|
|
|
|
|
|
Since this object has to be verified against a signature it also carries
there's a rather specific procedure described in The Spec for that.
That procedure basically assumes handling the signed one-time key
object as a JSON object, not as a C++ object. And originally Quotient
E2EE code was exactly like that (obtaining the right QJsonObject from
the job result and handling it as specced) but then one enthusiastic
developer (me) decided it's better to use a proper C++ structure -
breaking the verification logic along the way. After a couple attempts
to fix it, here we are again: SignedOneTimeKey is a proper QJsonObject,
and even provides a method returning its JSON in the form prepared for
verification (according to the spec).
|
|
|
|
toJson(SignedOneTimeKey) incorrectly generated a "signatures" key
mapped to an empty object when no signatures were in the C++ value.
Also: fallback keys have an additional flag that also has to be taken
into account when verifying signatures.
|
|
|
|
This pertains to QUO_IMPLICIT and DECL_DEPRECATED_ENUMERATOR - both can
be used with no connection to Qt meta-type system (which is what
quotient_common.h is for).
|
|
make_array() has been introduced to cover for shortcomings on macOS and
Windows. These shortcomings are no more there, so we can just use the
standardrlibrary.
|
|
|
|
|
|
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).
|
|
Functions (Room::Private::)createOlmSession, payloadForUserDevice
and sendRoomKeyToDevices don't have a lot to do with the given Room
object but deal with quite a few things stored in Connection. This
commit moves them to Connection::Private, exposing
sendSessionKeyToDevices (the new name for sendRoomKeyToDevices) in
Connection so that Room could call it from Room::P::sendMegolmSession().
While moving these over, a few additional things were adjusted:
- more functions marked as const
- a few functions could be moved now from Connection
to Connection::Private
- false slots in Connection (such as picklingMode) are moved out of
the slots block
- keys.yml in Matrix CS API definitions has been adjusted to match
the real structure of `/claim` response (see quotient-im/matrix-spec
repo); csapi/keys.h has been regenerated accordingly.
|
|
Notably, replace a multi-level hash map with QMultiHash and factor out
Room::P::createOlmSession().
|
|
|
|
|
|
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()`
|
|
There's no particular use in letting `QOlmError` out, only to confirm
that, well, `QOlmError` is just another form of no-match.
|
|
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.
|
|
|
|
Mainly driven by clang-tidy and SonarCloud warnings (sadly, SonarCloud
doesn't store historical reports so no link can be provided here).
|
|
Add a macro to make slicing clear in the code and quiet for static
analysis.
|
|
|
|
Co-authored-by: Carl Schwan <carl@carlschwan.eu>
|
|
|
|
Make sure that the enum values correspond to the values used in the spec
and use them instead of magic constants
|
|
That's a better primitive than just exposing SupportedAlgorithms list.
|
|
We don't seem to need sorted associative containers in those cases.
|
|
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).
|
|
Also, removed Q_GADGET macros from key verification events as those
don't seem to do anything (no Q_ENUM/Q_FLAG things, namely).
|
|
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
|
|
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
|
|
|
|
|