import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.commands.exceptions.IOErrorException;
-import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.RegistrationManager;
-import org.whispersystems.signalservice.api.KeyBackupServicePinException;
-import org.whispersystems.signalservice.api.KeyBackupSystemNoDataException;
-import org.whispersystems.signalservice.internal.push.LockedException;
+import org.asamk.signal.manager.api.IncorrectPinException;
+import org.asamk.signal.manager.api.PinLockedException;
import java.io.IOException;
var pin = ns.getString("pin");
try {
- final var manager = m.verifyAccount(verificationCode, pin);
- manager.close();
- } catch (LockedException e) {
+ m.verifyAccount(verificationCode, pin);
+ } catch (PinLockedException e) {
throw new UserErrorException(
"Verification failed! This number is locked with a pin. Hours remaining until reset: "
+ (e.getTimeRemaining() / 1000 / 60 / 60)
+ "\nUse '--pin PIN_CODE' to specify the registration lock PIN");
- } catch (KeyBackupServicePinException e) {
+ } catch (IncorrectPinException e) {
throw new UserErrorException("Verification failed! Invalid pin, tries remaining: " + e.getTriesRemaining());
- } catch (KeyBackupSystemNoDataException e) {
- throw new UnexpectedErrorException("Verification failed! No KBS data.", e);
} catch (IOException e) {
throw new IOErrorException("Verify error: " + e.getMessage(), e);
}