Refactor register and verify

This commit is contained in:
AsamK 2021-01-10 17:07:06 +01:00
parent 6c8a1ff3d3
commit e74be0c345
33 changed files with 405 additions and 362 deletions

View file

@ -3,14 +3,14 @@ package org.asamk.signal.commands;
import net.sourceforge.argparse4j.inf.Namespace;
import net.sourceforge.argparse4j.inf.Subparser;
import org.asamk.signal.manager.Manager;
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 java.io.IOException;
public class VerifyCommand implements LocalCommand {
public class VerifyCommand implements RegistrationCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
@ -19,11 +19,7 @@ public class VerifyCommand implements LocalCommand {
}
@Override
public int handleCommand(final Namespace ns, final Manager m) {
if (m.isRegistered()) {
System.err.println("User registration is already verified");
return 1;
}
public int handleCommand(final Namespace ns, final RegistrationManager m) {
try {
String verificationCode = ns.getString("verificationCode");
String pin = ns.getString("pin");