mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-06 22:10:38 +00:00
implement Dbus commands
* String link() * String link(String newDeviceName) * void register(String number, boolean voiceVerification) * void registerWithCaptcha(String number, boolean voiceVerification, String captcha) * void verify(String number, String verificationCode) * void verifyWithPin(String number, String verificationCode, String pin) make dataPath and serviceEnvironment public from App class make USER_AGENT ("signal-cli") public from BaseConfig class add timeout error handling to finishDeviceLink method update DBus documentation
This commit is contained in:
parent
661d78e4a8
commit
2e7f4c7085
9 changed files with 149 additions and 130 deletions
|
@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.util.KeyHelper;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager.NewDeviceRegistrationReturn;
|
||||
import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
|
||||
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
@ -93,11 +94,22 @@ public class ProvisioningManager {
|
|||
}
|
||||
|
||||
public Manager finishDeviceLink(String deviceName) throws IOException, TimeoutException, UserAlreadyExists {
|
||||
var ret = accountManager.getNewDeviceRegistration(tempIdentityKey);
|
||||
var number = ret.getNumber();
|
||||
|
||||
logger.info("Received link information from {}, linking in progress ...", number);
|
||||
|
||||
NewDeviceRegistrationReturn ret = null;
|
||||
String number = null;
|
||||
try {
|
||||
logger.info("Waiting for link request from new device ...");
|
||||
ret = accountManager.getNewDeviceRegistration(tempIdentityKey);
|
||||
number = ret.getNumber();
|
||||
logger.info("Received link information from {}, linking in progress ...", number);
|
||||
} catch (TimeoutException e) {
|
||||
accountManager.cancelInFlightRequests();
|
||||
logger.error("Timeout on linking {}", number);
|
||||
throw e;
|
||||
} catch (IOException f) {
|
||||
accountManager.cancelInFlightRequests();
|
||||
logger.error("Error on linking {}", number);
|
||||
throw f;
|
||||
}
|
||||
if (SignalAccount.userExists(pathConfig.getDataPath(), number) && !canRelinkExistingAccount(number)) {
|
||||
throw new UserAlreadyExists(number, SignalAccount.getFileName(pathConfig.getDataPath(), number));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue