1900 Commits

Author SHA1 Message Date
Jonas Platte
4c85fe9c78
Replace compat feature with more fine-grained compat-* features
… and document them.
2023-04-20 14:00:27 +02:00
Jonas Platte
57b7b2d0f5
Add context to compat attribute 2023-04-20 13:02:30 +02:00
Jonas Platte
89e398fd06
events: Add back relations accessors for message-like event enums 2023-04-18 11:33:54 +02:00
Jonas Platte
0bbad284f3
events: Add RoomRedactionUnsigned 2023-04-18 11:16:56 +02:00
Kévin Commaille
2bf33def5c client-api: Remove token from keys::get_keys::Request
According to a spec clarification.
2023-04-17 16:11:38 +02:00
Jonas Platte
fea6299935
Fix broken doc comment
Thanks clippy!
2023-04-12 19:19:17 +02:00
Jonas Platte
1229fa4461
events: Add FullStateEventContent::redact 2023-04-11 16:16:32 +02:00
Kévin Commaille
2ccc0323f6 push: Add support for event_property_contains push condition
According to MSC3966
2023-04-11 16:12:05 +02:00
Kévin Commaille
2e7b67bb23 push: Add support for event_property_is push condition
According to MSC3758
2023-04-11 16:12:05 +02:00
Kévin Commaille
82b4257bfe push: Split push conditions tests 2023-04-11 16:12:05 +02:00
Kévin Commaille
33fa1b48ed push: Collect a bigger subset of JSON values in FlattenedJson 2023-04-11 16:12:05 +02:00
Kévin Commaille
cdfcdecaf8 push: Move FlattenedJson to its own module 2023-04-11 16:12:05 +02:00
Kévin Commaille
c1a36a2047 client-api: Mention that backslashes should be escaped in filter event_fields
According to MSC3980
2023-04-11 11:18:20 +02:00
Kévin Commaille
ef374ea6b0 push: Escape dots and backslashes in field name for event_match condition
According to MSC3873
2023-04-11 11:18:20 +02:00
Ivan Enderlin
66f417c3f2 chore: Make Clippy happy. 2023-04-06 14:51:25 +02:00
Ivan Enderlin
fe3a8ff669 feat(client-api): Support bump_event_types in sync::sync_events::v4::Request.
This patch updates `sync::sync_events::v4::Request` to add the new
`bump_event_types` field, as described in [MSC3575] (more precisely in
this [diff]).

That's the first step to address https://github.com/matrix-org/matrix-rust-sdk/issues/1728.

[MSC3575]: https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md
[diff]: 35b79f6ebe...5bd13e66df (diff-1f7276cbbee4eeaaca06b07d2fe58312eab735259f2490e28e04710dde77fdccL78)
2023-04-06 14:51:25 +02:00
Jonas Platte
e61e0ccf6b
Implement MSC3925
… without a feature flag because it is a breaking change, so the feature
would have to be non-additive, which is a no-go.
Limited support for the previous replacement format is kept.
2023-03-15 14:49:51 +01:00
Jonas Platte
19d44489c3
events: Split bundled relations into two types
One for message-like events, one for state events.
2023-03-15 14:49:49 +01:00
Jonas Platte
0599eb1226
macros: Fix confusing name of local bindings 2023-03-15 12:33:09 +01:00
Jonas Platte
f79c51f18f
Fix a typo 2023-03-15 11:07:27 +01:00
Kévin Commaille
8eea3e0549 push: Enable by default .m.rule.tombstone push rule
As defined in the spec.
2023-03-14 12:01:40 +01:00
Kévin Commaille
27a2c07df9 events: Add constants for the verification requests timeouts 2023-03-13 17:12:49 +01:00
Kévin Commaille
a399a4017a
push: Add convenience methods to check if an action triggers a notification or a sound 2023-03-13 13:54:22 +01:00
Kévin Commaille
b6717bc2ea
push: Add convenience method to check if an action is a highlight tweak 2023-03-13 13:36:56 +01:00
Jonas Platte
03a58bcd88
Fix return type of InitialStateEvent::to_raw_any 2023-03-10 12:51:58 +01:00
Jonas Platte
1af28486cc events: Implement Default for EmptyStateKey 2023-03-10 12:33:55 +01:00
Jonas Platte
4049969d8c events: Implement Default for InitialStateEvent
… where C has an empty state key and implements Default itself.
2023-03-10 12:33:55 +01:00
Kévin Commaille
d56386a636 events: Add link to definition of m.room.encryption recommended defaults 2023-03-10 11:41:53 +01:00
Kévin Commaille
8a3bccaef1 client-api: Fix type of rank in search::search_events::v3::SearchResult
It is defined in the spec as a number, not an integer.
2023-03-10 11:19:32 +01:00
Kévin Commaille
0596e46045 events: Add method to construct RoomEncryptionEventContent with the recommended defaults 2023-03-10 11:13:37 +01:00
Jonas Platte
25be562036
Update trybuild output 2023-03-10 10:59:52 +01:00
Jonas Platte
4eb5033dd0
events: Add utility functions for InitialStateEvent 2023-03-09 18:58:56 +01:00
kegsay
543c03f8f2
client-api: Use the right EDU types in sliding sync 2023-03-08 13:28:53 +01:00
Jonas Platte
01acabe8a6
identifiers: Implement AsRef<[u8]> for owned ID types 2023-03-07 11:18:14 +01:00
Jonas Platte
5aa0f29935
identifiers: Add AsRef<[u8]> impls for ID types 2023-03-07 11:06:34 +01:00
kegsay
471c46273a
client-api: Fix typo in sliding sync extensions
It has always been `receipts` not `receipt`.
2023-03-06 18:42:03 +01:00
Kévin Commaille
44daf84e46 client-api: Allow to convert AnyPushRule(Ref) to PushRule 2023-03-02 11:30:48 +01:00
Kévin Commaille
ba296ec466 push: Add method to remove a user-defined push rule from a Ruleset 2023-03-02 11:30:48 +01:00
Kévin Commaille
a78d2a7dcf push: Add method to update server-default push rules 2023-03-02 11:30:48 +01:00
Kévin Commaille
c44e0b5e5a push: Fix ordering of docs 2023-03-02 11:30:48 +01:00
gnieto
7565588be7
signatures: Prevent accepting events without at least one valid signature
`verify_event` has been changed recently to be more aligned with the
spec. In the previous algorithm, it returned an error if the event was
not signed by at least one of the required entities.

