2463 Commits

Author SHA1 Message Date
Kévin Commaille
739334ac94 events: Use rename_all rule for CancelCode
The required rename rule exists so remove the TODO and use it.
2024-12-15 02:55:19 -05:00
Kévin Commaille
2a97aa9c4e ruma-client: Fix doc tests with default features 2024-12-15 02:55:16 -05:00
Mathieu Velten
9af36342ff Add a test regarding ser/de of an UserId in a DirectUserIdentifier (#1968)
Add a test to check that a serialized UserId can be deserialized to an OwnedDirectUserIdentifier.

Also fixes Clippy failures.
2024-12-15 02:55:12 -05:00
Kévin Commaille
bc8b704e5b client-api: Add ErrorKind::ThreepidMediumNotSupported
According to MSC4178
2024-12-15 02:54:49 -05:00
strawberry
08f58cd323
alias MSC2409 receive_ephemeral to de.sorunome.msc2409.push_ephemeral
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-12-09 12:56:05 -05:00
Jason Volk
1a550585bf state-res: parallelize fetches within some loops
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 23:56:43 +00:00
Jason Volk
9c84a3be3e state-res: fetch event_auth state events in parallel
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 23:05:10 +00:00
Jason Volk
c1f5f3f20b optimize PL deserialization
add generalized map_as_vec deserializer

Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 13:43:30 +00:00
Jason Volk
771db61ee4 events: slightly rework benches
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 13:43:09 +00:00
Kévin Commaille
13a546056e chore: Remove unnecessary lifetimes 2024-11-29 17:45:04 -05:00
Kévin Commaille
99081fd7d2 client-api: Remove unwanted empty line 2024-11-29 17:45:00 -05:00
Charles Hall
bab06ed375 stateres: make separate O(n) instead of O(n^2)
This way my poor CPU only has to do ~600,000 iterations to resolve
Matrix HQ from scratch. The old algorithm required ~85,000,000,000.

As a treat, we can also drop the dependency on itertools.
2024-11-29 17:43:43 -05:00
Charles Hall
3a2ee354fc stateres: add tests for separate fn
This function has terrible perf so I want to try improving it, but I
need some examples to test against to make sure I don't break anything.
2024-11-29 17:36:48 -05:00
Kévin Commaille
9c9b1f7e93 serde: Improve docs of Raw 2024-11-29 17:36:37 -05:00
Kévin Commaille
f2b58e5e07 macros: Remove dependency to once_cell
Use OnceLock from std instead.
2024-11-29 17:36:33 -05:00
Damir Jelić
d82e2a02d5 events: Add support for MSC4171 2024-11-29 17:36:28 -05:00
Charles Hall
e31b9dd3a4 state-res: refactor tiebreaking logic for clarity 2024-11-29 17:35:08 -05:00
strawberry
97e2fb6df1
state-res: fix allow knock -> leave on same state_key and sender
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-20 22:57:53 -05:00
strawberry
d1f635764e
state-res: fix incorrect knock join_rule checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-20 19:34:39 -05:00
strawberry
82ebed457a
correct MSC3266 room_version and encryption response fields
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-20 16:30:02 -05:00
strawberry
8c323cf6e6 clarify confusing knock event auth warning
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-19 19:07:47 -05:00
Charles Hall
aff5d8532f state-res: improve tracing spans and events
slight modifications, mainly just restricting these to
debug log level to prevent incurring the overhead of
the instruments, and tiny adjustments for async state res

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-19 19:07:42 -05:00
strawberry
cf31b8798f add more missing unspecced r0 endpoints, fix silly upload_signatures struct
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-19 19:00:37 -05:00
Mathieu Velten
2ab432fba1 ruma-events: Accept any string as a key for m.direct account data 2024-11-15 12:23:29 -05:00
Jason Volk
8cade7a14f client-api: add rooms/initialSync support
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-13 01:23:17 +00:00
Jason Volk
f674006487 state-res: update benches for async
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-10 21:03:40 +00:00
Jason Volk
4546be5c8e state-res: fix changed Signatures type in bench code
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-10 20:38:13 +00:00
Jason Volk
dcf6d7e04a ensure uses of canonical-json are property gated
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-09 06:27:02 +00:00
Andy Balaam
67ffedabbf identifiers: Tweak doc tests to use fewer imports 2024-11-08 13:14:51 -05:00
Andy Balaam
8581f30075 identifiers: Fix compile errors in doctests 2024-11-08 13:14:46 -05:00
Andy Balaam
12f4a56ace identifiers: Remove 'rust' from code blocks 2024-11-08 13:14:40 -05:00
Andy Balaam
c471070933 identifiers: Improve doctest layout and use type aliases 2024-11-08 13:14:36 -05:00
Andy Balaam
9ff70228d8 identifiers: Add doc tests for algorithm and key_name 2024-11-08 13:14:33 -05:00
Andy Balaam
a765bcdd1a identifiers: Documentation for the KeyId struct 2024-11-08 13:14:30 -05:00
Andy Balaam
5db68816a9 identifiers: Make KeyId::key_name take the string after the colon, not before 2024-11-08 13:14:20 -05:00
Kévin Commaille
807b278dab federation-api: Use Signatures in more places 2024-11-08 13:13:40 -05:00
Kévin Commaille
f87f388280 events: Use Signatures in more places 2024-11-08 13:13:37 -05:00
Kévin Commaille
5ed3718310 client-api: Use Signatures in more places 2024-11-08 13:13:33 -05:00
Kévin Commaille
0d1d549cf6 encryption: Use Signatures for the key types 2024-11-08 13:13:29 -05:00
Kévin Commaille
eb57bb2797 identifiers: Fix the bounds for Clone, Serialize and Deserialize on Signatures 2024-11-08 13:13:25 -05:00
Kévin Commaille
35da79a26e identifiers: Make DeviceKeyId a type alias of KeyId 2024-11-08 13:13:19 -05:00
Kévin Commaille
7f8f89eff7 identifiers: Differentiate signing keys from device keys
Use OwnedCrossSigningKeyId, OwnedDeviceSigningKeyId and
OwnedCrossSigningOrDeviceSigningKeyId instead of OwnedDeviceKeyId
to identify signing keys.
2024-11-08 13:13:15 -05:00
Kévin Commaille
09ff0b2819 identifiers: Differentiate one-time and fallback keys from device keys
Move the `DeviceKeyAlgorithm::SignedCurve25519` into the new
`OneTimeKeyAlgorithm` type.
Add `(Owned)OneTimeKeyId` and `(Owned)OneTimeKeyName` instead of using
`(Owned)DeviceKeyId`.
2024-11-08 13:02:19 -05:00
Kévin Commaille
263ddb6545 identifiers: Improve API of Signatures
Implement `Deref` and `DerefMut` to `BTreeMap`.
Implement `From`, `Extend` and `FromIterator` from a list of
`(entity, key_identifier, value)` tuples
Rename `Signatures::insert` to `Signatures::insert_signature`
to let `Signatures::insert` dereference to `BTreeMap::insert`.
2024-11-08 12:49:57 -05:00
Kévin Commaille
ae3897cad8 identifiers: Allow to validate KeyId with any key name type
Use new trait bounds for KeyId to only allow specific types.
Change the KeyId validation to be generic over the key name type.
Remove the KeyName type and replace it with the more specific
ServerSigningKeyVersion.
2024-11-08 12:49:53 -05:00
Kévin Commaille
f753a2f326 events: Improve markdown parsing code
Loop through the events only once to detect both whether there is
markdown and whether the markdown is inline.
Fix more cases of false negatives in markdown detection, like
whitespaces that are removed or the string beginning by a backslash
escape.
2024-11-07 18:59:47 -05:00
Benjamin Kampmann
01ffae2ac2 events: Implement url previews as per MSC4095 2024-11-07 18:55:43 -05:00
Kévin Commaille
278a45aec8 events: Remove p tag around inline markdown
As recommended by the spec.
2024-11-07 18:52:56 -05:00
Charles Hall
c3fb396352 state-res: improve tracing spans and events
* Make use of tracing's structured logging features
* Change some wording to align with the spec
2024-11-07 18:52:02 -05:00
Charles Hall
35e459d86e state-res: fix tiebreaking comparisons
`node` needs to be swapped with `parent` here, otherwise the
`power_level` and `age` in a `TieBreaker` inserted on the following line
are always equal, because both sides are the values for `node` rather
than a different value of `parent` on each iteration, and so the only
thing that could possibly be different is the `event_id` because that's
correctly set to `parent`. This is why I was observing tiebreaks always
being sorted by `event_id` and experiencing incorrectly resolved states.
2024-11-07 18:42:10 -05:00