import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
+import org.whispersystems.signalservice.internal.push.ConfirmCodeMessage;
import org.whispersystems.signalservice.internal.util.DynamicCredentialsProvider;
import java.io.IOException;
private final SignalServiceAccountManager accountManager;
private final IdentityKeyPair tempIdentityKey;
private final int registrationId;
+ private final int pniRegistrationId;
private final String password;
ProvisioningManagerImpl(
tempIdentityKey = KeyUtils.generateIdentityKeyPair();
registrationId = KeyHelper.generateRegistrationId(false);
+ pniRegistrationId = KeyHelper.generateRegistrationId(false);
password = KeyUtils.createPassword();
GroupsV2Operations groupsV2Operations;
try {
logger.debug("Finishing new device registration");
var deviceId = accountManager.finishNewDeviceRegistration(ret.getProvisioningCode(),
- false,
- true,
- registrationId,
- encryptedDeviceName);
+ new ConfirmCodeMessage(false, true, registrationId, pniRegistrationId, encryptedDeviceName, null));
// Create new account with the synced identity
var profileKey = ret.getProfileKey() == null ? KeyUtils.createProfileKey() : ret.getProfileKey();
ret.getAciIdentity(),
ret.getPniIdentity(),
registrationId,
+ pniRegistrationId,
profileKey,
TrustNewIdentity.ON_FIRST_USE);
try {
m.refreshPreKeys();
} catch (Exception e) {
- logger.error("Failed to refresh pre keys.");
+ logger.error("Failed to refresh pre keys.", e);
}
logger.debug("Requesting sync data");
m.requestAllSyncData();
} catch (Exception e) {
logger.error(
- "Failed to request sync messages from linked device, data can be requested again with `sendSyncRequest`.");
+ "Failed to request sync messages from linked device, data can be requested again with `sendSyncRequest`.",
+ e);
}
if (newManagerListener != null) {