import net.sourceforge.argparse4j.inf.Namespace;
import net.sourceforge.argparse4j.inf.Subparser;
+
import org.asamk.signal.manager.Manager;
import org.whispersystems.libsignal.util.guava.Optional;
+import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.IOException;
@Override
public int handleCommand(final Namespace ns, final Manager m) {
- if (!m.isRegistered()) {
- System.err.println("User is not registered.");
- return 1;
- }
try {
String registrationLockPin = ns.getString("registrationLockPin");
m.setRegistrationLockPin(Optional.of(registrationLockPin));
return 0;
+ } catch (UnauthenticatedResponseException e) {
+ System.err.println("Set pin error: " + e.getMessage());
+ return 2;
} catch (IOException e) {
System.err.println("Set pin error: " + e.getMessage());
return 3;