code quality

This commit is contained in:
Valere 2023-10-02 15:31:11 +02:00
parent df82eee736
commit a6b127cb20
2 changed files with 11 additions and 31 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2023 New Vector Ltd * Copyright 2023 The Matrix.org Foundation C.I.C.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -337,7 +337,7 @@ internal class RustCryptoService @Inject constructor(
/** /**
* Provides the device information for a user id and a device Id * Provides the device information for a user id and a device Id
* *
* @param userId the user id * @param userId the user id
* @param deviceId the device id * @param deviceId the device id
*/ */
override suspend fun getCryptoDeviceInfo(userId: String, deviceId: String?): CryptoDeviceInfo? { override suspend fun getCryptoDeviceInfo(userId: String, deviceId: String?): CryptoDeviceInfo? {
@ -386,9 +386,9 @@ internal class RustCryptoService @Inject constructor(
/** /**
* Configure a room to use encryption. * Configure a room to use encryption.
* *
* @param roomId the room id to enable encryption in. * @param roomId the room id to enable encryption in.
* @param algorithm the encryption config for the room. * @param algorithm the encryption config for the room.
* @param membersId list of members to start tracking their devices * @param membersId list of members to start tracking their devices
* @return true if the operation succeeds. * @return true if the operation succeeds.
*/ */
private suspend fun setEncryptionInRoom( private suspend fun setEncryptionInRoom(
@ -470,8 +470,8 @@ internal class RustCryptoService @Inject constructor(
* Encrypt an event content according to the configuration of the room. * Encrypt an event content according to the configuration of the room.
* *
* @param eventContent the content of the event. * @param eventContent the content of the event.
* @param eventType the type of the event. * @param eventType the type of the event.
* @param roomId the room identifier the event will be sent. * @param roomId the room identifier the event will be sent.
*/ */
override suspend fun encryptEventContent( override suspend fun encryptEventContent(
eventContent: Content, eventContent: Content,
@ -488,7 +488,7 @@ internal class RustCryptoService @Inject constructor(
/** /**
* Decrypt an event * Decrypt an event
* *
* @param event the raw event. * @param event the raw event.
* @param timeline the id of the timeline where the event is decrypted. It is used to prevent replay attack. * @param timeline the id of the timeline where the event is decrypted. It is used to prevent replay attack.
* @return the MXEventDecryptionResult data, or throw in case of error * @return the MXEventDecryptionResult data, or throw in case of error
*/ */
@ -681,8 +681,8 @@ internal class RustCryptoService @Inject constructor(
/** /**
* Import the room keys * Import the room keys
* *
* @param roomKeysAsArray the room keys as array. * @param roomKeysAsArray the room keys as array.
* @param password the password * @param password the password
* @param progressListener the progress listener * @param progressListener the progress listener
* @return the result ImportRoomKeysResult * @return the result ImportRoomKeysResult
*/ */
@ -715,7 +715,7 @@ internal class RustCryptoService @Inject constructor(
* If false, it can still be overridden per-room. * If false, it can still be overridden per-room.
* If true, it overrides the per-room settings. * If true, it overrides the per-room settings.
* *
* @param block true to unilaterally blacklist all * @param block true to unilaterally blacklist all
*/ */
override fun setGlobalBlacklistUnverifiedDevices(block: Boolean) { override fun setGlobalBlacklistUnverifiedDevices(block: Boolean) {
cryptoStore.setGlobalBlacklistUnverifiedDevices(block) cryptoStore.setGlobalBlacklistUnverifiedDevices(block)
@ -785,26 +785,6 @@ internal class RustCryptoService @Inject constructor(
return cryptoStore.getLiveBlockUnverifiedDevices(roomId) return cryptoStore.getLiveBlockUnverifiedDevices(roomId)
} }
// /**
// * Manages the room black-listing for unverified devices.
// *
// * @param roomId the room id
// * @param add true to add the room id to the list, false to remove it.
// */
// private fun setRoomBlacklistUnverifiedDevices(roomId: String, add: Boolean) {
// val roomIds = cryptoStore.getRoomsListBlacklistUnverifiedDevices().toMutableList()
//
// if (add) {
// if (roomId !in roomIds) {
// roomIds.add(roomId)
// }
// } else {
// roomIds.remove(roomId)
// }
//
// cryptoStore.setRoomsListBlacklistUnverifiedDevices(roomIds)
// }
/** /**
* Re request the encryption keys required to decrypt an event. * Re request the encryption keys required to decrypt an event.
* *