Immutable data class. var -> val

This commit is contained in:
Benoit Marty 2022-04-13 18:55:56 +02:00
parent 10b47c33d1
commit 3435357b1c
2 changed files with 20 additions and 21 deletions

View file

@ -20,23 +20,21 @@ import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
/** /**
* A signature in a `KeysBackupVersionTrust` object. * A signature in a `KeysBackupVersionTrust` object.
* TODO Make it a data class with only val
*/ */
class KeysBackupVersionTrustSignature { data class KeysBackupVersionTrustSignature(
/**
* The id of the device that signed the backup version.
*/
val deviceId: String?,
/** /**
* The id of the device that signed the backup version. * The device that signed the backup version.
*/ * Can be null if the device is not known.
var deviceId: String? = null */
val device: CryptoDeviceInfo?,
/** /**
* The device that signed the backup version. * Flag to indicate the signature from this device is valid.
* Can be null if the device is not known. */
*/ val valid: Boolean,
var device: CryptoDeviceInfo? = null )
/**
* Flag to indicate the signature from this device is valid.
*/
var valid = false
}

View file

@ -455,10 +455,11 @@ internal class DefaultKeysBackupService @Inject constructor(
} }
} }
val signature = KeysBackupVersionTrustSignature() val signature = KeysBackupVersionTrustSignature(
signature.device = device deviceId = deviceId,
signature.valid = isSignatureValid device = device,
signature.deviceId = deviceId valid = isSignatureValid,
)
keysBackupVersionTrustSignatures.add(signature) keysBackupVersionTrustSignatures.add(signature)
} }
} }