rust-crypto 0.3.1 , wa to fix compilation

This commit is contained in:
valere 2023-03-28 23:33:23 +02:00
parent 927f7757cd
commit bcc1ac4ac9
4 changed files with 16 additions and 11 deletions

View File

@ -135,7 +135,7 @@ ext.groups = [
'com.sun.xml.bind.mvn', 'com.sun.xml.bind.mvn',
'com.sun.xml.fastinfoset', 'com.sun.xml.fastinfoset',
'com.thoughtworks.qdox', 'com.thoughtworks.qdox',
// 'com.vanniktech', 'com.vanniktech',
'commons-cli', 'commons-cli',
'commons-codec', 'commons-codec',
'commons-io', 'commons-io',

View File

@ -218,7 +218,7 @@ dependencies {
// rustCryptoImplementation 'org.matrix.rustcomponents:crypto-android:0.2.1-SNAPSHOT' // rustCryptoImplementation 'org.matrix.rustcomponents:crypto-android:0.2.1-SNAPSHOT'
// rustCryptoImplementation files('libs/matrix-rust-sdk-crypto.aar') // rustCryptoImplementation files('libs/matrix-rust-sdk-crypto.aar')
rustCryptoImplementation("org.matrix.rustcomponents:crypto-android:0.1.3") rustCryptoImplementation("org.matrix.rustcomponents:crypto-android:0.3.1")
// rustCryptoApi project(":library:rustCrypto") // rustCryptoApi project(":library:rustCrypto")
testImplementation libs.tests.junit testImplementation libs.tests.junit

View File

@ -472,15 +472,19 @@ internal class OlmMachine @Inject constructor(
} catch (throwable: Throwable) { } catch (throwable: Throwable) {
val reThrow = when (throwable) { val reThrow = when (throwable) {
is DecryptionException.MissingRoomKey -> { is DecryptionException.MissingRoomKey -> {
if (throwable.withheldCode != null) { // Revert when witheld PR merged
MXCryptoError.Base(MXCryptoError.ErrorType.KEYS_WITHHELD, throwable.withheldCode!!) // if (throwable.withheldCode != null) {
} else { // MXCryptoError.Base(MXCryptoError.ErrorType.KEYS_WITHHELD, throwable.withheldCode!!)
MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID, throwable.error) // } else {
} // MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID, throwable.error)
// }
MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID, throwable.message.orEmpty())
} }
is DecryptionException.Megolm -> { is DecryptionException.Megolm -> {
// TODO check if it's the correct binding? // TODO check if it's the correct binding?
MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX, throwable.error) // MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX, throwable.error)
MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX, throwable.message.orEmpty())
} }
is DecryptionException.Identifier -> { is DecryptionException.Identifier -> {
MXCryptoError.Base(MXCryptoError.ErrorType.BAD_EVENT_FORMAT, MXCryptoError.BAD_EVENT_FORMAT_TEXT_REASON) MXCryptoError.Base(MXCryptoError.ErrorType.BAD_EVENT_FORMAT, MXCryptoError.BAD_EVENT_FORMAT_TEXT_REASON)
@ -504,7 +508,7 @@ internal class OlmMachine @Inject constructor(
private fun ShieldState.toVerificationState(): MessageVerificationState? { private fun ShieldState.toVerificationState(): MessageVerificationState? {
return when (this.color) { return when (this.color) {
ShieldColor.GREEN -> MessageVerificationState.VERIFIED ShieldColor.NONE -> MessageVerificationState.VERIFIED
ShieldColor.RED -> { ShieldColor.RED -> {
when (this.message) { when (this.message) {
"Encrypted by an unverified device." -> MessageVerificationState.UN_SIGNED_DEVICE "Encrypted by an unverified device." -> MessageVerificationState.UN_SIGNED_DEVICE
@ -513,10 +517,9 @@ internal class OlmMachine @Inject constructor(
else -> MessageVerificationState.UN_SIGNED_DEVICE else -> MessageVerificationState.UN_SIGNED_DEVICE
} }
} }
ShieldColor.GRAY -> { ShieldColor.GREY -> {
MessageVerificationState.UNSAFE_SOURCE MessageVerificationState.UNSAFE_SOURCE
} }
ShieldColor.NONE -> null
} }
} }

View File

@ -102,6 +102,8 @@ internal class ExtractMigrationDataUseCase {
trackedUsers = emptyList(), trackedUsers = emptyList(),
inboundGroupSessions = emptyList(), inboundGroupSessions = emptyList(),
backupVersion = backupVersion, backupVersion = backupVersion,
// TODO import room settings from legacy DB
roomSettings = emptyMap()
) )
// import the account asap // import the account asap
importPartial(baseExtract) importPartial(baseExtract)