From b5d91a5cf8c4de89987fa1571750c25970feebaa Mon Sep 17 00:00:00 2001 From: Matti Viljanen Date: Sun, 14 Jul 2024 09:59:24 +0300 Subject: [PATCH] Add `Keys` sync message --- libsignal-service/src/sender.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libsignal-service/src/sender.rs b/libsignal-service/src/sender.rs index f0c8fcfd7..86315742a 100644 --- a/libsignal-service/src/sender.rs +++ b/libsignal-service/src/sender.rs @@ -752,6 +752,25 @@ where Ok(()) } + /// Send `Keys` synchronization message + #[tracing::instrument(skip(self))] + pub async fn send_keys( + &mut self, + recipient: &ServiceAddress, + keys: sync_message::Keys, + ) -> Result<(), MessageSenderError> { + let msg = SyncMessage { + keys: Some(keys), + ..SyncMessage::with_padding() + }; + + let ts = Utc::now().timestamp_millis() as u64; + self.send_message(recipient, None, msg, ts, false, false) + .await?; + + Ok(()) + } + #[tracing::instrument(level = "trace", skip(self))] fn create_pni_signature( &mut self,