crypto: Change the encrypt method to not require to take mut self.
parent
1e3f93ca22
commit
1504b3a02a
|
@ -819,25 +819,23 @@ impl OlmMachine {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn encrypt(
|
pub async fn encrypt(
|
||||||
&mut self,
|
&self,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
content: MessageEventContent,
|
content: MessageEventContent,
|
||||||
) -> Result<MegolmV1AesSha2Content> {
|
) -> Result<MegolmV1AesSha2Content> {
|
||||||
if !self.outbound_group_session.contains_key(room_id) {
|
let session = self.outbound_group_session.get(room_id);
|
||||||
self.create_outbound_group_session(room_id).await?
|
|
||||||
}
|
|
||||||
|
|
||||||
let session = self.outbound_group_session.get(room_id).unwrap();
|
let session = if let Some(s) = session {
|
||||||
|
s
|
||||||
|
} else {
|
||||||
|
panic!("Session wasn't created nor shared");
|
||||||
|
};
|
||||||
|
|
||||||
if session.expired() {
|
if session.expired() {
|
||||||
todo!()
|
panic!("Session is expired");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if !session.shared() {
|
let json_content = json!({
|
||||||
// todo!()
|
|
||||||
// }
|
|
||||||
|
|
||||||
let mut json_content = json!({
|
|
||||||
"content": content,
|
"content": content,
|
||||||
"room_id": room_id,
|
"room_id": room_id,
|
||||||
"type": EventType::RoomMessage,
|
"type": EventType::RoomMessage,
|
||||||
|
|
Loading…
Reference in New Issue