X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/626406a43c169105c3485749249ffbfd715e3441..c7a7d00da56f8f90fe8d6a11042fa2cd7cb3b985:/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 970a6741..92db1f0f 100644 --- a/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java +++ b/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java @@ -3,6 +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.whispersystems.signalservice.api.KeyBackupService; import org.whispersystems.signalservice.api.SignalServiceAccountManager; @@ -67,6 +68,10 @@ public class SignalDependencies { this.sessionLock = sessionLock; } + public ServiceEnvironmentConfig getServiceEnvironmentConfig() { + return serviceEnvironmentConfig; + } + public SignalServiceAccountManager getAccountManager() { return getOrCreate(() -> accountManager, () -> accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.getSignalServiceConfiguration(), @@ -93,6 +98,11 @@ public class SignalDependencies { : null); } + private ClientZkProfileOperations getClientZkProfileOperations() { + final var clientZkOperations = getClientZkOperations(); + return clientZkOperations == null ? null : clientZkOperations.getProfileOperations(); + } + public SignalWebSocket getSignalWebSocket() { return getOrCreate(() -> signalWebSocket, () -> { final var timer = new UptimeSleepTimer(); @@ -126,7 +136,7 @@ public class SignalDependencies { () -> messageReceiver = new SignalServiceMessageReceiver(serviceEnvironmentConfig.getSignalServiceConfiguration(), credentialsProvider, userAgent, - getClientZkOperations().getProfileOperations(), + getClientZkProfileOperations(), ServiceConfig.AUTOMATIC_NETWORK_RETRY)); } @@ -139,7 +149,7 @@ public class SignalDependencies { userAgent, getSignalWebSocket(), Optional.absent(), - getClientZkOperations().getProfileOperations(), + getClientZkProfileOperations(), executor, ServiceConfig.MAX_ENVELOPE_SIZE, ServiceConfig.AUTOMATIC_NETWORK_RETRY)); @@ -156,7 +166,7 @@ public class SignalDependencies { public ProfileService getProfileService() { return getOrCreate(() -> profileService, - () -> profileService = new ProfileService(getClientZkOperations().getProfileOperations(), + () -> profileService = new ProfileService(getClientZkProfileOperations(), getMessageReceiver(), getSignalWebSocket())); } @@ -164,8 +174,9 @@ public class SignalDependencies { public SignalServiceCipher getCipher() { return getOrCreate(() -> cipher, () -> { final var certificateValidator = new CertificateValidator(serviceEnvironmentConfig.getUnidentifiedSenderTrustRoot()); - final var address = new SignalServiceAddress(credentialsProvider.getUuid(), credentialsProvider.getE164()); - cipher = new SignalServiceCipher(address, dataStore, sessionLock, certificateValidator); + final var address = new SignalServiceAddress(credentialsProvider.getAci(), credentialsProvider.getE164()); + final var deviceId = credentialsProvider.getDeviceId(); + cipher = new SignalServiceCipher(address, deviceId, dataStore, sessionLock, certificateValidator); }); }