@@ -436,31 +436,6 @@ impl OlmMachine {
436
436
}
437
437
}
438
438
439
- /// Should device or one-time keys be uploaded to the server.
440
- ///
441
- /// This needs to be checked periodically, ideally after every sync request.
442
- ///
443
- /// # Example
444
- ///
445
- /// ```
446
- /// # use std::convert::TryFrom;
447
- /// # use matrix_sdk_crypto::OlmMachine;
448
- /// # use ruma::{user_id, device_id};
449
- /// # use futures::executor::block_on;
450
- /// # let alice = user_id!("@alice:example.org");
451
- /// # let machine = OlmMachine::new(alice, device_id!("DEVICEID"));
452
- /// # block_on(async {
453
- /// if machine.should_upload_keys().await {
454
- /// // Upload the keys here.
455
- /// }
456
- /// # });
457
- /// ```
458
- #[ cfg( any( test, feature = "testing" ) ) ]
459
- #[ allow( dead_code) ]
460
- async fn should_upload_keys ( & self ) -> bool {
461
- self . account . should_upload_keys ( ) . await
462
- }
463
-
464
439
/// Get the underlying Olm account of the machine.
465
440
#[ cfg( any( test, feature = "testing" ) ) ]
466
441
#[ allow( dead_code) ]
@@ -1710,7 +1685,7 @@ pub(crate) mod test {
1710
1685
#[ async_test]
1711
1686
async fn create_olm_machine ( ) {
1712
1687
let machine = OlmMachine :: new ( user_id ( ) , alice_device_id ( ) ) ;
1713
- assert ! ( machine. should_upload_keys( ) . await ) ;
1688
+ assert ! ( machine. account ( ) . should_upload_keys( ) . await ) ;
1714
1689
}
1715
1690
1716
1691
#[ async_test]
@@ -1720,21 +1695,21 @@ pub(crate) mod test {
1720
1695
1721
1696
response. one_time_key_counts . remove ( & DeviceKeyAlgorithm :: SignedCurve25519 ) . unwrap ( ) ;
1722
1697
1723
- assert ! ( machine. should_upload_keys( ) . await ) ;
1698
+ assert ! ( machine. account ( ) . should_upload_keys( ) . await ) ;
1724
1699
machine. receive_keys_upload_response ( & response) . await . unwrap ( ) ;
1725
- assert ! ( machine. should_upload_keys( ) . await ) ;
1700
+ assert ! ( machine. account ( ) . should_upload_keys( ) . await ) ;
1726
1701
1727
1702
response. one_time_key_counts . insert ( DeviceKeyAlgorithm :: SignedCurve25519 , uint ! ( 10 ) ) ;
1728
1703
machine. receive_keys_upload_response ( & response) . await . unwrap ( ) ;
1729
- assert ! ( machine. should_upload_keys( ) . await ) ;
1704
+ assert ! ( machine. account ( ) . should_upload_keys( ) . await ) ;
1730
1705
1731
1706
response. one_time_key_counts . insert ( DeviceKeyAlgorithm :: SignedCurve25519 , uint ! ( 50 ) ) ;
1732
1707
machine. receive_keys_upload_response ( & response) . await . unwrap ( ) ;
1733
- assert ! ( !machine. should_upload_keys( ) . await ) ;
1708
+ assert ! ( !machine. account ( ) . should_upload_keys( ) . await ) ;
1734
1709
1735
1710
response. one_time_key_counts . remove ( & DeviceKeyAlgorithm :: SignedCurve25519 ) ;
1736
1711
machine. receive_keys_upload_response ( & response) . await . unwrap ( ) ;
1737
- assert ! ( !machine. should_upload_keys( ) . await ) ;
1712
+ assert ! ( !machine. account ( ) . should_upload_keys( ) . await ) ;
1738
1713
}
1739
1714
1740
1715
#[ async_test]
@@ -1743,10 +1718,10 @@ pub(crate) mod test {
1743
1718
1744
1719
let mut response = keys_upload_response ( ) ;
1745
1720
1746
- assert ! ( machine. should_upload_keys( ) . await ) ;
1721
+ assert ! ( machine. account ( ) . should_upload_keys( ) . await ) ;
1747
1722
1748
1723
machine. receive_keys_upload_response ( & response) . await . unwrap ( ) ;
1749
- assert ! ( machine. should_upload_keys( ) . await ) ;
1724
+ assert ! ( machine. account ( ) . should_upload_keys( ) . await ) ;
1750
1725
assert ! ( machine. account. generate_one_time_keys( ) . await . is_ok( ) ) ;
1751
1726
1752
1727
response. one_time_key_counts . insert ( DeviceKeyAlgorithm :: SignedCurve25519 , uint ! ( 50 ) ) ;
0 commit comments