crypto: Connect the room key discarding logic

This commit is contained in:
Damir Jelić 2021-04-09 12:35:13 +02:00
parent 427eb5e249
commit 8692f05e34
4 changed files with 17 additions and 1 deletions

View File

@ -543,7 +543,7 @@ internal class DefaultCryptoService @Inject constructor(
} }
override fun discardOutboundSession(roomId: String) { override fun discardOutboundSession(roomId: String) {
// TODO olmMachine?.discardRoomKey(roomId)
} }
/** /**

View File

@ -496,4 +496,11 @@ internal class OlmMachine(user_id: String, device_id: String, path: File, device
return devices return devices
} }
/**
* Discard the currently active room key for the given room if there is one.
*/
fun discardRoomKey(roomId: String) {
this.inner.discardRoomKey(roomId)
}
} }

View File

@ -450,6 +450,14 @@ impl OlmMachine {
}) })
} }
/// Discard the currently active room key for the given room if there is
/// one.
pub fn discard_room_key(&self, room_id: &str) {
let room_id = RoomId::try_from(room_id).unwrap();
self.inner.invalidate_group_session(&room_id);
}
pub fn start_verification(&self, device: &Device) -> Result<Sas, CryptoStoreError> { pub fn start_verification(&self, device: &Device) -> Result<Sas, CryptoStoreError> {
let user_id = UserId::try_from(device.user_id.clone()).unwrap(); let user_id = UserId::try_from(device.user_id.clone()).unwrap();
let device_id = device.device_id.as_str().into(); let device_id = device.device_id.as_str().into();

View File

@ -127,4 +127,5 @@ interface OlmMachine {
[ByRef] string passphrase, [ByRef] string passphrase,
ProgressListener progress_listener ProgressListener progress_listener
); );
void discard_room_key([ByRef] string room_id);
}; };