5666 Commits

Author SHA1 Message Date
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
Jonas Platte
f47733b49d Upgrade html5gum 2024-11-07 19:09:53 -05:00
Jonas Platte
90022bd57c Upgrade thiserror 2024-11-07 19:09:50 -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
Jason Volk
8ce5d8eb87 reserve outgoing request headers
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-30 05:40:07 +00:00
strawberry
dd8b13ed2f
add unspecced r0 routes to more key endpoints
may solve https://github.com/element-hq/element-ios/issues/5974
on conduwuit

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-28 16:40:53 -04:00
strawberry
39c1addd37
implement MSC4210, add missing .m.rule.contains_user_name check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-26 15:55:42 -04:00
Jason Volk
d96d981475 Make to_cow_str() for event types public as at least some hedge against unconditional to_string().
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-25 02:44:06 +00:00
strawberry
9f6c48eea2
add MSC2815 support, query param and error codes
https://github.com/matrix-org/matrix-spec-proposals/pull/2815

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-19 18:30:44 -04:00
Neek
1c4eeb4c41 events: Add relates_to field on StickerEventContent 2024-10-19 14:59:29 -04:00
Kévin Commaille
5627c5109e federation-api: Remove KeyObject
It is unused and is actually supposed to be the same type
as `ruma_common::encryption::SignedKey`.
2024-10-19 14:59:22 -04:00
Kévin Commaille
60b92e8e1d events: Stabilize support for marked unread room account data
The unstable `com.famedly.marked_unread` room account data is still
available behind the `unstable-msc2867` cargo feature to be able to
migrate data from the unstable to the stable prefix.
2024-10-19 14:59:15 -04:00
Kévin Commaille
f0b76f2295 chore: Mention Matrix 1.12 in changelog 2024-10-19 14:59:11 -04:00
Kévin Commaille
cc1b2144ea chore: Point links to v1.12 of the spec 2024-10-19 14:59:08 -04:00
Kévin Commaille
aae40393bb xtask: Allow links to v1.12 of the spec 2024-10-19 14:59:06 -04:00
Kévin Commaille
56b400b832 api: Add MatrixVersion::V1_12 2024-10-19 14:59:02 -04:00
Kévin Commaille
1aa2eadd70 client-api: Remove RuleScope
The `global` scope is hardcoded due to a clarification in the spec.
2024-10-19 14:58:59 -04:00
Kévin Commaille
9abafb284a events: Fix indentation in changelog 2024-10-19 14:58:54 -04:00
Doug
4a5d7d0e7a events: Add filename helper methods for audio, file, image and video messages. 2024-10-19 14:58:49 -04:00
Doug
e0db68241d events: Add helpers for media captions to audio, file, image and video messages 2024-10-19 14:58:46 -04:00
Charles Hall
0286bcfa2f api: allow constructing MatrixErrorBody::NotJson 2024-10-19 14:58:44 -04:00
Charles Hall
7a8ca45bbe client-api: allow constructing ErrorBody::NotJson 2024-10-19 14:58:40 -04:00
strawberry
506b340302 add r0 endpoint to PUT /_matrix/client/r0/room_keys/keys
there's no reason to be needlessly pessimistic, they are
functionally the same.

see https://github.com/element-hq/hydrogen-web/issues/741

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-16 14:57:41 -04:00
Jason Volk
d7baeb7e5c add required_keys util to signatures
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-14 03:54:43 +00:00
Jason Volk
90fb81eabe reduce excessive cloning for verify_json
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-10 01:27:04 +00:00
Jason Volk
eb93c641ab gate ruma_common::http_headers under feature api
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-10 01:27:04 +00:00
Jason Volk
3109496a1f expose MAX_BYTES as an associated constant for identifiers
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-09 10:34:00 +00:00
Jason Volk
c434098fb1 Improve validation error for empty mxid.
Previously an empty MXID was reported as MissingLeadingSigil but a more
concise variant is just Empty.

Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-09 10:34:00 +00:00
Jason Volk
b57e03e342 impl Serialize for ContentDisposition
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-09 01:16:00 +00:00
Jason Volk
c3f21813ca impl Serialize for Mxc using Display/to_string() for now
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-09 01:16:00 +00:00
Jason Volk
f485a0265c Support let sender: &UserId = value.get("sender").try_into()?;
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-03 01:59:24 +00:00
strawberry
7f345bf39d fix building without unstable-msc2409 feature
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-02 21:52:14 -04:00
strawberry
e81ed2741b add room reporting as per MSC4151
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-01 23:49:00 -04:00
strawberry
0738b7f72d Merge remote-tracking branch 'upstream/main' into conduwuit-changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-01 10:46:37 -04:00
strawberry
e2d576677e add missing receive_ephemeral appservice registration bool as part of MSC2409
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-01 10:29:20 -04:00
Kévin Commaille
a9267360cb client-api: Add support for account locking
According to MSC3939.
2024-09-29 11:11:18 +02:00
Jonas Platte
9f8cdecae6
Upgrade outdated dependencies 2024-09-29 10:42:39 +02:00
strawberry
ade2f1daf0 Merge remote-tracking branch 'upstream/main' into conduwuit-changes 2024-09-28 17:09:18 -04:00
Kévin Commaille
b7059ddd18 federation-api: Allow old_verify_keys to be missing when deserializing ServerSigningKeys 2024-09-28 21:21:42 +02:00
Kévin Commaille
12a2e9342b client-api: Add m.get_login_token capability
According to a clarification in the spec.
2024-09-28 20:34:46 +02:00