Add partial support for operating as a linked device.

This commit is contained in:
Cody Henthorne
2022-01-11 14:53:21 -05:00
committed by Greyson Parrelli
parent 112f4bb281
commit 7203228626
33 changed files with 569 additions and 109 deletions

View File

@@ -37,6 +37,7 @@ import org.whispersystems.libsignal.state.SessionStore;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.SignalSessionLock;
import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import java.util.List;
@@ -144,7 +145,7 @@ public final class IdentityUtil {
public static void saveIdentity(String user, IdentityKey identityKey) {
try(SignalSessionLock.Lock unused = ReentrantSessionLock.INSTANCE.acquire()) {
SessionStore sessionStore = ApplicationDependencies.getSessionStore();
SignalProtocolAddress address = new SignalProtocolAddress(user, 1);
SignalProtocolAddress address = new SignalProtocolAddress(user, SignalServiceAddress.DEFAULT_DEVICE_ID);
if (ApplicationDependencies.getIdentityStore().saveIdentity(address, identityKey)) {
if (sessionStore.containsSession(address)) {

View File

@@ -11,6 +11,7 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.push.AccountManagerFactory;
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.websocket.WebSocketConnectionState;
import org.whispersystems.signalservice.internal.configuration.SignalProxy;
@@ -152,7 +153,7 @@ public final class SignalProxyUtil {
private static boolean testWebsocketConnectionUnregistered(long timeout) {
CountDownLatch latch = new CountDownLatch(1);
AtomicBoolean success = new AtomicBoolean(false);
SignalServiceAccountManager accountManager = AccountManagerFactory.createUnauthenticated(ApplicationDependencies.getApplication(), "", "");
SignalServiceAccountManager accountManager = AccountManagerFactory.createUnauthenticated(ApplicationDependencies.getApplication(), "", SignalServiceAddress.DEFAULT_DEVICE_ID, "");
SignalExecutors.UNBOUNDED.execute(() -> {
try {