import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
-import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.Closeable;
import java.io.File;
void addDeviceLink(URI linkUri) throws IOException, InvalidDeviceLinkException;
- void setRegistrationLockPin(Optional<String> pin) throws IOException, UnauthenticatedResponseException;
+ void setRegistrationLockPin(Optional<String> pin) throws IOException;
Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws IOException;
public void deleteAccount() throws IOException {
try {
pinHelper.removeRegistrationLockPin();
- } catch (UnauthenticatedResponseException e) {
+ } catch (IOException e) {
logger.warn("Failed to remove registration lock pin");
}
account.setRegistrationLockPin(null, null);
}
@Override
- public void setRegistrationLockPin(java.util.Optional<String> pin) throws IOException, UnauthenticatedResponseException {
+ public void setRegistrationLockPin(java.util.Optional<String> pin) throws IOException {
if (!account.isMasterDevice()) {
throw new RuntimeException("Only master device can set a PIN");
}
public void setRegistrationLockPin(
String pin, MasterKey masterKey
- ) throws IOException, UnauthenticatedResponseException {
+ ) throws IOException {
final var pinChangeSession = keyBackupService.newPinChangeSession();
final var hashedPin = PinHashing.hashPin(pin, pinChangeSession);
- pinChangeSession.setPin(hashedPin, masterKey);
+ try {
+ pinChangeSession.setPin(hashedPin, masterKey);
+ } catch (UnauthenticatedResponseException e) {
+ throw new IOException(e);
+ }
pinChangeSession.enableRegistrationLock(masterKey);
}
- public void removeRegistrationLockPin() throws IOException, UnauthenticatedResponseException {
+ public void removeRegistrationLockPin() throws IOException {
final var pinChangeSession = keyBackupService.newPinChangeSession();
pinChangeSession.disableRegistrationLock();
- pinChangeSession.removePin();
+ try {
+ pinChangeSession.removePin();
+ } catch (UnauthenticatedResponseException e) {
+ throw new IOException(e);
+ }
}
public KbsPinData getRegistrationLockData(
import org.asamk.signal.OutputWriter;
import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.commands.exceptions.IOErrorException;
-import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
import org.asamk.signal.manager.Manager;
-import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.IOException;
import java.util.Optional;
) throws CommandException {
try {
m.setRegistrationLockPin(Optional.empty());
- } catch (UnauthenticatedResponseException e) {
- throw new UnexpectedErrorException("Remove pin failed with unauthenticated response: " + e.getMessage(), e);
} catch (IOException e) {
throw new IOErrorException("Remove pin error: " + e.getMessage(), e);
}
import org.asamk.signal.OutputWriter;
import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.commands.exceptions.IOErrorException;
-import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
import org.asamk.signal.manager.Manager;
-import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.IOException;
import java.util.Optional;
try {
var registrationLockPin = ns.getString("pin");
m.setRegistrationLockPin(Optional.of(registrationLockPin));
- } catch (UnauthenticatedResponseException e) {
- throw new UnexpectedErrorException("Set pin error failed with unauthenticated response: " + e.getMessage(),
- e);
} catch (IOException e) {
throw new IOErrorException("Set pin error: " + e.getMessage(), e);
}
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
import org.whispersystems.signalservice.api.util.UuidUtil;
-import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.File;
import java.io.IOException;
}
@Override
- public void setRegistrationLockPin(final Optional<String> pin) throws IOException, UnauthenticatedResponseException {
+ public void setRegistrationLockPin(final Optional<String> pin) throws IOException {
if (pin.isPresent()) {
signal.setPin(pin.get());
} else {
import org.freedesktop.dbus.types.Variant;
import org.whispersystems.signalservice.api.messages.SendMessageResult;
import org.whispersystems.signalservice.api.util.InvalidNumberException;
-import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.File;
import java.io.IOException;
public void removePin() {
try {
m.setRegistrationLockPin(Optional.empty());
- } 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());
}
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());
}