mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
6c29d90503
commit
d622967192
4 changed files with 45 additions and 0 deletions
|
@ -1,10 +1,13 @@
|
|||
package org.asamk;
|
||||
|
||||
import org.asamk.Signal.Error;
|
||||
import org.freedesktop.dbus.exceptions.DBusException;
|
||||
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
||||
import org.freedesktop.dbus.interfaces.DBusInterface;
|
||||
import org.freedesktop.dbus.messages.DBusSignal;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -87,6 +90,10 @@ public interface Signal extends DBusInterface {
|
|||
String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
|
||||
) throws Error.Failure;
|
||||
|
||||
void removePin();
|
||||
|
||||
void setPin(String registrationLockPin);
|
||||
|
||||
String version();
|
||||
|
||||
List<String> listNumbers();
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.asamk.signal.manager.groups.NotAGroupMemberException;
|
|||
import org.asamk.signal.manager.storage.identities.IdentityInfo;
|
||||
import org.asamk.signal.util.ErrorUtils;
|
||||
import org.asamk.signal.util.Util;
|
||||
|
||||
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
||||
import org.whispersystems.libsignal.util.Pair;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
@ -25,6 +26,7 @@ import org.whispersystems.signalservice.api.groupsv2.GroupLinkNotActiveException
|
|||
import org.whispersystems.signalservice.api.messages.SendMessageResult;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -413,6 +415,28 @@ public class DbusSignalImpl implements Signal {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePin() {
|
||||
try {
|
||||
m.setRegistrationLockPin(Optional.absent());
|
||||
} catch (UnauthenticatedResponseException e) {
|
||||
throw new Error.Failure("Remove pin failed with unauthenticated response: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure("Remove pin error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPin(String registrationLockPin) {
|
||||
try {
|
||||
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
||||
} catch (UnauthenticatedResponseException e) {
|
||||
throw new Error.Failure("Set pin error failed with unauthenticated response: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure("Set pin error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Provide option to query a version string in order to react on potential
|
||||
// future interface changes
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue