Sync the MediaRootBackupKey during linking.

This commit is contained in:
Greyson Parrelli
2024-11-19 15:39:39 -05:00
parent cc87da13db
commit 00e749834f
2 changed files with 5 additions and 1 deletions

View File

@@ -156,7 +156,8 @@ object LinkDeviceRepository {
profileKey = ProfileKeyUtil.getSelfProfileKey(), profileKey = ProfileKeyUtil.getSelfProfileKey(),
masterKey = SignalStore.svr.masterKey, masterKey = SignalStore.svr.masterKey,
code = verificationCodeResult.verificationCode, code = verificationCodeResult.verificationCode,
ephemeralMessageBackupKey = ephemeralMessageBackupKey ephemeralMessageBackupKey = ephemeralMessageBackupKey,
mediaRootBackupKey = SignalStore.backup.mediaRootBackupKey
) )
return when (deviceLinkResult) { return when (deviceLinkResult) {

View File

@@ -10,6 +10,7 @@ import org.signal.libsignal.protocol.IdentityKeyPair
import org.signal.libsignal.protocol.ecc.ECPublicKey import org.signal.libsignal.protocol.ecc.ECPublicKey
import org.signal.libsignal.zkgroup.profiles.ProfileKey import org.signal.libsignal.zkgroup.profiles.ProfileKey
import org.whispersystems.signalservice.api.NetworkResult import org.whispersystems.signalservice.api.NetworkResult
import org.whispersystems.signalservice.api.backup.MediaRootBackupKey
import org.whispersystems.signalservice.api.backup.MessageBackupKey import org.whispersystems.signalservice.api.backup.MessageBackupKey
import org.whispersystems.signalservice.api.kbs.MasterKey import org.whispersystems.signalservice.api.kbs.MasterKey
import org.whispersystems.signalservice.api.push.ServiceId.ACI import org.whispersystems.signalservice.api.push.ServiceId.ACI
@@ -62,6 +63,7 @@ class LinkDeviceApi(private val pushServiceSocket: PushServiceSocket) {
pniIdentityKeyPair: IdentityKeyPair, pniIdentityKeyPair: IdentityKeyPair,
profileKey: ProfileKey, profileKey: ProfileKey,
masterKey: MasterKey, masterKey: MasterKey,
mediaRootBackupKey: MediaRootBackupKey,
code: String, code: String,
ephemeralMessageBackupKey: MessageBackupKey? ephemeralMessageBackupKey: MessageBackupKey?
): NetworkResult<Unit> { ): NetworkResult<Unit> {
@@ -79,6 +81,7 @@ class LinkDeviceApi(private val pushServiceSocket: PushServiceSocket) {
provisioningCode = code, provisioningCode = code,
provisioningVersion = ProvisioningVersion.CURRENT.value, provisioningVersion = ProvisioningVersion.CURRENT.value,
masterKey = masterKey.serialize().toByteString(), masterKey = masterKey.serialize().toByteString(),
mediaRootBackupKey = mediaRootBackupKey.value.toByteString(),
ephemeralBackupKey = ephemeralMessageBackupKey?.value?.toByteString() ephemeralBackupKey = ephemeralMessageBackupKey?.value?.toByteString()
) )
val ciphertext = cipher.encrypt(message) val ciphertext = cipher.encrypt(message)