Merge branch 'master' into dbus_updateaccount

This commit is contained in:
John Freed 2021-09-22 20:31:43 +02:00
commit 46eef01d61
3 changed files with 40 additions and 0 deletions

View file

@ -379,6 +379,19 @@ updateProfile(newName<s>, about <s>, aboutEmoji <s>, avatar<s>, remove<b>) -> <>
Exceptions: Failure
removePin() -> <>::
Removes registration PIN protection.
Exception: Failure
setPin(pin<s>) -> <>::
* pin : PIN you set after registration (resets after 7 days of inactivity)
Sets a registration lock PIN, to prevent others from registering your number.
Exception: Failure
version() -> version<s>::
* version : Version string of signal-cli

View file

@ -95,6 +95,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();

View file

@ -27,6 +27,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;
@ -465,6 +466,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