whatsapp_rust/client/
context_impl.rs1use crate::client::Client;
2use async_trait::async_trait;
3use std::collections::HashMap;
4use wacore::client::context::{GroupInfo, SendContextResolver};
5use wacore::libsignal::protocol::PreKeyBundle;
6use wacore_binary::jid::Jid;
7
8#[async_trait]
9impl SendContextResolver for Client {
10 async fn resolve_devices(&self, jids: &[Jid]) -> Result<Vec<Jid>, anyhow::Error> {
11 self.get_user_devices(jids).await
12 }
13
14 async fn fetch_prekeys(
15 &self,
16 jids: &[Jid],
17 ) -> Result<HashMap<Jid, PreKeyBundle>, anyhow::Error> {
18 self.fetch_pre_keys(jids, None).await
19 }
20
21 async fn fetch_prekeys_for_identity_check(
22 &self,
23 jids: &[Jid],
24 ) -> Result<HashMap<Jid, PreKeyBundle>, anyhow::Error> {
25 self.fetch_pre_keys(jids, Some("identity")).await
26 }
27
28 async fn resolve_group_info(&self, jid: &Jid) -> Result<GroupInfo, anyhow::Error> {
29 self.query_group_info(jid).await
30 }
31}