mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
parent
6c29d90503
commit
d622967192
4 changed files with 45 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,3 +11,4 @@ local.properties
|
||||||
.settings/
|
.settings/
|
||||||
out/
|
out/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
/bin/
|
||||||
|
|
|
@ -229,6 +229,19 @@ isGroupBlocked(groupId<ay>) -> state<b>::
|
||||||
|
|
||||||
Exceptions: None, for unknown groups 0 (false) is returned
|
Exceptions: None, for unknown groups 0 (false) is returned
|
||||||
|
|
||||||
|
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<s>::
|
||||||
* version : Version string of signal-cli
|
* version : Version string of signal-cli
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package org.asamk;
|
package org.asamk;
|
||||||
|
|
||||||
|
import org.asamk.Signal.Error;
|
||||||
import org.freedesktop.dbus.exceptions.DBusException;
|
import org.freedesktop.dbus.exceptions.DBusException;
|
||||||
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
||||||
import org.freedesktop.dbus.interfaces.DBusInterface;
|
import org.freedesktop.dbus.interfaces.DBusInterface;
|
||||||
import org.freedesktop.dbus.messages.DBusSignal;
|
import org.freedesktop.dbus.messages.DBusSignal;
|
||||||
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,6 +90,10 @@ public interface Signal extends DBusInterface {
|
||||||
String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
|
String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
|
||||||
) throws Error.Failure;
|
) throws Error.Failure;
|
||||||
|
|
||||||
|
void removePin();
|
||||||
|
|
||||||
|
void setPin(String registrationLockPin);
|
||||||
|
|
||||||
String version();
|
String version();
|
||||||
|
|
||||||
List<String> listNumbers();
|
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.manager.storage.identities.IdentityInfo;
|
||||||
import org.asamk.signal.util.ErrorUtils;
|
import org.asamk.signal.util.ErrorUtils;
|
||||||
import org.asamk.signal.util.Util;
|
import org.asamk.signal.util.Util;
|
||||||
|
|
||||||
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
||||||
import org.whispersystems.libsignal.util.Pair;
|
import org.whispersystems.libsignal.util.Pair;
|
||||||
import org.whispersystems.libsignal.util.guava.Optional;
|
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.messages.SendMessageResult;
|
||||||
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
||||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||||
|
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
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
|
// Provide option to query a version string in order to react on potential
|
||||||
// future interface changes
|
// future interface changes
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue