mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-06-13 10:54:21 -04:00
fix(crypto-ffi): Add support to encrypt custom events
This commit is contained in:
@@ -32,7 +32,7 @@ use ruma::{
|
||||
},
|
||||
events::{
|
||||
key::verification::VerificationMethod, room::encrypted::OriginalSyncRoomEncryptedEvent,
|
||||
AnyMessageLikeEventContent, AnySyncMessageLikeEvent, EventContent,
|
||||
AnySyncMessageLikeEvent,
|
||||
},
|
||||
DeviceKeyAlgorithm, EventId, OwnedTransactionId, OwnedUserId, RoomId, UserId,
|
||||
};
|
||||
@@ -518,12 +518,11 @@ impl OlmMachine {
|
||||
content: &str,
|
||||
) -> Result<String, CryptoStoreError> {
|
||||
let room_id = RoomId::parse(room_id)?;
|
||||
let content: Box<RawValue> = serde_json::from_str(content)?;
|
||||
let content: Value = serde_json::from_str(content)?;
|
||||
|
||||
let content = AnyMessageLikeEventContent::from_parts(event_type, &content)?;
|
||||
let encrypted_content = self
|
||||
.runtime
|
||||
.block_on(self.inner.encrypt_room_event(&room_id, content))
|
||||
.block_on(self.inner.encrypt_room_event_raw(&room_id, content, event_type))
|
||||
.expect("Encrypting an event produced an error");
|
||||
|
||||
Ok(serde_json::to_string(&encrypted_content)?)
|
||||
|
||||
Reference in New Issue
Block a user