]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/VerifyCommand.java
Fix expectedV2Id serialization
[signal-cli] / src / main / java / org / asamk / signal / commands / VerifyCommand.java
index 0f3363252bbd204b6abedfd0edaeae07a44c2c08..d4b0a7cb3169f0bfc806c9a1fabafbfac9169f52 100644 (file)
@@ -4,6 +4,8 @@ import net.sourceforge.argparse4j.inf.Namespace;
 import net.sourceforge.argparse4j.inf.Subparser;
 
 import org.asamk.signal.manager.Manager;
+import org.whispersystems.signalservice.api.KeyBackupServicePinException;
+import org.whispersystems.signalservice.api.KeyBackupSystemNoDataException;
 import org.whispersystems.signalservice.internal.push.LockedException;
 
 import java.io.IOException;
@@ -12,10 +14,8 @@ public class VerifyCommand implements LocalCommand {
 
     @Override
     public void attachToSubparser(final Subparser subparser) {
-        subparser.addArgument("verificationCode")
-                .help("The verification code you received via sms or voice call.");
-        subparser.addArgument("-p", "--pin")
-                .help("The registration lock PIN, that was set by the user (Optional)");
+        subparser.addArgument("verificationCode").help("The verification code you received via sms or voice call.");
+        subparser.addArgument("-p", "--pin").help("The registration lock PIN, that was set by the user (Optional)");
     }
 
     @Override
@@ -30,8 +30,15 @@ public class VerifyCommand implements LocalCommand {
             m.verifyAccount(verificationCode, pin);
             return 0;
         } catch (LockedException e) {
-            System.err.println("Verification failed! This number is locked with a pin. Hours remaining until reset: " + (e.getTimeRemaining() / 1000 / 60 / 60));
+            System.err.println("Verification failed! This number is locked with a pin. Hours remaining until reset: "
+                    + (e.getTimeRemaining() / 1000 / 60 / 60));
             System.err.println("Use '--pin PIN_CODE' to specify the registration lock PIN");
+            return 1;
+        } catch (KeyBackupServicePinException e) {
+            System.err.println("Verification failed! Invalid pin, tries remaining: " + e.getTriesRemaining());
+            return 1;
+        } catch (KeyBackupSystemNoDataException e) {
+            System.err.println("Verification failed! No KBS data.");
             return 3;
         } catch (IOException e) {
             System.err.println("Verify error: " + e.getMessage());