Better contract. Explicit parameter usage

This commit is contained in:
Benoit Marty 2022-04-13 18:53:27 +02:00
parent 2858401a12
commit 13cf510e8a
2 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ data class KeysBackupVersionTrust(
* Flag to indicate if the backup is trusted.
* true if there is a signature that is valid & from a trusted device.
*/
val usable: Boolean = false,
val usable: Boolean,
/**
* Signatures found in the backup version.

View File

@ -413,13 +413,13 @@ internal class DefaultKeysBackupService @Inject constructor(
if (authData == null || authData.publicKey.isEmpty() || authData.signatures.isNullOrEmpty()) {
Timber.v("getKeysBackupTrust: Key backup is absent or missing required data")
return KeysBackupVersionTrust()
return KeysBackupVersionTrust(usable = false)
}
val mySigs = authData.signatures[userId]
if (mySigs.isNullOrEmpty()) {
Timber.v("getKeysBackupTrust: Ignoring key backup because it lacks any signatures from this user")
return KeysBackupVersionTrust()
return KeysBackupVersionTrust(usable = false)
}
var keysBackupVersionTrustIsUsable = false