mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 06:56:29 +03:00
jsonrpc(feat): Add API to get json encryption info
Add a new api to jsonrpc that returns json structured data about chat encryption.
This commit is contained in:
@@ -45,7 +45,7 @@ pub mod types;
|
||||
|
||||
use num_traits::FromPrimitive;
|
||||
use types::account::Account;
|
||||
use types::chat::FullChat;
|
||||
use types::chat::{EncryptionInfo, FullChat};
|
||||
use types::contact::{ContactObject, VcardContact};
|
||||
use types::events::Event;
|
||||
use types::http::HttpResponse;
|
||||
@@ -708,6 +708,19 @@ impl CommandApi {
|
||||
ChatId::new(chat_id).get_encryption_info(&ctx).await
|
||||
}
|
||||
|
||||
/// Get encryption info for a chat.
|
||||
async fn get_chat_encryption_info_json(
|
||||
&self,
|
||||
account_id: u32,
|
||||
chat_id: u32,
|
||||
) -> Result<EncryptionInfo> {
|
||||
let ctx = self.get_context(account_id).await?;
|
||||
Ok(ChatId::new(chat_id)
|
||||
.get_encryption_info_json(&ctx)
|
||||
.await?
|
||||
.into())
|
||||
}
|
||||
|
||||
/// Get QR code text that will offer a [SecureJoin](https://securejoin.delta.chat/) invitation.
|
||||
///
|
||||
/// If `chat_id` is a group chat ID, SecureJoin QR code for the group is returned.
|
||||
|
||||
Reference in New Issue
Block a user