mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-24 00:30:47 +01:00
Merge pull request #4269 from vector-im/feature/bma/required_signature
Make MegolmBackupAuthData.signatures optional for robustness
This commit is contained in:
commit
89e8e5ca31
1
changelog.d/4162.bugfix
Normal file
1
changelog.d/4162.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Make MegolmBackupAuthData.signatures optional for robustness
|
@ -410,7 +410,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
||||
val keysBackupVersionTrust = KeysBackupVersionTrust()
|
||||
val authData = keysBackupVersion.getAuthDataAsMegolmBackupAuthData()
|
||||
|
||||
if (authData == null || authData.publicKey.isEmpty() || authData.signatures.isEmpty()) {
|
||||
if (authData == null || authData.publicKey.isEmpty() || authData.signatures.isNullOrEmpty()) {
|
||||
Timber.v("getKeysBackupTrust: Key backup is absent or missing required data")
|
||||
return keysBackupVersionTrust
|
||||
}
|
||||
@ -478,7 +478,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
||||
cryptoCoroutineScope.launch(coroutineDispatchers.main) {
|
||||
val updateKeysBackupVersionBody = withContext(coroutineDispatchers.crypto) {
|
||||
// Get current signatures, or create an empty set
|
||||
val myUserSignatures = authData.signatures[userId].orEmpty().toMutableMap()
|
||||
val myUserSignatures = authData.signatures?.get(userId).orEmpty().toMutableMap()
|
||||
|
||||
if (trust) {
|
||||
// Add current device signature
|
||||
@ -497,7 +497,7 @@ internal class DefaultKeysBackupService @Inject constructor(
|
||||
// Create an updated version of KeysVersionResult
|
||||
val newMegolmBackupAuthData = authData.copy()
|
||||
|
||||
val newSignatures = newMegolmBackupAuthData.signatures.toMutableMap()
|
||||
val newSignatures = newMegolmBackupAuthData.signatures.orEmpty().toMutableMap()
|
||||
newSignatures[userId] = myUserSignatures
|
||||
|
||||
val newMegolmBackupAuthDataWithNewSignature = newMegolmBackupAuthData.copy(
|
||||
|
@ -51,7 +51,7 @@ data class MegolmBackupAuthData(
|
||||
* userId -> (deviceSignKeyId -> signature)
|
||||
*/
|
||||
@Json(name = "signatures")
|
||||
val signatures: Map<String, Map<String, String>>
|
||||
val signatures: Map<String, Map<String, String>>? = null
|
||||
) {
|
||||
|
||||
fun toJsonDict(): JsonDict {
|
||||
|
Loading…
Reference in New Issue
Block a user