Merge pull request #8838 from element-hq/feature/bca/bump_crypto_sdk_0.4.1

Bump rust sdk crypto to 0.4.1
This commit is contained in:
Benoit Marty 2024-05-28 10:10:08 +02:00 committed by GitHub
commit 204244bac4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 11 deletions

1
changelog.d/8838.misc Normal file
View File

@ -0,0 +1 @@
Update Rust crypto SDK to version 0.4.1

View File

@ -215,7 +215,7 @@ dependencies {
implementation libs.google.phonenumber
implementation("org.matrix.rustcomponents:crypto-android:0.3.16")
implementation("org.matrix.rustcomponents:crypto-android:0.4.1")
// api project(":library:rustCrypto")
testImplementation libs.tests.junit

View File

@ -31,8 +31,8 @@ import org.matrix.android.sdk.internal.crypto.verification.SasVerification
import org.matrix.android.sdk.internal.crypto.verification.VerificationRequest
import org.matrix.android.sdk.internal.crypto.verification.prepareMethods
import org.matrix.rustcomponents.sdk.crypto.CryptoStoreException
import org.matrix.rustcomponents.sdk.crypto.LocalTrust
import org.matrix.rustcomponents.sdk.crypto.SignatureException
import uniffi.matrix_sdk_crypto.LocalTrust
import org.matrix.rustcomponents.sdk.crypto.Device as InnerDevice
/** Class representing a device that supports E2EE in the Matrix world

View File

@ -75,7 +75,6 @@ import org.matrix.rustcomponents.sdk.crypto.DeviceLists
import org.matrix.rustcomponents.sdk.crypto.EncryptionSettings
import org.matrix.rustcomponents.sdk.crypto.KeyRequestPair
import org.matrix.rustcomponents.sdk.crypto.KeysImportResult
import org.matrix.rustcomponents.sdk.crypto.LocalTrust
import org.matrix.rustcomponents.sdk.crypto.Logger
import org.matrix.rustcomponents.sdk.crypto.MegolmV1BackupKey
import org.matrix.rustcomponents.sdk.crypto.Request
@ -86,6 +85,7 @@ import org.matrix.rustcomponents.sdk.crypto.ShieldState
import org.matrix.rustcomponents.sdk.crypto.SignatureVerification
import org.matrix.rustcomponents.sdk.crypto.setLogger
import timber.log.Timber
import uniffi.matrix_sdk_crypto.LocalTrust
import java.io.File
import java.nio.charset.Charset
import javax.inject.Inject
@ -828,8 +828,14 @@ internal class OlmMachine @Inject constructor(
val requests = withContext(coroutineDispatchers.io) {
inner.bootstrapCrossSigning()
}
(requests.uploadKeysRequest)?.let {
when (it) {
is Request.KeysUpload -> requestSender.uploadKeys(it)
else -> {}
}
}
requestSender.uploadCrossSigningKeys(requests.uploadSigningKeysRequest, uiaInterceptor)
requestSender.sendSignatureUpload(requests.signatureRequest)
requestSender.sendSignatureUpload(requests.uploadSignatureRequest)
}
/**

View File

@ -68,9 +68,9 @@ import org.matrix.android.sdk.internal.util.JsonCanonicalizer
import org.matrix.olm.OlmException
import org.matrix.rustcomponents.sdk.crypto.Request
import org.matrix.rustcomponents.sdk.crypto.RequestType
import org.matrix.rustcomponents.sdk.crypto.SignatureState
import org.matrix.rustcomponents.sdk.crypto.SignatureVerification
import timber.log.Timber
import uniffi.matrix_sdk_crypto.SignatureState
import java.security.InvalidParameterException
import javax.inject.Inject
import kotlin.random.Random

View File

@ -100,7 +100,7 @@ fun RealmToMigrate.getPickledAccount(pickleKey: ByteArray): MigrationData {
)
MigrationData(
account = pickledAccount,
pickleKey = pickleKey.map { it.toUByte() },
pickleKey = pickleKey,
crossSigning = CrossSigningKeyExport(
masterKey = masterKey,
selfSigningKey = selfSignedKey,
@ -153,7 +153,7 @@ fun RealmToMigrate.getPickledAccount(pickleKey: ByteArray): MigrationData {
migrationData = MigrationData(
account = pickledAccount,
pickleKey = pickleKey.map { it.toUByte() },
pickleKey = pickleKey,
crossSigning = CrossSigningKeyExport(
masterKey = masterKey,
selfSigningKey = selfSignedKey,
@ -222,8 +222,10 @@ fun RealmToMigrate.pickledOlmSessions(pickleKey: ByteArray, chunkSize: Int, onCh
pickle = pickle,
senderKey = deviceKey,
createdUsingFallbackKey = false,
creationTime = lastReceivedMessageTs.toString(),
lastUseTime = lastReceivedMessageTs.toString()
// / Unix timestamp (in seconds) when the session was created.
creationTime = (lastReceivedMessageTs / 1000).toULong(),
// / Unix timestamp (in seconds) when the session was last used.
lastUseTime = (lastReceivedMessageTs / 1000).toULong(),
)
// should we check the tracking status?
pickledSessions.add(pickledSession)
@ -323,8 +325,10 @@ private fun OlmSessionEntity.toPickledSession(pickleKey: ByteArray): PickledSess
pickle = pickledOlmSession,
senderKey = deviceKey,
createdUsingFallbackKey = false,
creationTime = lastReceivedMessageTs.toString(),
lastUseTime = lastReceivedMessageTs.toString()
// Rust expect in seconds
creationTime = (lastReceivedMessageTs / 1000).toULong(),
// Rust expect in seconds
lastUseTime = (lastReceivedMessageTs / 1000).toULong(),
)
}