Merge branch 'deps-and-stuff'
commit
c1ae183795
|
@ -49,7 +49,6 @@ async-trait = "0.1.36"
|
||||||
dirs = "3.0.1"
|
dirs = "3.0.1"
|
||||||
matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" }
|
matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" }
|
||||||
tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
|
tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
|
||||||
ruma-identifiers = { version = "0.16.2", features = ["rand"] }
|
|
||||||
serde_json = "1.0.56"
|
serde_json = "1.0.56"
|
||||||
tracing-subscriber = "0.2.7"
|
tracing-subscriber = "0.2.7"
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
|
|
@ -30,8 +30,7 @@ impl EventEmitter for AutoJoinBot {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
match room {
|
if let SyncRoom::Invited(room) = room {
|
||||||
SyncRoom::Invited(room) => {
|
|
||||||
let room = room.read().await;
|
let room = room.read().await;
|
||||||
println!("Autojoining room {}", room.display_name());
|
println!("Autojoining room {}", room.display_name());
|
||||||
self.client
|
self.client
|
||||||
|
@ -39,8 +38,6 @@ impl EventEmitter for AutoJoinBot {
|
||||||
.await
|
.await
|
||||||
.expect("Can't join room");
|
.expect("Can't join room");
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" }
|
||||||
http = "0.2.1"
|
http = "0.2.1"
|
||||||
tracing-subscriber = "0.2.7"
|
tracing-subscriber = "0.2.7"
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
mockito = "0.25.1"
|
mockito = "0.26.0"
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||||
tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
|
tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
|
||||||
|
|
|
@ -727,8 +727,8 @@ impl BaseClient {
|
||||||
let mut olm = self.olm.lock().await;
|
let mut olm = self.olm.lock().await;
|
||||||
|
|
||||||
if let Some(o) = &mut *olm {
|
if let Some(o) = &mut *olm {
|
||||||
if let Some(decrypted) =
|
if let Ok(decrypted) =
|
||||||
o.decrypt_room_event(&encrypted_event, room_id).await.ok()
|
o.decrypt_room_event(&encrypted_event, room_id).await
|
||||||
{
|
{
|
||||||
if let Ok(d) = decrypted.deserialize() {
|
if let Ok(d) = decrypted.deserialize() {
|
||||||
e = d
|
e = d
|
||||||
|
@ -890,9 +890,9 @@ impl BaseClient {
|
||||||
///
|
///
|
||||||
/// * `event` - The presence event for a specified room member.
|
/// * `event` - The presence event for a specified room member.
|
||||||
pub async fn receive_account_data_event(&self, _: &RoomId, event: &AnyBasicEvent) -> bool {
|
pub async fn receive_account_data_event(&self, _: &RoomId, event: &AnyBasicEvent) -> bool {
|
||||||
match &event {
|
match event {
|
||||||
AnyBasicEvent::IgnoredUserList(event) => self.handle_ignored_users(&event).await,
|
AnyBasicEvent::IgnoredUserList(event) => self.handle_ignored_users(event).await,
|
||||||
AnyBasicEvent::PushRules(event) => self.handle_push_rules(&event).await,
|
AnyBasicEvent::PushRules(event) => self.handle_push_rules(event).await,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -907,7 +907,7 @@ impl BaseClient {
|
||||||
///
|
///
|
||||||
/// * `event` - The presence event for a specified room member.
|
/// * `event` - The presence event for a specified room member.
|
||||||
pub async fn receive_ephemeral_event(&self, event: &AnyEphemeralRoomEventStub) -> bool {
|
pub async fn receive_ephemeral_event(&self, event: &AnyEphemeralRoomEventStub) -> bool {
|
||||||
match &event {
|
match event {
|
||||||
AnyEphemeralRoomEventStub::FullyRead(_) => {}
|
AnyEphemeralRoomEventStub::FullyRead(_) => {}
|
||||||
AnyEphemeralRoomEventStub::Receipt(_) => {}
|
AnyEphemeralRoomEventStub::Receipt(_) => {}
|
||||||
AnyEphemeralRoomEventStub::Typing(_) => {}
|
AnyEphemeralRoomEventStub::Typing(_) => {}
|
||||||
|
@ -1471,44 +1471,42 @@ impl BaseClient {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
match &event {
|
match event {
|
||||||
AnyRoomEventStub::State(event) => match &event {
|
AnyRoomEventStub::State(event) => match event {
|
||||||
AnyStateEventStub::RoomMember(e) => event_emitter.on_room_member(room, &e).await,
|
AnyStateEventStub::RoomMember(e) => event_emitter.on_room_member(room, e).await,
|
||||||
AnyStateEventStub::RoomName(e) => event_emitter.on_room_name(room, &e).await,
|
AnyStateEventStub::RoomName(e) => event_emitter.on_room_name(room, e).await,
|
||||||
AnyStateEventStub::RoomCanonicalAlias(e) => {
|
AnyStateEventStub::RoomCanonicalAlias(e) => {
|
||||||
event_emitter.on_room_canonical_alias(room, &e).await
|
event_emitter.on_room_canonical_alias(room, e).await
|
||||||
}
|
}
|
||||||
AnyStateEventStub::RoomAliases(e) => event_emitter.on_room_aliases(room, &e).await,
|
AnyStateEventStub::RoomAliases(e) => event_emitter.on_room_aliases(room, e).await,
|
||||||
AnyStateEventStub::RoomAvatar(e) => event_emitter.on_room_avatar(room, &e).await,
|
AnyStateEventStub::RoomAvatar(e) => event_emitter.on_room_avatar(room, e).await,
|
||||||
AnyStateEventStub::RoomPowerLevels(e) => {
|
AnyStateEventStub::RoomPowerLevels(e) => {
|
||||||
event_emitter.on_room_power_levels(room, &e).await
|
event_emitter.on_room_power_levels(room, e).await
|
||||||
}
|
}
|
||||||
AnyStateEventStub::RoomTombstone(e) => {
|
AnyStateEventStub::RoomTombstone(e) => {
|
||||||
event_emitter.on_room_tombstone(room, &e).await
|
event_emitter.on_room_tombstone(room, e).await
|
||||||
}
|
}
|
||||||
AnyStateEventStub::RoomJoinRules(e) => {
|
AnyStateEventStub::RoomJoinRules(e) => {
|
||||||
event_emitter.on_room_join_rules(room, &e).await
|
event_emitter.on_room_join_rules(room, e).await
|
||||||
}
|
}
|
||||||
AnyStateEventStub::Custom(e) => {
|
AnyStateEventStub::Custom(e) => {
|
||||||
event_emitter
|
event_emitter
|
||||||
.on_unrecognized_event(room, &CustomOrRawEvent::State(&e))
|
.on_unrecognized_event(room, &CustomOrRawEvent::State(e))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
AnyRoomEventStub::Message(event) => match &event {
|
AnyRoomEventStub::Message(event) => match event {
|
||||||
AnyMessageEventStub::RoomMessage(e) => {
|
AnyMessageEventStub::RoomMessage(e) => event_emitter.on_room_message(room, e).await,
|
||||||
event_emitter.on_room_message(room, &e).await
|
|
||||||
}
|
|
||||||
AnyMessageEventStub::RoomMessageFeedback(e) => {
|
AnyMessageEventStub::RoomMessageFeedback(e) => {
|
||||||
event_emitter.on_room_message_feedback(room, &e).await
|
event_emitter.on_room_message_feedback(room, e).await
|
||||||
}
|
}
|
||||||
AnyMessageEventStub::RoomRedaction(e) => {
|
AnyMessageEventStub::RoomRedaction(e) => {
|
||||||
event_emitter.on_room_redaction(room, e).await
|
event_emitter.on_room_redaction(room, e).await
|
||||||
}
|
}
|
||||||
AnyMessageEventStub::Custom(e) => {
|
AnyMessageEventStub::Custom(e) => {
|
||||||
event_emitter
|
event_emitter
|
||||||
.on_unrecognized_event(room, &CustomOrRawEvent::Message(&e))
|
.on_unrecognized_event(room, &CustomOrRawEvent::Message(e))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
@ -46,7 +46,7 @@ use crate::events::{
|
||||||
|
|
||||||
use crate::identifiers::{RoomAliasId, RoomId, UserId};
|
use crate::identifiers::{RoomAliasId, RoomId, UserId};
|
||||||
|
|
||||||
use crate::js_int::{Int, UInt};
|
use crate::js_int::{uint, Int, UInt};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(feature = "messages")]
|
#[cfg(feature = "messages")]
|
||||||
|
@ -250,16 +250,10 @@ impl RoomName {
|
||||||
} else if !self.aliases.is_empty() && !self.aliases[0].alias().is_empty() {
|
} else if !self.aliases.is_empty() && !self.aliases[0].alias().is_empty() {
|
||||||
self.aliases[0].alias().trim().to_string()
|
self.aliases[0].alias().trim().to_string()
|
||||||
} else {
|
} else {
|
||||||
let joined = self.joined_member_count.unwrap_or(UInt::MIN);
|
let joined = self.joined_member_count.unwrap_or(uint!(0));
|
||||||
let invited = self.invited_member_count.unwrap_or(UInt::MIN);
|
let invited = self.invited_member_count.unwrap_or(uint!(0));
|
||||||
let heroes = UInt::new(self.heroes.len() as u64).unwrap();
|
let heroes = UInt::new(self.heroes.len() as u64).unwrap();
|
||||||
let one = UInt::new(1).unwrap();
|
let invited_joined = (invited + joined).saturating_sub(uint!(1));
|
||||||
|
|
||||||
let invited_joined = if invited + joined == UInt::MIN {
|
|
||||||
UInt::MIN
|
|
||||||
} else {
|
|
||||||
invited + joined - one
|
|
||||||
};
|
|
||||||
|
|
||||||
let members = joined_members.values().chain(invited_members.values());
|
let members = joined_members.values().chain(invited_members.values());
|
||||||
|
|
||||||
|
@ -277,7 +271,7 @@ impl RoomName {
|
||||||
// stabilize ordering
|
// stabilize ordering
|
||||||
names.sort();
|
names.sort();
|
||||||
names.join(", ")
|
names.join(", ")
|
||||||
} else if heroes < invited_joined && invited + joined > one {
|
} else if heroes < invited_joined && invited + joined > uint!(1) {
|
||||||
let mut names = members
|
let mut names = members
|
||||||
.filter(|m| m.user_id != *own_user_id)
|
.filter(|m| m.user_id != *own_user_id)
|
||||||
.take(3)
|
.take(3)
|
||||||
|
@ -752,27 +746,27 @@ impl Room {
|
||||||
///
|
///
|
||||||
/// * `event` - The event of the room.
|
/// * `event` - The event of the room.
|
||||||
pub fn receive_timeline_event(&mut self, event: &AnyRoomEventStub) -> bool {
|
pub fn receive_timeline_event(&mut self, event: &AnyRoomEventStub) -> bool {
|
||||||
match &event {
|
match event {
|
||||||
AnyRoomEventStub::State(event) => match &event {
|
AnyRoomEventStub::State(event) => match event {
|
||||||
// update to the current members of the room
|
// update to the current members of the room
|
||||||
AnyStateEventStub::RoomMember(event) => self.handle_membership(&event),
|
AnyStateEventStub::RoomMember(event) => self.handle_membership(event),
|
||||||
// finds all events related to the name of the room for later use
|
// finds all events related to the name of the room for later use
|
||||||
AnyStateEventStub::RoomName(event) => self.handle_room_name(&event),
|
AnyStateEventStub::RoomName(event) => self.handle_room_name(event),
|
||||||
AnyStateEventStub::RoomCanonicalAlias(event) => self.handle_canonical(&event),
|
AnyStateEventStub::RoomCanonicalAlias(event) => self.handle_canonical(event),
|
||||||
AnyStateEventStub::RoomAliases(event) => self.handle_room_aliases(&event),
|
AnyStateEventStub::RoomAliases(event) => self.handle_room_aliases(event),
|
||||||
// power levels of the room members
|
// power levels of the room members
|
||||||
AnyStateEventStub::RoomPowerLevels(event) => self.handle_power_level(&event),
|
AnyStateEventStub::RoomPowerLevels(event) => self.handle_power_level(event),
|
||||||
AnyStateEventStub::RoomTombstone(event) => self.handle_tombstone(&event),
|
AnyStateEventStub::RoomTombstone(event) => self.handle_tombstone(event),
|
||||||
AnyStateEventStub::RoomEncryption(event) => self.handle_encryption_event(&event),
|
AnyStateEventStub::RoomEncryption(event) => self.handle_encryption_event(event),
|
||||||
_ => false,
|
_ => false,
|
||||||
},
|
},
|
||||||
AnyRoomEventStub::Message(event) => match &event {
|
AnyRoomEventStub::Message(event) => match event {
|
||||||
#[cfg(feature = "messages")]
|
#[cfg(feature = "messages")]
|
||||||
// We ignore this variants event because `handle_message` takes the enum
|
// We ignore this variants event because `handle_message` takes the enum
|
||||||
// to store AnyMessageEventStub events in the `MessageQueue`.
|
// to store AnyMessageEventStub events in the `MessageQueue`.
|
||||||
AnyMessageEventStub::RoomMessage(_) => self.handle_message(&event),
|
AnyMessageEventStub::RoomMessage(_) => self.handle_message(event),
|
||||||
#[cfg(feature = "messages")]
|
#[cfg(feature = "messages")]
|
||||||
AnyMessageEventStub::RoomRedaction(event) => self.handle_redaction(&event),
|
AnyMessageEventStub::RoomRedaction(event) => self.handle_redaction(event),
|
||||||
_ => false,
|
_ => false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -810,7 +804,7 @@ impl Room {
|
||||||
/// * `event` - The `AnyStrippedStateEvent` sent by the server for invited but not
|
/// * `event` - The `AnyStrippedStateEvent` sent by the server for invited but not
|
||||||
/// joined rooms.
|
/// joined rooms.
|
||||||
pub fn receive_stripped_state_event(&mut self, event: &AnyStrippedStateEventStub) -> bool {
|
pub fn receive_stripped_state_event(&mut self, event: &AnyStrippedStateEventStub) -> bool {
|
||||||
match &event {
|
match event {
|
||||||
AnyStrippedStateEventStub::RoomName(event) => self.handle_stripped_room_name(event),
|
AnyStrippedStateEventStub::RoomName(event) => self.handle_stripped_room_name(event),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
@ -1094,13 +1088,10 @@ mod test {
|
||||||
assert!(room.power_levels.is_some());
|
assert!(room.power_levels.is_some());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
room.power_levels.as_ref().unwrap().kick,
|
room.power_levels.as_ref().unwrap().kick,
|
||||||
crate::js_int::Int::new(50).unwrap()
|
crate::js_int::int!(50)
|
||||||
);
|
);
|
||||||
let admin = room.joined_members.get(&user_id).unwrap();
|
let admin = room.joined_members.get(&user_id).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(admin.power_level.unwrap(), crate::js_int::int!(100));
|
||||||
admin.power_level.unwrap(),
|
|
||||||
crate::js_int::Int::new(100).unwrap()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[async_test]
|
||||||
|
|
|
@ -23,7 +23,7 @@ use crate::events::room::{
|
||||||
use crate::events::StateEventStub;
|
use crate::events::StateEventStub;
|
||||||
use crate::identifiers::{RoomId, UserId};
|
use crate::identifiers::{RoomId, UserId};
|
||||||
|
|
||||||
use crate::js_int::{Int, UInt};
|
use crate::js_int::{int, Int, UInt};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
// Notes: if Alice invites Bob into a room we will get an event with the sender as Alice and the state key as Bob.
|
// Notes: if Alice invites Bob into a room we will get an event with the sender as Alice and the state key as Bob.
|
||||||
|
|
||||||
|
@ -143,8 +143,8 @@ impl RoomMember {
|
||||||
self.power_level = Some(event.content.users_default);
|
self.power_level = Some(event.content.users_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
if max_power > Int::from(0) {
|
if max_power > int!(0) {
|
||||||
self.power_level_norm = Some((self.power_level.unwrap() * Int::from(100)) / max_power);
|
self.power_level_norm = Some((self.power_level.unwrap() * int!(100)) / max_power);
|
||||||
}
|
}
|
||||||
|
|
||||||
changed
|
changed
|
||||||
|
@ -216,7 +216,7 @@ mod test {
|
||||||
use crate::identifiers::{RoomId, UserId};
|
use crate::identifiers::{RoomId, UserId};
|
||||||
use crate::{BaseClient, Session};
|
use crate::{BaseClient, Session};
|
||||||
|
|
||||||
use crate::js_int::Int;
|
use crate::js_int::int;
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
@ -258,7 +258,7 @@ mod test {
|
||||||
.joined_members
|
.joined_members
|
||||||
.get(&UserId::try_from("@example:localhost").unwrap())
|
.get(&UserId::try_from("@example:localhost").unwrap())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(member.power_level, Int::new(100));
|
assert_eq!(member.power_level, Some(int!(100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[async_test]
|
||||||
|
@ -283,7 +283,7 @@ mod test {
|
||||||
.get(&UserId::try_from("@example:localhost").unwrap())
|
.get(&UserId::try_from("@example:localhost").unwrap())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(member.power_level, Int::new(100));
|
assert_eq!(member.power_level, Some(int!(100)));
|
||||||
|
|
||||||
assert!(member.avatar_url.is_none());
|
assert!(member.avatar_url.is_none());
|
||||||
assert_eq!(member.last_active_ago, None);
|
assert_eq!(member.last_active_ago, None);
|
||||||
|
|
|
@ -12,7 +12,7 @@ version = "0.1.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
instant = { version = "0.1.4", features = ["wasm-bindgen", "now"] }
|
instant = { version = "0.1.4", features = ["wasm-bindgen", "now"] }
|
||||||
js_int = "0.1.5"
|
js_int = "0.1.8"
|
||||||
|
|
||||||
[dependencies.ruma]
|
[dependencies.ruma]
|
||||||
git = "https://github.com/ruma/ruma"
|
git = "https://github.com/ruma/ruma"
|
||||||
|
|
|
@ -46,7 +46,6 @@ features = ["runtime-tokio", "sqlite"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
|
tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
|
||||||
ruma-identifiers = { version = "0.16.2", features = ["rand"] }
|
|
||||||
serde_json = "1.0.56"
|
serde_json = "1.0.56"
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
http = "0.2.1"
|
http = "0.2.1"
|
||||||
|
|
|
@ -1333,7 +1333,7 @@ impl OlmMachine {
|
||||||
|
|
||||||
match &event {
|
match &event {
|
||||||
AnyToDeviceEvent::RoomEncrypted(e) => {
|
AnyToDeviceEvent::RoomEncrypted(e) => {
|
||||||
let decrypted_event = match self.decrypt_to_device_event(&e).await {
|
let decrypted_event = match self.decrypt_to_device_event(e).await {
|
||||||
Ok(e) => e,
|
Ok(e) => e,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(
|
warn!(
|
||||||
|
@ -1350,7 +1350,7 @@ impl OlmMachine {
|
||||||
// before we replace the result.
|
// before we replace the result.
|
||||||
*event_result = decrypted_event;
|
*event_result = decrypted_event;
|
||||||
}
|
}
|
||||||
AnyToDeviceEvent::RoomKeyRequest(e) => self.handle_room_key_request(&e),
|
AnyToDeviceEvent::RoomKeyRequest(e) => self.handle_room_key_request(e),
|
||||||
AnyToDeviceEvent::KeyVerificationAccept(..)
|
AnyToDeviceEvent::KeyVerificationAccept(..)
|
||||||
| AnyToDeviceEvent::KeyVerificationCancel(..)
|
| AnyToDeviceEvent::KeyVerificationCancel(..)
|
||||||
| AnyToDeviceEvent::KeyVerificationKey(..)
|
| AnyToDeviceEvent::KeyVerificationKey(..)
|
||||||
|
@ -1485,9 +1485,10 @@ impl OlmMachine {
|
||||||
mod test {
|
mod test {
|
||||||
static USER_ID: &str = "@bob:example.org";
|
static USER_ID: &str = "@bob:example.org";
|
||||||
|
|
||||||
use matrix_sdk_common::js_int::UInt;
|
use matrix_sdk_common::js_int::uint;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
use std::convert::TryInto;
|
||||||
use std::sync::atomic::AtomicU64;
|
use std::sync::atomic::AtomicU64;
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
|
@ -1681,20 +1682,18 @@ mod test {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(machine.should_upload_keys().await);
|
assert!(machine.should_upload_keys().await);
|
||||||
|
|
||||||
response.one_time_key_counts.insert(
|
response
|
||||||
keys::KeyAlgorithm::SignedCurve25519,
|
.one_time_key_counts
|
||||||
UInt::try_from(10).unwrap(),
|
.insert(keys::KeyAlgorithm::SignedCurve25519, uint!(10));
|
||||||
);
|
|
||||||
machine
|
machine
|
||||||
.receive_keys_upload_response(&response)
|
.receive_keys_upload_response(&response)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(machine.should_upload_keys().await);
|
assert!(machine.should_upload_keys().await);
|
||||||
|
|
||||||
response.one_time_key_counts.insert(
|
response
|
||||||
keys::KeyAlgorithm::SignedCurve25519,
|
.one_time_key_counts
|
||||||
UInt::try_from(50).unwrap(),
|
.insert(keys::KeyAlgorithm::SignedCurve25519, uint!(50));
|
||||||
);
|
|
||||||
machine
|
machine
|
||||||
.receive_keys_upload_response(&response)
|
.receive_keys_upload_response(&response)
|
||||||
.await
|
.await
|
||||||
|
@ -1718,10 +1717,9 @@ mod test {
|
||||||
assert!(machine.should_upload_keys().await);
|
assert!(machine.should_upload_keys().await);
|
||||||
assert!(machine.generate_one_time_keys().await.is_ok());
|
assert!(machine.generate_one_time_keys().await.is_ok());
|
||||||
|
|
||||||
response.one_time_key_counts.insert(
|
response
|
||||||
keys::KeyAlgorithm::SignedCurve25519,
|
.one_time_key_counts
|
||||||
UInt::try_from(50).unwrap(),
|
.insert(keys::KeyAlgorithm::SignedCurve25519, uint!(50));
|
||||||
);
|
|
||||||
machine
|
machine
|
||||||
.receive_keys_upload_response(&response)
|
.receive_keys_upload_response(&response)
|
||||||
.await
|
.await
|
||||||
|
@ -1829,7 +1827,7 @@ mod test {
|
||||||
let mut response = keys_upload_response();
|
let mut response = keys_upload_response();
|
||||||
response.one_time_key_counts.insert(
|
response.one_time_key_counts.insert(
|
||||||
keys::KeyAlgorithm::SignedCurve25519,
|
keys::KeyAlgorithm::SignedCurve25519,
|
||||||
UInt::new_wrapping(one_time_keys.unwrap().len() as u64),
|
(one_time_keys.unwrap().len() as u64).try_into().unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
machine
|
machine
|
||||||
|
|
Loading…
Reference in New Issue