From 3ca7d89853b3f1f408ef1e0ad3f9925a69371554 Mon Sep 17 00:00:00 2001 From: Oscar Mira Date: Fri, 22 Nov 2024 20:29:25 +0100 Subject: [PATCH] Fixes after 7.23 merge --- .../device/MollySocketLinkedDevice.kt | 11 +++++------ .../api/SignalServiceAccountManager.java | 16 +++++----------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/app/src/unifiedpush/java/im/molly/unifiedpush/device/MollySocketLinkedDevice.kt b/app/src/unifiedpush/java/im/molly/unifiedpush/device/MollySocketLinkedDevice.kt index cd05a78377..26ed89892c 100644 --- a/app/src/unifiedpush/java/im/molly/unifiedpush/device/MollySocketLinkedDevice.kt +++ b/app/src/unifiedpush/java/im/molly/unifiedpush/device/MollySocketLinkedDevice.kt @@ -7,15 +7,14 @@ import org.signal.core.util.Base64 import org.signal.core.util.logging.Log import org.signal.libsignal.protocol.util.KeyHelper import org.thoughtcrime.securesms.AppCapabilities -import org.thoughtcrime.securesms.database.loaders.DeviceListLoader import org.thoughtcrime.securesms.dependencies.AppDependencies -import org.thoughtcrime.securesms.devicelist.Device import org.thoughtcrime.securesms.keyvalue.PhoneNumberPrivacyValues import org.thoughtcrime.securesms.keyvalue.SignalStore +import org.thoughtcrime.securesms.linkdevice.Device +import org.thoughtcrime.securesms.linkdevice.LinkDeviceRepository import org.thoughtcrime.securesms.push.AccountManagerFactory import org.thoughtcrime.securesms.registration.data.RegistrationRepository import org.thoughtcrime.securesms.registration.secondary.DeviceNameCipher -import org.thoughtcrime.securesms.util.TextSecurePreferences import org.thoughtcrime.securesms.util.Util import org.whispersystems.signalservice.api.account.AccountAttributes import org.whispersystems.signalservice.api.push.SignalServiceAddress @@ -48,7 +47,7 @@ class MollySocketLinkedDevice(val context: Context) { val device = SignalStore.unifiedpush.device ?: return false val devices: List? try { - devices = DeviceListLoader(context, AppDependencies.signalServiceAccountManager).loadInBackground() + devices = LinkDeviceRepository.loadDevices() } catch (e: IOException) { Log.e(TAG, "Encountered an IOException", e) return null @@ -68,7 +67,7 @@ class MollySocketLinkedDevice(val context: Context) { val password = Util.getSecret(18) val deviceId = verifyNewDevice(number, password) - TextSecurePreferences.setMultiDevice(context, true) + SignalStore.account.hasLinkedDevices = true SignalStore.unifiedpush.device = MollyDevice( uuid = SignalStore.account.aci.toString(), @@ -113,7 +112,7 @@ class MollySocketLinkedDevice(val context: Context) { val pniPreKeyCollection = RegistrationRepository.generateSignedAndLastResortPreKeys(SignalStore.account.pniIdentityKey, SignalStore.account.pniPreKeys) return accountManager.finishNewDeviceRegistration( - verificationCode, + verificationCode.verificationCode, accountAttributes, aciPreKeyCollection, pniPreKeyCollection, null diff --git a/libsignal-service/src/main/java/org/whispersystems/signalservice/api/SignalServiceAccountManager.java b/libsignal-service/src/main/java/org/whispersystems/signalservice/api/SignalServiceAccountManager.java index 9964a70d5f..9cc57e5e13 100644 --- a/libsignal-service/src/main/java/org/whispersystems/signalservice/api/SignalServiceAccountManager.java +++ b/libsignal-service/src/main/java/org/whispersystems/signalservice/api/SignalServiceAccountManager.java @@ -25,8 +25,6 @@ import org.signal.libsignal.zkgroup.InvalidInputException; import org.signal.libsignal.zkgroup.profiles.ProfileKey; import org.whispersystems.signalservice.api.account.AccountAttributes; -import org.whispersystems.signalservice.api.account.ChangePhoneNumberRequest; -import org.whispersystems.signalservice.api.account.PniKeyDistributionRequest; import org.whispersystems.signalservice.api.account.PreKeyCollection; import org.whispersystems.signalservice.api.account.PreKeyUpload; import org.whispersystems.signalservice.api.crypto.ProfileCipher; @@ -36,7 +34,7 @@ import org.whispersystems.signalservice.api.groupsv2.GroupsV2Api; import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations; import org.whispersystems.signalservice.api.kbs.MasterKey; -import org.whispersystems.signalservice.api.keys.KeysApi; +import org.whispersystems.signalservice.api.link.LinkedDeviceVerificationCodeResponse; import org.whispersystems.signalservice.api.messages.calls.TurnServerInfo; import org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo; import org.whispersystems.signalservice.api.payments.CurrencyConversions; @@ -69,8 +67,6 @@ import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration; import org.whispersystems.signalservice.internal.crypto.PrimaryProvisioningCipher; import org.whispersystems.signalservice.internal.push.AuthCredentials; -import org.whispersystems.signalservice.internal.push.BackupAuthCheckRequest; -import org.whispersystems.signalservice.internal.push.BackupV2AuthCheckResponse; import org.whispersystems.signalservice.internal.push.CdsiAuthResponse; import org.whispersystems.signalservice.internal.push.OneTimePreKeyCounts; import org.whispersystems.signalservice.internal.push.PaymentAddress; @@ -80,10 +76,8 @@ import org.whispersystems.signalservice.internal.push.ProvisioningUuid; import org.whispersystems.signalservice.internal.push.ProvisioningVersion; import org.whispersystems.signalservice.internal.push.PushServiceSocket; -import org.whispersystems.signalservice.internal.push.RegistrationSessionMetadataResponse; import org.whispersystems.signalservice.internal.push.RemoteConfigResponse; import org.whispersystems.signalservice.internal.push.ReserveUsernameResponse; -import org.whispersystems.signalservice.internal.push.VerifyAccountResponse; import org.whispersystems.signalservice.internal.push.WhoAmIResponse; import org.whispersystems.signalservice.internal.push.http.ProfileCipherOutputStreamFactory; import org.whispersystems.signalservice.internal.storage.protos.ManifestRecord; @@ -93,12 +87,8 @@ import org.whispersystems.signalservice.internal.storage.protos.StorageManifest; import org.whispersystems.signalservice.internal.storage.protos.WriteOperation; import org.whispersystems.signalservice.internal.util.StaticCredentialsProvider; -import org.whispersystems.signalservice.internal.util.Util; -import org.whispersystems.signalservice.internal.websocket.DefaultResponseMapper; import java.io.IOException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -533,6 +523,10 @@ public String getAccountDataReport() throws IOException { return pushServiceSocket.getAccountDataReport(); } + public LinkedDeviceVerificationCodeResponse getNewDeviceVerificationCode() throws IOException { + return this.pushServiceSocket.getLinkedDeviceVerificationCode(); + } + /** * Request a UUID from the server for linking as a new device. * Called by the new device.