Catch ProofRequiredException from getPreKeys request and wrap in SendMessageResult

This commit is contained in:
AsamK 2021-09-09 18:54:48 +02:00
parent 0e6644a890
commit a17262d9ff
2 changed files with 4 additions and 1 deletions

View file

@ -22,6 +22,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage
import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage; import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage;
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
import org.whispersystems.signalservice.api.push.exceptions.ProofRequiredException;
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException; import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
import java.io.IOException; import java.io.IOException;
@ -282,6 +283,8 @@ public class SendHelper {
message, message,
SignalServiceMessageSender.IndividualSendEvents.EMPTY); SignalServiceMessageSender.IndividualSendEvents.EMPTY);
} }
} catch (ProofRequiredException e) {
return SendMessageResult.proofRequiredFailure(address, e);
} catch (org.whispersystems.signalservice.api.crypto.UntrustedIdentityException e) { } catch (org.whispersystems.signalservice.api.crypto.UntrustedIdentityException e) {
return SendMessageResult.identityFailure(address, e.getIdentityKey()); return SendMessageResult.identityFailure(address, e.getIdentityKey());
} }

View file

@ -67,7 +67,7 @@ public class ErrorUtils {
} else if (result.getProofRequiredFailure() != null) { } else if (result.getProofRequiredFailure() != null) {
final var failure = result.getProofRequiredFailure(); final var failure = result.getProofRequiredFailure();
return String.format( return String.format(
"CAPTCHA proof required for sending to \"%s\", available options \"%s\" with token \"%s\", or wait \"%d\" seconds", "CAPTCHA proof required for sending to \"%s\", available options \"%s\" with challenge token \"%s\", or wait \"%d\" seconds",
identifier, identifier,
failure.getOptions() failure.getOptions()
.stream() .stream()