X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/b0bb602eb59eb6238a87d8a4ba942ac3bc0dc90d..08dc65350f069de5f394c62f4dced7e9860f3256:/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java diff --git a/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java b/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java index 450abaac..b892e935 100644 --- a/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java +++ b/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java @@ -3,8 +3,7 @@ package org.asamk.signal.manager; import org.asamk.signal.manager.config.ServiceConfig; import org.asamk.signal.manager.config.ServiceEnvironmentConfig; import org.signal.libsignal.metadata.certificate.CertificateValidator; -import org.signal.zkgroup.profiles.ClientZkProfileOperations; -import org.whispersystems.libsignal.util.guava.Optional; +import org.signal.libsignal.zkgroup.profiles.ClientZkProfileOperations; import org.whispersystems.signalservice.api.KeyBackupService; import org.whispersystems.signalservice.api.SignalServiceAccountManager; import org.whispersystems.signalservice.api.SignalServiceDataStore; @@ -23,6 +22,8 @@ import org.whispersystems.signalservice.api.util.UptimeSleepTimer; import org.whispersystems.signalservice.api.websocket.WebSocketFactory; import org.whispersystems.signalservice.internal.websocket.WebSocketConnection; +import java.util.Collection; +import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.function.Supplier; @@ -88,12 +89,14 @@ public class SignalDependencies { public SignalServiceAccountManager createUnauthenticatedAccountManager(String number, String password) { return new SignalServiceAccountManager(getServiceEnvironmentConfig().getSignalServiceConfiguration(), + null, null, number, SignalServiceAddress.DEFAULT_DEVICE_ID, password, userAgent, - ServiceConfig.AUTOMATIC_NETWORK_RETRY); + ServiceConfig.AUTOMATIC_NETWORK_RETRY, + ServiceConfig.GROUP_MAX_SIZE); } public GroupsV2Api getGroupsV2Api() { @@ -102,8 +105,10 @@ public class SignalDependencies { public GroupsV2Operations getGroupsV2Operations() { return getOrCreate(() -> groupsV2Operations, - () -> groupsV2Operations = capabilities.isGv2() ? new GroupsV2Operations(ClientZkOperations.create( - serviceEnvironmentConfig.getSignalServiceConfiguration())) : null); + () -> groupsV2Operations = capabilities.isGv2() + ? new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.getSignalServiceConfiguration()), + ServiceConfig.GROUP_MAX_SIZE) + : null); } private ClientZkOperations getClientZkOperations() { @@ -136,7 +141,7 @@ public class SignalDependencies { public WebSocketConnection createUnidentifiedWebSocket() { return new WebSocketConnection("unidentified", serviceEnvironmentConfig.getSignalServiceConfiguration(), - Optional.absent(), + Optional.empty(), userAgent, healthMonitor); } @@ -163,7 +168,7 @@ public class SignalDependencies { sessionLock, userAgent, getSignalWebSocket(), - Optional.absent(), + Optional.empty(), getClientZkProfileOperations(), executor, ServiceConfig.MAX_ENVELOPE_SIZE, @@ -179,6 +184,17 @@ public class SignalDependencies { 10)); } + public Collection getFallbackKeyBackupServices() { + return serviceEnvironmentConfig.getFallbackKeyBackupConfigs() + .stream() + .map(config -> getAccountManager().getKeyBackupService(ServiceConfig.getIasKeyStore(), + config.getEnclaveName(), + config.getServiceId(), + config.getMrenclave(), + 10)) + .toList(); + } + public ProfileService getProfileService() { return getOrCreate(() -> profileService, () -> profileService = new ProfileService(getClientZkProfileOperations(),