pub struct Signal<'a> { /* private fields */ }Expand description
Feature handle for Signal protocol operations.
Implementations§
Source§impl<'a> Signal<'a>
impl<'a> Signal<'a>
Sourcepub async fn encrypt_message(
&self,
jid: &Jid,
plaintext: &[u8],
) -> Result<(EncType, Vec<u8>)>
pub async fn encrypt_message( &self, jid: &Jid, plaintext: &[u8], ) -> Result<(EncType, Vec<u8>)>
Encrypt plaintext for a single recipient using the Signal protocol.
Returns (EncType, ciphertext_bytes). The caller is responsible
for padding if needed; this method encrypts raw bytes.
PN JIDs are resolved to LID when a LID session exists, matching the internal send path.
Sourcepub async fn decrypt_message(
&self,
jid: &Jid,
enc_type: EncType,
ciphertext: &[u8],
) -> Result<Vec<u8>>
pub async fn decrypt_message( &self, jid: &Jid, enc_type: EncType, ciphertext: &[u8], ) -> Result<Vec<u8>>
Decrypt a Signal protocol message from a sender.
Returns raw padded plaintext. Use MessageUtils::unpad_message_ref
with the stanza’s v attribute if WhatsApp message unpadding is needed.
PN JIDs are resolved to LID when a LID session exists, matching the internal receive path.
Sourcepub async fn encrypt_group_message(
&self,
group_jid: &Jid,
plaintext: &[u8],
) -> Result<(Option<Vec<u8>>, Vec<u8>)>
pub async fn encrypt_group_message( &self, group_jid: &Jid, plaintext: &[u8], ) -> Result<(Option<Vec<u8>>, Vec<u8>)>
Encrypt plaintext for a group using sender keys.
Returns (Option<skdm_bytes>, ciphertext_bytes). The SKDM is Some
only when a new sender key was created (first encrypt for this group
or after key rotation). Callers must distribute the SKDM to all group
participants when present. This matches WA Web which only creates
SKDM on first group encrypt or after sender key rotation.
Not safe to call concurrently with decrypt_group_message for the
same group — sender key state is not internally locked.
Sourcepub async fn decrypt_group_message(
&self,
group_jid: &Jid,
sender_jid: &Jid,
ciphertext: &[u8],
) -> Result<Vec<u8>>
pub async fn decrypt_group_message( &self, group_jid: &Jid, sender_jid: &Jid, ciphertext: &[u8], ) -> Result<Vec<u8>>
Decrypt a group (sender-key) message.
Returns raw padded plaintext. Use MessageUtils::unpad_message_ref
with the stanza’s v attribute if WhatsApp message unpadding is needed.
Not safe to call concurrently with encrypt_group_message for the
same group — sender key state is not internally locked.
Sourcepub async fn validate_session(&self, jid: &Jid) -> Result<bool>
pub async fn validate_session(&self, jid: &Jid) -> Result<bool>
Check whether a Signal session exists for jid.
PN JIDs are resolved to LID when a LID mapping exists, matching the encrypt/decrypt paths.
Sourcepub async fn delete_sessions(&self, jids: &[Jid]) -> Result<()>
pub async fn delete_sessions(&self, jids: &[Jid]) -> Result<()>
Delete Signal sessions and identity keys for the given JIDs.
Matches WA Web’s deleteRemoteSession which removes both session
and identity as a paired operation. Changes are flushed to the
persistent backend before returning.
PN JIDs are resolved to LID when a LID mapping exists, matching the encrypt/decrypt paths.
Sourcepub async fn create_participant_nodes(
&self,
recipient_jids: &[Jid],
message: &Message,
) -> Result<(Vec<Node>, bool)>
pub async fn create_participant_nodes( &self, recipient_jids: &[Jid], message: &Message, ) -> Result<(Vec<Node>, bool)>
Create encrypted participant <to> nodes for the given recipient JIDs.
Resolves devices, ensures Signal sessions, encrypts the message for each device, and returns the resulting XML nodes.
Returns (nodes, should_include_device_identity).
Sourcepub async fn assert_sessions(&self, jids: &[Jid]) -> Result<()>
pub async fn assert_sessions(&self, jids: &[Jid]) -> Result<()>
Ensure E2E sessions exist for the given JIDs.
Auto Trait Implementations§
impl<'a> Freeze for Signal<'a>
impl<'a> !RefUnwindSafe for Signal<'a>
impl<'a> Send for Signal<'a>
impl<'a> Sync for Signal<'a>
impl<'a> Unpin for Signal<'a>
impl<'a> UnsafeUnpin for Signal<'a>
impl<'a> !UnwindSafe for Signal<'a>
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more