diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoManager.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoManager.kt index 33b3dc0663..db74fa863d 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoManager.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoManager.kt @@ -88,7 +88,7 @@ internal class CryptoManager( // private val mObjectSigner: ObjectSigner, // - private val mOneTimeKeysManager: OneTimeKeysManager, + private val mOneTimeKeysUploader: OneTimeKeysUploader, // private val roomDecryptorProvider: RoomDecryptorProvider, // The SAS verification service. @@ -96,7 +96,7 @@ internal class CryptoManager( // private val mIncomingRoomKeyRequestManager: IncomingRoomKeyRequestManager, // - private val mOutgoingRoomKeyRequestManager: MXOutgoingRoomKeyRequestManager, + private val mOutgoingRoomKeyRequestManager: OutgoingRoomKeyRequestManager, // Room service private val mRoomService: RoomService, // Olm Manager @@ -262,10 +262,10 @@ internal class CryptoManager( Timber.d(" - device id : " + mCredentials.deviceId) Timber.d(" - ed25519 : " + mOlmDevice.deviceEd25519Key) Timber.d(" - curve25519 : " + mOlmDevice.deviceCurve25519Key) - Timber.d(" - oneTimeKeys: " + mOneTimeKeysManager.mLastPublishedOneTimeKeys) + Timber.d(" - oneTimeKeys: " + mOneTimeKeysUploader.mLastPublishedOneTimeKeys) Timber.d("") - mOneTimeKeysManager.maybeUploadOneTimeKeys(object : MatrixCallback { + mOneTimeKeysUploader.maybeUploadOneTimeKeys(object : MatrixCallback { override fun onSuccess(data: Unit) { // TODO //if (null != mNetworkConnectivityReceiver) { @@ -353,7 +353,7 @@ internal class CryptoManager( if (null != syncResponse.deviceOneTimeKeysCount) { val currentCount = syncResponse.deviceOneTimeKeysCount.signedCurve25519 ?: 0 - mOneTimeKeysManager.updateOneTimeKeyCount(currentCount) + mOneTimeKeysUploader.updateOneTimeKeyCount(currentCount) } if (isStarted()) { @@ -362,7 +362,7 @@ internal class CryptoManager( } if (!isCatchingUp && isStarted()) { - mOneTimeKeysManager.maybeUploadOneTimeKeys() + mOneTimeKeysUploader.maybeUploadOneTimeKeys() mIncomingRoomKeyRequestManager.processReceivedRoomKeyRequests() } @@ -865,8 +865,8 @@ internal class CryptoManager( val encryptedRoomKeys: ByteArray try { - val moshi = MoshiProvider.providesMoshi() - val adapter = moshi.adapter(List::class.java) + val adapter = MoshiProvider.providesMoshi() + .adapter(List::class.java) encryptedRoomKeys = MXMegolmExportEncryption .encryptMegolmKeyFile(adapter.toJson(exportedSessions), password, iterationCount) @@ -909,9 +909,9 @@ internal class CryptoManager( Timber.d("## importRoomKeys : decryptMegolmKeyFile done in " + (t1 - t0) + " ms") try { - val moshi = MoshiProvider.providesMoshi() - val adapter = moshi.adapter(List::class.java) - val list = adapter.fromJson(roomKeys) + val list = MoshiProvider.providesMoshi() + .adapter(List::class.java) + .fromJson(roomKeys) importedSessions = list as List } catch (e: Exception) { Timber.e(e, "## importRoomKeys failed") @@ -949,7 +949,7 @@ internal class CryptoManager( override fun onSuccess(data: MXUsersDevicesMap) { val unknownDevices = getUnknownDevices(data) - if (unknownDevices.map.size == 0) { + if (unknownDevices.map.isEmpty()) { callback.onSuccess(Unit) } else { // trigger an an unknown devices exception @@ -1100,6 +1100,30 @@ internal class CryptoManager( mIncomingRoomKeyRequestManager.removeRoomKeysRequestListener(listener) } + /** + * Provides the list of unknown devices + * + * @param devicesInRoom the devices map + * @return the unknown devices map + */ + private fun getUnknownDevices(devicesInRoom: MXUsersDevicesMap): MXUsersDevicesMap { + val unknownDevices = MXUsersDevicesMap() + + val userIds = devicesInRoom.userIds + for (userId in userIds) { + val deviceIds = devicesInRoom.getUserDeviceIds(userId) + for (deviceId in deviceIds!!) { + val deviceInfo = devicesInRoom.getObject(deviceId, userId) + + if (deviceInfo!!.isUnknown) { + unknownDevices.setObject(deviceInfo, userId, deviceId) + } + } + } + + return unknownDevices + } + /* ========================================================================================== * DEBUG INFO * ========================================================================================== */ @@ -1108,30 +1132,4 @@ internal class CryptoManager( return "CryptoManager of " + mCredentials.userId + " (" + mCredentials.deviceId + ")" } - - companion object { - /** - * Provides the list of unknown devices - * - * @param devicesInRoom the devices map - * @return the unknown devices map - */ - fun getUnknownDevices(devicesInRoom: MXUsersDevicesMap): MXUsersDevicesMap { - val unknownDevices = MXUsersDevicesMap() - - val userIds = devicesInRoom.userIds - for (userId in userIds) { - val deviceIds = devicesInRoom.getUserDeviceIds(userId) - for (deviceId in deviceIds!!) { - val deviceInfo = devicesInRoom.getObject(deviceId, userId) - - if (deviceInfo!!.isUnknown) { - unknownDevices.setObject(deviceInfo, userId, deviceId) - } - } - } - - return unknownDevices - } - } } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoModule.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoModule.kt index 6792b124c5..bdf172d13f 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoModule.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/CryptoModule.kt @@ -85,7 +85,7 @@ internal class CryptoModule { // scope(DefaultSession.SCOPE) { - MXOutgoingRoomKeyRequestManager(get(), get(), get()) + OutgoingRoomKeyRequestManager(get(), get(), get()) } scope(DefaultSession.SCOPE) { @@ -108,9 +108,9 @@ internal class CryptoModule { ObjectSigner(get(), get()) } - // OneTimeKeysManager + // OneTimeKeysUploader scope(DefaultSession.SCOPE) { - OneTimeKeysManager(get(), get(), get(), get(), get()) + OneTimeKeysUploader(get(), get(), get(), get(), get()) } // Actions diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DeviceListManager.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DeviceListManager.kt index 06c9804e44..eb99351972 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DeviceListManager.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DeviceListManager.kt @@ -62,7 +62,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore, * @param callback the asynchronous callback */ internal inner class DownloadKeysPromise(userIds: List, - val mCallback: MatrixCallback>?) { + val callback: MatrixCallback>?) { // list of remain pending device keys val mPendingUserIdsList: MutableList @@ -327,7 +327,7 @@ internal class DeviceListManager(private val mCryptoStore: IMXCryptoStore, } } - val callback = promise.mCallback + val callback = promise.callback if (null != callback) { CryptoAsyncHelper.getUiHandler().post { callback.onSuccess(usersDevicesInfoMap) } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXCryptoAlgorithms.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXCryptoAlgorithms.kt index 61622c377d..8f42c422df 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXCryptoAlgorithms.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXCryptoAlgorithms.kt @@ -17,6 +17,7 @@ package im.vector.matrix.android.internal.crypto +// TODO Update comment internal object MXCryptoAlgorithms { /** diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXMegolmExportEncryption.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXMegolmExportEncryption.kt index 68aa5c677a..b15ef22db8 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXMegolmExportEncryption.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXMegolmExportEncryption.kt @@ -18,19 +18,15 @@ package im.vector.matrix.android.internal.crypto import android.text.TextUtils import android.util.Base64 - +import timber.log.Timber import java.io.ByteArrayOutputStream +import java.nio.charset.Charset import java.security.SecureRandom -import java.util.Arrays - +import java.util.* import javax.crypto.Cipher import javax.crypto.Mac -import javax.crypto.SecretKey import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.SecretKeySpec - -import timber.log.Timber -import java.nio.charset.Charset import kotlin.experimental.and import kotlin.experimental.xor @@ -363,11 +359,3 @@ object MXMegolmExportEncryption { return key } } -/** - * Encrypt a string into the megolm export format. - * - * @param data the data to encrypt. - * @param password the password - * @return the encrypted data - * @throws Exception the failure reason - */ \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXOlmDevice.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXOlmDevice.kt index 5d04aaca1c..06161926ba 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXOlmDevice.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXOlmDevice.kt @@ -187,7 +187,6 @@ internal class MXOlmDevice( } catch (e: Exception) { Timber.e(e, "## generateOneTimeKeys() : failed") } - } /** diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MegolmSessionData.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MegolmSessionData.kt index 04fb5eb4e0..821ed0a553 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MegolmSessionData.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MegolmSessionData.kt @@ -18,7 +18,6 @@ package im.vector.matrix.android.internal.crypto import com.squareup.moshi.Json import com.squareup.moshi.JsonClass -import im.vector.matrix.android.internal.di.MoshiProvider /** * The type of object we use for importing and exporting megolm session data. @@ -71,10 +70,4 @@ data class MegolmSessionData( */ @Json(name = "forwarding_curve25519_key_chain") var forwardingCurve25519KeyChain: List? = null -) { - - fun toJsonString(): String { - return MoshiProvider.providesMoshi().adapter(MegolmSessionData::class.java).toJson(this) - } -} - +) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/ObjectSigner.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/ObjectSigner.kt index 5324a4c525..19a8962aa1 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/ObjectSigner.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/ObjectSigner.kt @@ -19,9 +19,8 @@ package im.vector.matrix.android.internal.crypto import im.vector.matrix.android.api.auth.data.Credentials import java.util.* -internal class ObjectSigner( - private val mCredentials: Credentials, - private val mOlmDevice: MXOlmDevice) { +internal class ObjectSigner(private val mCredentials: Credentials, + private val mOlmDevice: MXOlmDevice) { /** * Sign Object diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysManager.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysUploader.kt similarity index 99% rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysManager.kt rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysUploader.kt index 8c0df101c6..065c2721a9 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysManager.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysUploader.kt @@ -28,7 +28,7 @@ import org.matrix.olm.OlmAccount import timber.log.Timber import java.util.* -internal class OneTimeKeysManager( +internal class OneTimeKeysUploader( private val mCredentials: Credentials, private val mOlmDevice: MXOlmDevice, private val mObjectSigner: ObjectSigner, diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXOutgoingRoomKeyRequestManager.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OutgoingRoomKeyRequestManager.kt similarity index 99% rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXOutgoingRoomKeyRequestManager.kt rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OutgoingRoomKeyRequestManager.kt index 80f908ddfb..8b9fd01f37 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/MXOutgoingRoomKeyRequestManager.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OutgoingRoomKeyRequestManager.kt @@ -31,7 +31,7 @@ import im.vector.matrix.android.internal.task.configureWith import timber.log.Timber import java.util.* -internal class MXOutgoingRoomKeyRequestManager( +internal class OutgoingRoomKeyRequestManager( private val mCryptoStore: IMXCryptoStore, private val mSendToDeviceTask: SendToDeviceTask, private val mTaskExecutor: TaskExecutor) { diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/MegolmSessionDataImporter.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/MegolmSessionDataImporter.kt index 1c04b769bf..b08b860be9 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/MegolmSessionDataImporter.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/MegolmSessionDataImporter.kt @@ -26,7 +26,7 @@ import timber.log.Timber internal class MegolmSessionDataImporter(private val mOlmDevice: MXOlmDevice, private val roomDecryptorProvider: RoomDecryptorProvider, - private val mOutgoingRoomKeyRequestManager: MXOutgoingRoomKeyRequestManager, + private val mOutgoingRoomKeyRequestManager: OutgoingRoomKeyRequestManager, private val mCryptoStore: IMXCryptoStore) { /** diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/SetDeviceVerificationAction.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/SetDeviceVerificationAction.kt index 26f6b765ce..e55aac9a74 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/SetDeviceVerificationAction.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/actions/SetDeviceVerificationAction.kt @@ -21,9 +21,9 @@ import im.vector.matrix.android.internal.crypto.keysbackup.KeysBackup import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore import timber.log.Timber -internal class SetDeviceVerificationAction(val mCryptoStore: IMXCryptoStore, - val mCredentials: Credentials, - val mKeysBackup: KeysBackup) { +internal class SetDeviceVerificationAction(private val mCryptoStore: IMXCryptoStore, + private val mCredentials: Credentials, + private val mKeysBackup: KeysBackup) { fun handle(verificationStatus: Int, deviceId: String, userId: String) { val device = mCryptoStore.getUserDevice(deviceId, userId) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt index 73eab5c590..3d650e6111 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt @@ -47,7 +47,7 @@ import java.util.* internal class MXMegolmDecryption(private val mCredentials: Credentials, private val mOlmDevice: MXOlmDevice, private val mDeviceListManager: DeviceListManager, - private val mOutgoingRoomKeyRequestManager: MXOutgoingRoomKeyRequestManager, + private val mOutgoingRoomKeyRequestManager: OutgoingRoomKeyRequestManager, private val mMessageEncrypter: MessageEncrypter, private val mEnsureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction, private val mCryptoStore: IMXCryptoStore, @@ -68,12 +68,6 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials, @Throws(MXDecryptionException::class) private fun decryptEvent(event: Event, timeline: String, requestKeysOnFail: Boolean): MXEventDecryptionResult? { - // sanity check // TODO Remove check - if (null == event) { - Timber.e("## decryptEvent() : null event") - return null - } - val encryptedEventContent = event.content.toModel()!! if (TextUtils.isEmpty(encryptedEventContent.senderKey) || TextUtils.isEmpty(encryptedEventContent.sessionId) || TextUtils.isEmpty(encryptedEventContent.ciphertext)) { @@ -147,7 +141,7 @@ internal class MXMegolmDecryption(private val mCredentials: Credentials, val recipients = ArrayList>() val selfMap = HashMap() - selfMap["userId"] = mCredentials.userId // TODO Replace this hard coded keys (see MXOutgoingRoomKeyRequestManager) + selfMap["userId"] = mCredentials.userId // TODO Replace this hard coded keys (see OutgoingRoomKeyRequestManager) selfMap["deviceId"] = "*" recipients.add(selfMap) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt index 0b5ffdf9e0..6c3c6cabfc 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt @@ -19,7 +19,7 @@ package im.vector.matrix.android.internal.crypto.algorithms.megolm import im.vector.matrix.android.api.auth.data.Credentials import im.vector.matrix.android.internal.crypto.DeviceListManager import im.vector.matrix.android.internal.crypto.MXOlmDevice -import im.vector.matrix.android.internal.crypto.MXOutgoingRoomKeyRequestManager +import im.vector.matrix.android.internal.crypto.OutgoingRoomKeyRequestManager import im.vector.matrix.android.internal.crypto.actions.EnsureOlmSessionsForDevicesAction import im.vector.matrix.android.internal.crypto.actions.MessageEncrypter import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore @@ -29,7 +29,7 @@ import im.vector.matrix.android.internal.task.TaskExecutor internal class MXMegolmDecryptionFactory(private val mCredentials: Credentials, private val mOlmDevice: MXOlmDevice, private val mDeviceListManager: DeviceListManager, - private val mOutgoingRoomKeyRequestManager: MXOutgoingRoomKeyRequestManager, + private val mOutgoingRoomKeyRequestManager: OutgoingRoomKeyRequestManager, private val mMessageEncrypter: MessageEncrypter, private val mEnsureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction, private val mCryptoStore: IMXCryptoStore, diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXOutboundSessionInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXOutboundSessionInfo.kt index b78b34445b..31fe616a03 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXOutboundSessionInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/algorithms/megolm/MXOutboundSessionInfo.kt @@ -21,7 +21,7 @@ import im.vector.matrix.android.internal.crypto.model.MXDeviceInfo import im.vector.matrix.android.internal.crypto.model.MXUsersDevicesMap import timber.log.Timber -class MXOutboundSessionInfo( +internal class MXOutboundSessionInfo( // The id of the session val mSessionId: String) { // When the session was created diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmInboundGroupSession.java b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmInboundGroupSession.java index 8d6f99e594..451aa1baa8 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmInboundGroupSession.java +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmInboundGroupSession.java @@ -29,8 +29,6 @@ import timber.log.Timber; * This allows additional checks. The class implements NSCoding so that the context can be stored. */ public class MXOlmInboundGroupSession implements Serializable { - // - private static final String LOG_TAG = "OlmInboundGroupSession"; // The associated olm inbound group session. public OlmInboundGroupSession mSession; diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmSessionResult.java b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmSessionResult.kt similarity index 50% rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmSessionResult.java rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmSessionResult.kt index 1beb65c44e..f09ad43276 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmSessionResult.java +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/model/MXOlmSessionResult.kt @@ -14,30 +14,18 @@ * limitations under the License. */ -package im.vector.matrix.android.internal.crypto.model; +package im.vector.matrix.android.internal.crypto.model -import java.io.Serializable; +import java.io.Serializable -public class MXOlmSessionResult implements Serializable { - /** - * the device - */ - public final MXDeviceInfo mDevice; - - /** - * Base64 olm session id. - * null if no session could be established. - */ - public String mSessionId; - - /** - * Constructor - * - * @param device the device - * @param sessionId the olm session id - */ - public MXOlmSessionResult(MXDeviceInfo device, String sessionId) { - mDevice = device; - mSessionId = sessionId; - } -} \ No newline at end of file +data class MXOlmSessionResult +( + /** + * the device + */ + val mDevice: MXDeviceInfo, + /** + * Base64 olm session id. + * null if no session could be established. + */ + var mSessionId: String?) : Serializable