mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 08:11:24 +01:00
SSS: refactor E2EE extension like other extensions
This commit is contained in:
parent
30951cb611
commit
f5ff294c3e
1 changed files with 15 additions and 10 deletions
|
|
@ -391,8 +391,20 @@ pub(crate) async fn sync_events_v5_route(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::if_then_some_else_none)]
|
#[allow(clippy::if_then_some_else_none)]
|
||||||
let device_lists = if body.extensions.e2ee.enabled.unwrap_or(false) {
|
let e2ee = if body.extensions.e2ee.enabled == Some(true) {
|
||||||
Some(get_e2ee_data(&sender_user, globalsince, &all_joined_rooms).await?)
|
Some(sync_events::v5::response::E2EE {
|
||||||
|
device_lists: get_e2ee_data(
|
||||||
|
&sender_user,
|
||||||
|
globalsince,
|
||||||
|
&all_joined_rooms,
|
||||||
|
)
|
||||||
|
.await?,
|
||||||
|
device_one_time_keys_count: services()
|
||||||
|
.users
|
||||||
|
.count_one_time_keys(&sender_user, &sender_device)?,
|
||||||
|
// Fallback keys are not yet supported
|
||||||
|
device_unused_fallback_key_types: None,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
@ -492,14 +504,7 @@ pub(crate) async fn sync_events_v5_route(
|
||||||
rooms,
|
rooms,
|
||||||
extensions: sync_events::v5::response::Extensions {
|
extensions: sync_events::v5::response::Extensions {
|
||||||
to_device,
|
to_device,
|
||||||
e2ee: sync_events::v5::response::E2EE {
|
e2ee: e2ee.unwrap_or_default(),
|
||||||
device_lists: device_lists.unwrap_or_default(),
|
|
||||||
device_one_time_keys_count: services()
|
|
||||||
.users
|
|
||||||
.count_one_time_keys(&sender_user, &sender_device)?,
|
|
||||||
// Fallback keys are not yet supported
|
|
||||||
device_unused_fallback_key_types: None,
|
|
||||||
},
|
|
||||||
account_data: sync_events::v5::response::AccountData {
|
account_data: sync_events::v5::response::AccountData {
|
||||||
global: if body.extensions.account_data.enabled.unwrap_or(false)
|
global: if body.extensions.account_data.enabled.unwrap_or(false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue