support e2e encryption#1
Conversation
| return realm.where<SharedSessionEntity>() | ||
| .equalTo(SharedSessionEntityFields.ROOM_ID, roomId) | ||
| .equalTo(SharedSessionEntityFields.SESSION_ID, sessionId) | ||
| .equalTo(SharedSessionEntityFields.ALGORITHM, MXCRYPTO_ALGORITHM_MEGOLM) |
There was a problem hiding this comment.
Removing this line changed its behavior, it will return any SharedSessionEntity regardless it is a MXCRYPTO_ALGORITHM_MEGOLM or MXCRYPTO_ALGORITHM_RATCHET.
Try to add a parameter algorithm ?
| return realm.where<SharedSessionEntity>() | ||
| .equalTo(SharedSessionEntityFields.ROOM_ID, roomId) | ||
| .equalTo(SharedSessionEntityFields.SESSION_ID, sessionId) | ||
| .equalTo(SharedSessionEntityFields.ALGORITHM, MXCRYPTO_ALGORITHM_MEGOLM) |
There was a problem hiding this comment.
Same as above and all similar issues below.
| ): SharedSessionEntity { | ||
| return realm.createObject<SharedSessionEntity>().apply { | ||
| this.roomId = roomId | ||
| this.algorithm = MXCRYPTO_ALGORITHM_MEGOLM |
There was a problem hiding this comment.
Ensure removing this field is OK.
| return params.algorithm | ||
| ?.let { | ||
| if (it != MXCRYPTO_ALGORITHM_MEGOLM) { | ||
| if (!arrayOf(MXCRYPTO_ALGORITHM_MEGOLM, MXCRYPTO_ALGORITHM_RATCHET).contains(it)) { |
There was a problem hiding this comment.
arrayOf(MXCRYPTO_ALGORITHM_MEGOLM, MXCRYPTO_ALGORITHM_RATCHET) occurs multiple times, consider extract it as a const or static final
| } | ||
|
|
||
| override suspend fun enableEncryption(algorithm: String, force: Boolean) { | ||
| val supportedAlgorithm = arrayOf(MXCRYPTO_ALGORITHM_MEGOLM, MXCRYPTO_ALGORITHM_RATCHET) |
There was a problem hiding this comment.
Move this val/var to upper level?
| private const val cipherMode = "AES/CBC/PKCS7Padding" //algorithm/mode/padding | ||
|
|
||
| fun encrypt(key: ByteArray, cleartext: String): String { | ||
| Timber.i("AES encrypt with key: ${key.decodeToString()}") |
| } | ||
|
|
||
| if (isUpdated) { | ||
| Timber.v("## CRYPTO: removeCurrentGroupSession on device changed") |
There was a problem hiding this comment.
Please confirm while isUpdated=true is equivalent to the scenarios mentioned by @auruac
1035bee to
be51a59
Compare
8d4db95 to
e43771d
Compare
87711f8 to
3919a13
Compare
88b0363 to
aaa92d7
Compare
No description provided.