X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/ff6b733cd0448c05f4be5aad32895cc8c748ee79..942999b7b4beebf4519eed9b216587519b47e6c6:/lib/src/main/java/org/asamk/signal/manager/ProvisioningManagerImpl.java diff --git a/lib/src/main/java/org/asamk/signal/manager/ProvisioningManagerImpl.java b/lib/src/main/java/org/asamk/signal/manager/ProvisioningManagerImpl.java index e0f1084b..75163555 100644 --- a/lib/src/main/java/org/asamk/signal/manager/ProvisioningManagerImpl.java +++ b/lib/src/main/java/org/asamk/signal/manager/ProvisioningManagerImpl.java @@ -37,6 +37,7 @@ import org.whispersystems.signalservice.internal.util.DynamicCredentialsProvider import java.io.IOException; import java.net.URI; +import java.nio.channels.OverlappingFileLockException; import java.util.concurrent.TimeoutException; import java.util.function.Consumer; @@ -78,7 +79,7 @@ class ProvisioningManagerImpl implements ProvisioningManager { groupsV2Operations = null; } accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.getSignalServiceConfiguration(), - new DynamicCredentialsProvider(null, null, password, SignalServiceAddress.DEFAULT_DEVICE_ID), + new DynamicCredentialsProvider(null, null, null, password, SignalServiceAddress.DEFAULT_DEVICE_ID), userAgent, groupsV2Operations, ServiceConfig.AUTOMATIC_NETWORK_RETRY); @@ -96,6 +97,7 @@ class ProvisioningManagerImpl implements ProvisioningManager { var ret = accountManager.getNewDeviceRegistration(tempIdentityKey); var number = ret.getNumber(); var aci = ret.getAci(); + var pni = ret.getPni(); logger.info("Received link information from {}, linking in progress ...", number); @@ -116,7 +118,7 @@ class ProvisioningManagerImpl implements ProvisioningManager { var encryptedDeviceName = deviceName == null ? null - : DeviceNameUtil.encryptDeviceName(deviceName, ret.getIdentity().getPrivateKey()); + : DeviceNameUtil.encryptDeviceName(deviceName, ret.getAciIdentity().getPrivateKey()); logger.debug("Finishing new device registration"); var deviceId = accountManager.finishNewDeviceRegistration(ret.getProvisioningCode(), @@ -134,10 +136,12 @@ class ProvisioningManagerImpl implements ProvisioningManager { accountPath, number, aci, + pni, password, encryptedDeviceName, deviceId, - ret.getIdentity(), + ret.getAciIdentity(), + ret.getPniIdentity(), registrationId, profileKey, TrustNewIdentity.ON_FIRST_USE); @@ -194,6 +198,9 @@ class ProvisioningManagerImpl implements ProvisioningManager { } catch (IOException e) { logger.debug("Account in use or failed to load.", e); return false; + } catch (OverlappingFileLockException e) { + logger.debug("Account in use.", e); + return false; } try (signalAccount) {