The new algortihm is iterating over all the signtures for the required
entities *and* skipping unknown algorithms. If an event is signed only
by unkonwn algorithms, the event would be accepted and not verifications
will happen. In order to prevent that, we check that, at least, a single
key is checked. This covers the 2nd point in: https://spec.matrix.org/v1.6/appendices/#checking-for-a-signature

A few more test cases were added:

- The event is properly signed, but key map contains a key with an
  unknown algorithm. Under this circumstances, the event should be
  allowed.
- An event signed by multiple keys for an entity, should verify all
  those signatures
- An event signed by a single key with an unkown algorithm by the
  required entity, should fail
2023-03-02 09:34:57 +00:00
Jason Volk
87237bf100 signatures: Comply with the specified signature checking algorithm.
Based on research https://github.com/ruma/ruma/pull/1491#issuecomment-1445042510 by @zecakeh
2023-03-01 22:25:06 +01:00
Jason Volk
920a412da1 signatures: Skip keys which don't split so other keys can be used instead. 2023-03-01 22:25:06 +01:00
Ivan Enderlin
2edfe5bc5f
client-api: Add missing sync::sync_events::v4::Response::txn_id field
In the [specification], if the request contains a `txn_id` value, the response
must echo the same `txn_id`. Unfortunately, this field is missing from
`sync::sync_events::v4::Response::txn_id`. This patch addresses that problem by
adding the missing field.

[specification]: 89cf0341b5/proposals/3575-sync.md
2023-03-01 09:02:53 +00:00
Jason Volk
bcb97b139d
signatures: Allow additional key version-string characters in compat mode
This complies with the published specification by default, with optional compatibility for additional federation keys in use.

Co-authored-by: Jonathan de Jong <jonathan@automatia.nl>
2023-03-01 09:54:38 +01:00
Jonas Platte
f9a40e137e
events: Remove reaction bundling
It was removed from the MSC.
https://github.com/matrix-org/matrix-spec-proposals/pull/2677
2023-02-28 20:01:04 +01:00
Kévin Commaille
cc47a7268b events: Updates location event types
Even if the MSC hasn't been updated, refactor a bit to match other
extensible events types.
2023-02-27 20:28:38 +01:00
Kévin Commaille
61c23491c6 events: Update types according to changes in MSC3381 2023-02-27 20:28:38 +01:00
Kévin Commaille
fbf99fcc53 events: Update types according to changes in MSC3554 2023-02-27 20:28:38 +01:00
Kévin Commaille
08aa2ca04c events: Update types according to changes in MSC3245 2023-02-27 20:28:38 +01:00