mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
32 lines
982 B
Java
32 lines
982 B
Java
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.whispersystems.libsignal.util.guava.Optional;
|
|
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class RemovePinCommand implements LocalCommand {
|
|
|
|
@Override
|
|
public void attachToSubparser(final Subparser subparser) {
|
|
}
|
|
|
|
@Override
|
|
public int handleCommand(final Namespace ns, final Manager m) {
|
|
if (!m.isRegistered()) {
|
|
System.err.println("User is not registered.");
|
|
return 1;
|
|
}
|
|
try {
|
|
m.setRegistrationLockPin(Optional.absent());
|
|
return 0;
|
|
} catch (IOException | UnauthenticatedResponseException e) {
|
|
System.err.println("Remove pin error: " + e.getMessage());
|
|
return 3;
|
|
}
|
|
}
|
|
}
|