mirror of
https://github.com/element-hq/element-android
synced 2024-12-19 15:58:27 +03:00
crypto: Rename the share_group_session method
This commit is contained in:
parent
09c0ca10e5
commit
389273d56a
4 changed files with 10 additions and 10 deletions
|
@ -535,7 +535,7 @@ internal class DefaultCryptoService @Inject constructor(
|
||||||
val t0 = System.currentTimeMillis()
|
val t0 = System.currentTimeMillis()
|
||||||
Timber.v("## CRYPTO | encryptEventContent() starts")
|
Timber.v("## CRYPTO | encryptEventContent() starts")
|
||||||
runCatching {
|
runCatching {
|
||||||
preshareGroupSession(roomId, userIds)
|
preshareRoomKey(roomId, userIds)
|
||||||
val content = encrypt(roomId, eventType, eventContent)
|
val content = encrypt(roomId, eventType, eventContent)
|
||||||
Timber.v("## CRYPTO | encryptEventContent() : succeeds after ${System.currentTimeMillis() - t0} ms")
|
Timber.v("## CRYPTO | encryptEventContent() : succeeds after ${System.currentTimeMillis() - t0} ms")
|
||||||
MXEncryptEventContentResult(content, EventType.ENCRYPTED)
|
MXEncryptEventContentResult(content, EventType.ENCRYPTED)
|
||||||
|
@ -694,7 +694,7 @@ internal class DefaultCryptoService @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun preshareGroupSession(roomId: String, roomMembers: List<String>) {
|
private suspend fun preshareRoomKey(roomId: String, roomMembers: List<String>) {
|
||||||
keyClaimLock.withLock {
|
keyClaimLock.withLock {
|
||||||
val request = olmMachine!!.getMissingSessions(roomMembers)
|
val request = olmMachine!!.getMissingSessions(roomMembers)
|
||||||
if (request != null) {
|
if (request != null) {
|
||||||
|
@ -711,7 +711,7 @@ internal class DefaultCryptoService @Inject constructor(
|
||||||
|
|
||||||
keyShareLock.withLock {
|
keyShareLock.withLock {
|
||||||
coroutineScope {
|
coroutineScope {
|
||||||
olmMachine!!.shareGroupSession(roomId, roomMembers).map {
|
olmMachine!!.shareRoomKey(roomId, roomMembers).map {
|
||||||
when (it) {
|
when (it) {
|
||||||
is Request.ToDevice -> {
|
is Request.ToDevice -> {
|
||||||
async {
|
async {
|
||||||
|
@ -1077,7 +1077,7 @@ internal class DefaultCryptoService @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
runCatching {
|
runCatching {
|
||||||
preshareGroupSession(roomId, userIds)
|
preshareRoomKey(roomId, userIds)
|
||||||
}.fold(
|
}.fold(
|
||||||
{ callback.onSuccess(Unit) },
|
{ callback.onSuccess(Unit) },
|
||||||
{
|
{
|
||||||
|
|
|
@ -262,7 +262,7 @@ internal class OlmMachine(user_id: String, device_id: String, path: File, device
|
||||||
* mark_request_as_sent() method.
|
* mark_request_as_sent() method.
|
||||||
*
|
*
|
||||||
* This method should be called every time before a call to
|
* This method should be called every time before a call to
|
||||||
* share_group_session() is made.
|
* shareRoomKey() is made.
|
||||||
*
|
*
|
||||||
* @param users The list of users for which we would like to establish 1:1
|
* @param users The list of users for which we would like to establish 1:1
|
||||||
* Olm sessions for.
|
* Olm sessions for.
|
||||||
|
@ -294,8 +294,8 @@ internal class OlmMachine(user_id: String, device_id: String, path: File, device
|
||||||
* @return The list of requests that need to be sent out.
|
* @return The list of requests that need to be sent out.
|
||||||
*/
|
*/
|
||||||
@Throws(CryptoStoreErrorException::class)
|
@Throws(CryptoStoreErrorException::class)
|
||||||
suspend fun shareGroupSession(roomId: String, users: List<String>): List<Request> = withContext(Dispatchers.IO) {
|
suspend fun shareRoomKey(roomId: String, users: List<String>): List<Request> = withContext(Dispatchers.IO) {
|
||||||
inner.shareGroupSession(roomId, users)
|
inner.shareRoomKey(roomId, users)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,7 +313,7 @@ internal class OlmMachine(user_id: String, device_id: String, path: File, device
|
||||||
* using the [`get_missing_sessions()`](#method.get_missing_sessions)
|
* using the [`get_missing_sessions()`](#method.get_missing_sessions)
|
||||||
* method. This method call should be locked per call.
|
* method. This method call should be locked per call.
|
||||||
*
|
*
|
||||||
* 2. Share a room key with all the room members using the share_group_session().
|
* 2. Share a room key with all the room members using the shareRoomKey().
|
||||||
* This method call should be locked per room.
|
* This method call should be locked per room.
|
||||||
*
|
*
|
||||||
* 3. Encrypt the event using this method.
|
* 3. Encrypt the event using this method.
|
||||||
|
|
|
@ -315,7 +315,7 @@ impl OlmMachine {
|
||||||
///
|
///
|
||||||
/// * `users` - The list of users which are considered to be members of the
|
/// * `users` - The list of users which are considered to be members of the
|
||||||
/// room and should receive the room key.
|
/// room and should receive the room key.
|
||||||
pub fn share_group_session(
|
pub fn share_room_key(
|
||||||
&self,
|
&self,
|
||||||
room_id: &str,
|
room_id: &str,
|
||||||
users: Vec<String>,
|
users: Vec<String>,
|
||||||
|
|
|
@ -126,7 +126,7 @@ interface OlmMachine {
|
||||||
[Throws=CryptoStoreError]
|
[Throws=CryptoStoreError]
|
||||||
Request? get_missing_sessions(sequence<string> users);
|
Request? get_missing_sessions(sequence<string> users);
|
||||||
[Throws=CryptoStoreError]
|
[Throws=CryptoStoreError]
|
||||||
sequence<Request> share_group_session([ByRef] string room_id, sequence<string> users);
|
sequence<Request> share_room_key([ByRef] string room_id, sequence<string> users);
|
||||||
|
|
||||||
[Throws=CryptoStoreError]
|
[Throws=CryptoStoreError]
|
||||||
Sas start_verification([ByRef] Device device);
|
Sas start_verification([ByRef] Device device);
|
||||||
|
|
Loading…
Reference in a new issue