Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Fixes after 7.23 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Nov 22, 2024
1 parent 47712f5 commit 3ca7d89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,7 +47,7 @@ class MollySocketLinkedDevice(val context: Context) {
val device = SignalStore.unifiedpush.device ?: return false
val devices: List<Device>?
try {
devices = DeviceListLoader(context, AppDependencies.signalServiceAccountManager).loadInBackground()
devices = LinkDeviceRepository.loadDevices()
} catch (e: IOException) {
Log.e(TAG, "Encountered an IOException", e)
return null
Expand All @@ -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(),
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3ca7d89

Please sign in to comment.