Skip to content

Commit

Permalink
Add helper to send Identity reset message (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmiddiii authored Mar 19, 2023
1 parent 11cd90b commit adc5b97
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use libsignal_service::{
attachment_cipher::decrypt_in_place,
cipher,
configuration::{ServiceConfiguration, SignalServers, SignalingKey},
content::{ContentBody, DataMessage, Metadata, SyncMessage},
content::{ContentBody, DataMessage, DataMessageFlags, Metadata, SyncMessage},
groups_v2::{Group, GroupsManager, InMemoryCredentialsCache},
messagepipe::ServiceCredentials,
models::Contact,
Expand Down Expand Up @@ -945,6 +945,22 @@ impl<C: Store> Manager<C, Registered> {
Ok(ciphertext)
}

pub async fn send_identity_reset(
&mut self,
recipient: &ServiceAddress,
timestamp: u64,
) -> Result<(), Error> {
log::trace!("Resetting identity for adress: {}", recipient.uuid);
let message = DataMessage {
flags: Some(DataMessageFlags::EndSession as u32),
..Default::default()
};

self.send_message(*recipient, message, timestamp).await?;

Ok(())
}

fn credentials(&self) -> Result<Option<ServiceCredentials>, Error> {
Ok(Some(ServiceCredentials {
uuid: Some(self.state.uuid),
Expand Down

0 comments on commit adc5b97

Please sign in to comment.