diff --git a/src/chat.rs b/src/chat.rs index 87482c2d3..a26deb70c 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -5226,7 +5226,7 @@ impl Context { Blocked::Not, ProtectionStatus::Unprotected, None, - create_smeared_timestamp(self), + smeared_time(self), ) .await?; save_broadcast_shared_secret(self, chat_id, shared_secret).await?; diff --git a/src/chat/chat_tests.rs b/src/chat/chat_tests.rs index f860016d9..6158fb884 100644 --- a/src/chat/chat_tests.rs +++ b/src/chat/chat_tests.rs @@ -3099,13 +3099,14 @@ async fn test_leave_broadcast_multidevice() -> Result<()> { } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_encrypt_decrypt_broadcast_integration() -> Result<()> { +async fn test_encrypt_decrypt_broadcast() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; let bob = &tcm.bob().await; let bob_without_secret = &tcm.bob().await; let secret = "secret"; + let grpid = "grpid"; let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await; @@ -3114,19 +3115,24 @@ async fn test_encrypt_decrypt_broadcast_integration() -> Result<()> { alice, Sync, "My Channel".to_string(), - "grpid".to_string(), + grpid.to_string(), secret.to_string(), ) .await?; - add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?; + add_to_chat_contacts_table(alice, time(), alice_chat_id, &[alice_bob_contact_id]).await?; - // TODO the chat_id 10 is magical here: - bob.sql - .execute( - "INSERT INTO broadcasts_shared_secrets (chat_id, secret) VALUES (10, ?)", - (secret,), - ) - .await?; + let bob_chat_id = ChatId::create_multiuser_record( + bob, + Chattype::InBroadcast, + grpid, + "My Channel", + Blocked::Not, + ProtectionStatus::Unprotected, + None, + time(), + ) + .await?; + save_broadcast_shared_secret(bob, bob_chat_id, secret).await?; let sent = alice .send_text(alice_chat_id, "Symmetrically encrypted message") diff --git a/src/securejoin/bob.rs b/src/securejoin/bob.rs index e83d404d7..a8dee9fd3 100644 --- a/src/securejoin/bob.rs +++ b/src/securejoin/bob.rs @@ -19,7 +19,7 @@ use crate::param::Param; use crate::securejoin::{ContactId, encrypted_and_signed, verify_sender_by_fingerprint}; use crate::stock_str; use crate::sync::Sync::*; -use crate::tools::{create_smeared_timestamp, time}; +use crate::tools::{smeared_time, time}; /// Starts the securejoin protocol with the QR `invite`. /// @@ -445,7 +445,7 @@ async fn joining_chat_id( Blocked::Not, ProtectionStatus::Unprotected, // protection is added later as needed None, - create_smeared_timestamp(context), + smeared_time(context), ) .await? }