Skip to content

Commit f0a82d3

Browse files
committed
One-time keys and fallback keys now have their own type OneTimeKeyAlgorithm
1 parent e4b5fd1 commit f0a82d3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/machine.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use js_sys::{Array, Function, JsString, Map, Promise, Set};
1313
use matrix_sdk_common::{
1414
deserialized_responses::TimelineEvent,
1515
ruma::{
16-
self, events::secret::request::SecretName, serde::Raw, DeviceKeyAlgorithm, OwnedDeviceId,
16+
self, events::secret::request::SecretName, serde::Raw, OneTimeKeyAlgorithm, OwnedDeviceId,
1717
OwnedTransactionId, OwnedUserId, UInt,
1818
},
1919
};
@@ -309,28 +309,28 @@ impl OlmMachine {
309309
) -> Result<Promise, JsError> {
310310
let to_device_events = serde_json::from_str(to_device_events)?;
311311
let changed_devices = changed_devices.inner.clone();
312-
let one_time_keys_counts: BTreeMap<DeviceKeyAlgorithm, UInt> = one_time_keys_counts
312+
let one_time_keys_counts: BTreeMap<OneTimeKeyAlgorithm, UInt> = one_time_keys_counts
313313
.entries()
314314
.into_iter()
315315
.filter_map(|js_value| {
316316
let pair = Array::from(&js_value.ok()?);
317317
let (key, value) = (
318-
DeviceKeyAlgorithm::from(pair.at(0).as_string()?),
318+
OneTimeKeyAlgorithm::from(pair.at(0).as_string()?),
319319
UInt::new(pair.at(1).as_f64()? as u64)?,
320320
);
321321

322322
Some((key, value))
323323
})
324324
.collect();
325325

326-
// Convert the unused_fallback_keys JS Set to a `Vec<DeviceKeyAlgorithm>`
327-
let unused_fallback_keys: Option<Vec<DeviceKeyAlgorithm>> =
326+
// Convert the unused_fallback_keys JS Set to a `Vec<OneTimeKeyAlgorithm>`
327+
let unused_fallback_keys: Option<Vec<OneTimeKeyAlgorithm>> =
328328
unused_fallback_keys.map(|fallback_keys| {
329329
fallback_keys
330330
.values()
331331
.into_iter()
332332
.filter_map(|js_value| {
333-
Some(DeviceKeyAlgorithm::from(js_value.ok()?.as_string()?))
333+
Some(OneTimeKeyAlgorithm::from(js_value.ok()?.as_string()?))
334334
})
335335
.collect()
336336
});

src/requests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ pub(crate) mod tests {
712712
claim_keys::v3::Request as OriginalKeysClaimRequest,
713713
upload_keys::v3::Request as OriginalKeysUploadRequest,
714714
},
715-
device_id, user_id, DeviceKeyAlgorithm,
715+
device_id, user_id, OneTimeKeyAlgorithm,
716716
};
717717
use matrix_sdk_crypto::requests::KeysQueryRequest as OriginalKeysQueryRequest;
718718
use serde_json::Value;
@@ -727,7 +727,7 @@ pub(crate) mod tests {
727727
user_id!("@alice:localhost").to_owned(),
728728
BTreeMap::from([(
729729
device_id!("ABCDEFG").to_owned(),
730-
DeviceKeyAlgorithm::SignedCurve25519,
730+
OneTimeKeyAlgorithm::SignedCurve25519,
731731
)]),
732732
)]));
733733
let request = KeysClaimRequest::try_from(("ID".to_string(), &rust_request)).unwrap();
@@ -743,7 +743,7 @@ pub(crate) mod tests {
743743
user_id!("@alice:localhost").to_owned(),
744744
BTreeMap::from([(
745745
device_id!("ABCDEFG").to_owned(),
746-
DeviceKeyAlgorithm::SignedCurve25519,
746+
OneTimeKeyAlgorithm::SignedCurve25519,
747747
)]),
748748
)]));
749749
rust_request.timeout = None;

0 commit comments

Comments
 (0)