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.fastinfoset',
'com.thoughtworks.qdox',
// 'com.vanniktech',
'com.vanniktech',
'commons-cli',
'commons-codec',
'commons-io',

View file

@ -218,7 +218,7 @@ dependencies {
// rustCryptoImplementation 'org.matrix.rustcomponents:crypto-android:0.2.1-SNAPSHOT'
// 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")
testImplementation libs.tests.junit

View file

@ -472,15 +472,19 @@ internal class OlmMachine @Inject constructor(
} catch (throwable: Throwable) {
val reThrow = when (throwable) {
is DecryptionException.MissingRoomKey -> {
if (throwable.withheldCode != null) {
MXCryptoError.Base(MXCryptoError.ErrorType.KEYS_WITHHELD, throwable.withheldCode!!)
} else {
MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID, throwable.error)
}
// Revert when witheld PR merged
// if (throwable.withheldCode != null) {
// MXCryptoError.Base(MXCryptoError.ErrorType.KEYS_WITHHELD, throwable.withheldCode!!)
// } 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 -> {
// 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 -> {
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? {
return when (this.color) {
ShieldColor.GREEN -> MessageVerificationState.VERIFIED
ShieldColor.NONE -> MessageVerificationState.VERIFIED
ShieldColor.RED -> {
when (this.message) {
"Encrypted by an unverified device." -> MessageVerificationState.UN_SIGNED_DEVICE
@ -513,10 +517,9 @@ internal class OlmMachine @Inject constructor(
else -> MessageVerificationState.UN_SIGNED_DEVICE
}
}
ShieldColor.GRAY -> {
ShieldColor.GREY -> {
MessageVerificationState.UNSAFE_SOURCE
}
ShieldColor.NONE -> null
}
}

View file

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