Update libsignal-service-java

This commit is contained in:
AsamK 2022-03-16 21:04:14 +01:00
parent 3c2fa65e05
commit 942999b7b4
15 changed files with 60 additions and 52 deletions

View file

@ -2484,6 +2484,7 @@
{"name":"nullMessage_"}, {"name":"nullMessage_"},
{"name":"receiptMessage_"}, {"name":"receiptMessage_"},
{"name":"senderKeyDistributionMessage_"}, {"name":"senderKeyDistributionMessage_"},
{"name":"storyMessage_"},
{"name":"syncMessage_"}, {"name":"syncMessage_"},
{"name":"typingMessage_"} {"name":"typingMessage_"}
] ]
@ -2626,22 +2627,10 @@
{"name":"receipt_"} {"name":"receipt_"}
] ]
}, },
{
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Preview",
"fields":[
{"name":"bitField0_"},
{"name":"date_"},
{"name":"description_"},
{"name":"image_"},
{"name":"title_"},
{"name":"url_"}
]
},
{ {
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Quote", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Quote",
"fields":[ "fields":[
{"name":"attachments_"}, {"name":"attachments_"},
{"name":"authorE164_"},
{"name":"authorUuid_"}, {"name":"authorUuid_"},
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"bodyRanges_"}, {"name":"bodyRanges_"},
@ -2763,6 +2752,17 @@
{"name":"padding_"} {"name":"padding_"}
] ]
}, },
{
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$Preview",
"fields":[
{"name":"bitField0_"},
{"name":"date_"},
{"name":"description_"},
{"name":"image_"},
{"name":"title_"},
{"name":"url_"}
]
},
{ {
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$ReceiptMessage", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$ReceiptMessage",
"fields":[ "fields":[
@ -2846,7 +2846,6 @@
"fields":[ "fields":[
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"groupId_"}, {"name":"groupId_"},
{"name":"threadE164_"},
{"name":"threadUuid_"}, {"name":"threadUuid_"},
{"name":"type_"} {"name":"type_"}
] ]
@ -2863,7 +2862,6 @@
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Read", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Read",
"fields":[ "fields":[
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"senderE164_"},
{"name":"senderUuid_"}, {"name":"senderUuid_"},
{"name":"timestamp_"} {"name":"timestamp_"}
] ]
@ -2879,7 +2877,6 @@
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Sent", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Sent",
"fields":[ "fields":[
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"destinationE164_"},
{"name":"destinationUuid_"}, {"name":"destinationUuid_"},
{"name":"expirationStartTimestamp_"}, {"name":"expirationStartTimestamp_"},
{"name":"isRecipientUpdate_"}, {"name":"isRecipientUpdate_"},
@ -2892,7 +2889,6 @@
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Sent$UnidentifiedDeliveryStatus", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Sent$UnidentifiedDeliveryStatus",
"fields":[ "fields":[
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"destinationE164_"},
{"name":"destinationUuid_"}, {"name":"destinationUuid_"},
{"name":"unidentified_"} {"name":"unidentified_"}
] ]
@ -2910,7 +2906,6 @@
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$ViewOnceOpen", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$ViewOnceOpen",
"fields":[ "fields":[
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"senderE164_"},
{"name":"senderUuid_"}, {"name":"senderUuid_"},
{"name":"timestamp_"} {"name":"timestamp_"}
] ]
@ -2919,7 +2914,6 @@
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Viewed", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Viewed",
"fields":[ "fields":[
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"senderE164_"},
{"name":"senderUuid_"}, {"name":"senderUuid_"},
{"name":"timestamp_"} {"name":"timestamp_"}
] ]
@ -2937,7 +2931,6 @@
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$Verified", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$Verified",
"fields":[ "fields":[
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"destinationE164_"},
{"name":"destinationUuid_"}, {"name":"destinationUuid_"},
{"name":"identityKey_"}, {"name":"identityKey_"},
{"name":"nullMessage_"}, {"name":"nullMessage_"},
@ -3104,6 +3097,10 @@
"name":"org.whispersystems.signalservice.internal.util.JsonUtil$IdentityKeySerializer", "name":"org.whispersystems.signalservice.internal.util.JsonUtil$IdentityKeySerializer",
"methods":[{"name":"<init>","parameterTypes":[] }] "methods":[{"name":"<init>","parameterTypes":[] }]
}, },
{
"name":"org.whispersystems.signalservice.internal.util.JsonUtil$ServiceIdDeserializer",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{ {
"name":"org.whispersystems.signalservice.internal.util.JsonUtil$UuidDeserializer", "name":"org.whispersystems.signalservice.internal.util.JsonUtil$UuidDeserializer",
"methods":[{"name":"<init>","parameterTypes":[] }] "methods":[{"name":"<init>","parameterTypes":[] }]

View file

@ -14,7 +14,7 @@ repositories {
} }
dependencies { dependencies {
implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_43") implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_44")
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.1") implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.1")
implementation("com.google.protobuf", "protobuf-javalite", "3.11.4") implementation("com.google.protobuf", "protobuf-javalite", "3.11.4")
implementation("org.bouncycastle", "bcprov-jdk15on", "1.70") implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")

View file

@ -13,6 +13,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
import org.whispersystems.signalservice.api.messages.SignalServiceGroup; import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
import org.whispersystems.signalservice.api.messages.SignalServiceGroupContext; import org.whispersystems.signalservice.api.messages.SignalServiceGroupContext;
import org.whispersystems.signalservice.api.messages.SignalServicePreview;
import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage; 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.calls.AnswerMessage; import org.whispersystems.signalservice.api.messages.calls.AnswerMessage;
@ -242,7 +243,7 @@ public record MessageEnvelope(
RecipientResolver recipientResolver, RecipientResolver recipientResolver,
RecipientAddressResolver addressResolver RecipientAddressResolver addressResolver
) { ) {
return new Mention(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(mention.getAci())), return new Mention(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(mention.getServiceId())),
mention.getStart(), mention.getStart(),
mention.getLength()); mention.getLength());
} }
@ -481,7 +482,7 @@ public record MessageEnvelope(
public record Preview(String title, String description, long date, String url, Optional<Attachment> image) { public record Preview(String title, String description, long date, String url, Optional<Attachment> image) {
static Preview from( static Preview from(
SignalServiceDataMessage.Preview preview, final AttachmentFileProvider fileProvider SignalServicePreview preview, final AttachmentFileProvider fileProvider
) { ) {
return new Preview(preview.getTitle(), return new Preview(preview.getTitle(),
preview.getDescription(), preview.getDescription(),

View file

@ -11,29 +11,30 @@ public record SendMessageResult(
boolean isNetworkFailure, boolean isNetworkFailure,
boolean isUnregisteredFailure, boolean isUnregisteredFailure,
boolean isIdentityFailure, boolean isIdentityFailure,
boolean isRateLimitFailure,
ProofRequiredException proofRequiredFailure ProofRequiredException proofRequiredFailure
) { ) {
public static SendMessageResult success(RecipientAddress address) { public static SendMessageResult success(RecipientAddress address) {
return new SendMessageResult(address, true, false, false, false, null); return new SendMessageResult(address, true, false, false, false, false, null);
} }
public static SendMessageResult networkFailure(RecipientAddress address) { public static SendMessageResult networkFailure(RecipientAddress address) {
return new SendMessageResult(address, false, true, false, false, null); return new SendMessageResult(address, false, true, false, false, false, null);
} }
public static SendMessageResult unregisteredFailure(RecipientAddress address) { public static SendMessageResult unregisteredFailure(RecipientAddress address) {
return new SendMessageResult(address, false, false, true, false, null); return new SendMessageResult(address, false, false, true, false, false, null);
} }
public static SendMessageResult identityFailure(RecipientAddress address, IdentityKey identityKey) { public static SendMessageResult identityFailure(RecipientAddress address, IdentityKey identityKey) {
return new SendMessageResult(address, false, false, false, true, null); return new SendMessageResult(address, false, false, false, true, false, null);
} }
public static SendMessageResult proofRequiredFailure( public static SendMessageResult proofRequiredFailure(
RecipientAddress address, ProofRequiredException proofRequiredException RecipientAddress address, ProofRequiredException proofRequiredException
) { ) {
return new SendMessageResult(address, false, true, false, false, proofRequiredException); return new SendMessageResult(address, false, true, false, false, false, proofRequiredException);
} }
public static SendMessageResult from( public static SendMessageResult from(
@ -47,10 +48,9 @@ public record SendMessageResult(
sendMessageResult.isNetworkFailure(), sendMessageResult.isNetworkFailure(),
sendMessageResult.isUnregisteredFailure(), sendMessageResult.isUnregisteredFailure(),
sendMessageResult.getIdentityFailure() != null, sendMessageResult.getIdentityFailure() != null,
sendMessageResult.getRateLimitFailure() != null,
sendMessageResult.getProofRequiredFailure() == null sendMessageResult.getProofRequiredFailure() == null
? null ? null
: new ProofRequiredException(sendMessageResult.getProofRequiredFailure())); : new ProofRequiredException(sendMessageResult.getProofRequiredFailure()));
} }
public record IdentityFailure(IdentityKey identityKey) {}
} }

View file

@ -30,7 +30,7 @@ public class ServiceConfig {
public static final AccountAttributes.Capabilities capabilities; public static final AccountAttributes.Capabilities capabilities;
static { static {
capabilities = new AccountAttributes.Capabilities(false, true, false, true, true, true, true); capabilities = new AccountAttributes.Capabilities(false, true, false, true, true, true, true, false);
try { try {
TrustStore contactTrustStore = new IasTrustStore(); TrustStore contactTrustStore = new IasTrustStore();

View file

@ -41,8 +41,8 @@ import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStre
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage; import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.signalservice.api.messages.SignalServiceGroup; import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
import org.whispersystems.signalservice.api.messages.SignalServiceGroupV2; import org.whispersystems.signalservice.api.messages.SignalServiceGroupV2;
import org.whispersystems.signalservice.api.push.ACI;
import org.whispersystems.signalservice.api.push.DistributionId; import org.whispersystems.signalservice.api.push.DistributionId;
import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.exceptions.ConflictException; import org.whispersystems.signalservice.api.push.exceptions.ConflictException;
import java.io.File; import java.io.File;
@ -391,8 +391,8 @@ public class GroupHelper {
private void storeProfileKeysFromMembers(final DecryptedGroup group) { private void storeProfileKeysFromMembers(final DecryptedGroup group) {
for (var member : group.getMembersList()) { for (var member : group.getMembersList()) {
final var aci = ACI.fromByteString(member.getUuid()); final var serviceId = ServiceId.fromByteString(member.getUuid());
final var recipientId = account.getRecipientStore().resolveRecipient(aci); final var recipientId = account.getRecipientStore().resolveRecipient(serviceId);
try { try {
account.getProfileStore() account.getProfileStore()
.storeProfileKey(recipientId, new ProfileKey(member.getProfileKey().toByteArray())); .storeProfileKey(recipientId, new ProfileKey(member.getProfileKey().toByteArray()));

View file

@ -12,6 +12,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.whispersystems.libsignal.InvalidKeyException; import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.signalservice.api.push.ACI; import org.whispersystems.signalservice.api.push.ACI;
import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.internal.contacts.crypto.Quote; import org.whispersystems.signalservice.internal.contacts.crypto.Quote;
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedQuoteException; import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedQuoteException;
@ -75,7 +76,7 @@ public class RecipientHelper {
public RecipientId resolveRecipient(final RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException { public RecipientId resolveRecipient(final RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException {
if (recipient instanceof RecipientIdentifier.Uuid uuidRecipient) { if (recipient instanceof RecipientIdentifier.Uuid uuidRecipient) {
return account.getRecipientStore().resolveRecipient(ACI.from(uuidRecipient.uuid())); return account.getRecipientStore().resolveRecipient(ServiceId.from(uuidRecipient.uuid()));
} else { } else {
final var number = ((RecipientIdentifier.Number) recipient).number(); final var number = ((RecipientIdentifier.Number) recipient).number();
return account.getRecipientStore().resolveRecipient(number, () -> { return account.getRecipientStore().resolveRecipient(number, () -> {

View file

@ -190,9 +190,10 @@ public class SendHelper {
SignalServiceTypingMessage message, RecipientId recipientId SignalServiceTypingMessage message, RecipientId recipientId
) { ) {
final var result = handleSendMessage(recipientId, final var result = handleSendMessage(recipientId,
(messageSender, address, unidentifiedAccess) -> messageSender.sendTyping(address, (messageSender, address, unidentifiedAccess) -> messageSender.sendTyping(List.of(address),
unidentifiedAccess, List.of(unidentifiedAccess),
message)); message,
null).get(0));
handleSendMessageResult(result); handleSendMessageResult(result);
return result; return result;
} }

View file

@ -10,8 +10,8 @@ import org.signal.storageservice.protos.groups.Member;
import org.signal.storageservice.protos.groups.local.DecryptedGroup; import org.signal.storageservice.protos.groups.local.DecryptedGroup;
import org.signal.storageservice.protos.groups.local.EnabledState; import org.signal.storageservice.protos.groups.local.EnabledState;
import org.signal.zkgroup.groups.GroupMasterKey; import org.signal.zkgroup.groups.GroupMasterKey;
import org.whispersystems.signalservice.api.push.ACI;
import org.whispersystems.signalservice.api.push.DistributionId; import org.whispersystems.signalservice.api.push.DistributionId;
import org.whispersystems.signalservice.api.push.ServiceId;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -112,7 +112,7 @@ public final class GroupInfoV2 extends GroupInfo {
} }
return group.getMembersList() return group.getMembersList()
.stream() .stream()
.map(m -> ACI.fromByteString(m.getUuid())) .map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient) .map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
@ -124,7 +124,7 @@ public final class GroupInfoV2 extends GroupInfo {
} }
return group.getPendingMembersList() return group.getPendingMembersList()
.stream() .stream()
.map(m -> ACI.fromByteString(m.getUuid())) .map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient) .map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
@ -136,7 +136,7 @@ public final class GroupInfoV2 extends GroupInfo {
} }
return group.getRequestingMembersList() return group.getRequestingMembersList()
.stream() .stream()
.map(m -> ACI.fromByteString(m.getUuid())) .map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient) .map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
@ -149,7 +149,7 @@ public final class GroupInfoV2 extends GroupInfo {
return group.getMembersList() return group.getMembersList()
.stream() .stream()
.filter(m -> m.getRole() == Member.Role.ADMINISTRATOR) .filter(m -> m.getRole() == Member.Role.ADMINISTRATOR)
.map(m -> ACI.fromByteString(m.getUuid())) .map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient) .map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }

View file

@ -1,6 +1,6 @@
package org.asamk.signal.manager.storage.recipients; package org.asamk.signal.manager.storage.recipients;
import org.whispersystems.signalservice.api.push.ACI; import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import java.util.Optional; import java.util.Optional;
@ -8,7 +8,7 @@ import java.util.UUID;
public record RecipientAddress(Optional<UUID> uuid, Optional<String> number) { public record RecipientAddress(Optional<UUID> uuid, Optional<String> number) {
public static final UUID UNKNOWN_UUID = ACI.UNKNOWN.uuid(); public static final UUID UNKNOWN_UUID = ServiceId.UNKNOWN.uuid();
/** /**
* Construct a RecipientAddress. * Construct a RecipientAddress.
@ -62,7 +62,7 @@ public record RecipientAddress(Optional<UUID> uuid, Optional<String> number) {
} }
public SignalServiceAddress toSignalServiceAddress() { public SignalServiceAddress toSignalServiceAddress() {
return new SignalServiceAddress(ACI.from(uuid.orElse(UNKNOWN_UUID)), return new SignalServiceAddress(ServiceId.from(uuid.orElse(UNKNOWN_UUID)),
org.whispersystems.libsignal.util.guava.Optional.fromNullable(number.orElse(null))); org.whispersystems.libsignal.util.guava.Optional.fromNullable(number.orElse(null)));
} }
} }

View file

@ -2,7 +2,7 @@ package org.asamk.signal.manager.util;
import org.whispersystems.libsignal.util.guava.Optional; import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
import org.whispersystems.signalservice.api.push.ACI; import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import java.io.DataInputStream; import java.io.DataInputStream;
@ -23,9 +23,9 @@ public class MessageCacheUtils {
} }
var type = in.readInt(); var type = in.readInt();
var source = in.readUTF(); var source = in.readUTF();
ACI sourceAci = null; ServiceId sourceServiceId = null;
if (version >= 3) { if (version >= 3) {
sourceAci = ACI.parseOrNull(in.readUTF()); sourceServiceId = ServiceId.parseOrNull(in.readUTF());
} }
var sourceDevice = in.readInt(); var sourceDevice = in.readInt();
if (version == 1) { if (version == 1) {
@ -58,9 +58,9 @@ public class MessageCacheUtils {
if (version >= 4) { if (version >= 4) {
serverDeliveredTimestamp = in.readLong(); serverDeliveredTimestamp = in.readLong();
} }
Optional<SignalServiceAddress> addressOptional = sourceAci == null Optional<SignalServiceAddress> addressOptional = sourceServiceId == null
? Optional.absent() ? Optional.absent()
: Optional.of(new SignalServiceAddress(sourceAci, source)); : Optional.of(new SignalServiceAddress(sourceServiceId, source));
return new SignalServiceEnvelope(type, return new SignalServiceEnvelope(type,
addressOptional, addressOptional,
sourceDevice, sourceDevice,

View file

@ -35,7 +35,7 @@ public class ProfileUtils {
getUnidentifiedAccessMode(encryptedProfile, profileCipher), getUnidentifiedAccessMode(encryptedProfile, profileCipher),
getCapabilities(encryptedProfile)); getCapabilities(encryptedProfile));
} catch (InvalidCiphertextException e) { } catch (InvalidCiphertextException e) {
logger.debug("Failed to decrypt profile for {}", encryptedProfile.getAci(), e); logger.debug("Failed to decrypt profile for {}", encryptedProfile.getServiceId(), e);
return null; return null;
} }
} }

View file

@ -93,6 +93,7 @@ The verification should be done over voice, not SMS.
*--captcha*:: *--captcha*::
The captcha token, required if registration failed with a captcha required error. The captcha token, required if registration failed with a captcha required error.
To get the token, go to https://signalcaptchas.org/registration/generate.html To get the token, go to https://signalcaptchas.org/registration/generate.html
For the staging environment, use: https://signalcaptchas.org/staging/registration/generate.html
Check the developer tools for a redirect starting with signalcaptcha:// Everything after signalcaptcha:// is the captcha token. Check the developer tools for a redirect starting with signalcaptcha:// Everything after signalcaptcha:// is the captcha token.
=== verify === verify

View file

@ -24,7 +24,11 @@ public record JsonSendMessageResult(
? Type.SUCCESS ? Type.SUCCESS
: result.isNetworkFailure() : result.isNetworkFailure()
? Type.NETWORK_FAILURE ? Type.NETWORK_FAILURE
: result.isUnregisteredFailure() ? Type.UNREGISTERED_FAILURE : Type.IDENTITY_FAILURE, : result.isRateLimitFailure()
? Type.RATE_LIMIT_FAILURE
: result.isUnregisteredFailure()
? Type.UNREGISTERED_FAILURE
: Type.IDENTITY_FAILURE,
result.proofRequiredFailure() != null ? result.proofRequiredFailure().getToken() : null, result.proofRequiredFailure() != null ? result.proofRequiredFailure().getToken() : null,
result.proofRequiredFailure() != null ? result.proofRequiredFailure().getRetryAfterSeconds() : null); result.proofRequiredFailure() != null ? result.proofRequiredFailure().getRetryAfterSeconds() : null);
} }
@ -34,5 +38,6 @@ public record JsonSendMessageResult(
NETWORK_FAILURE, NETWORK_FAILURE,
UNREGISTERED_FAILURE, UNREGISTERED_FAILURE,
IDENTITY_FAILURE, IDENTITY_FAILURE,
RATE_LIMIT_FAILURE,
} }
} }

View file

@ -100,6 +100,8 @@ public class SendMessageResultUtils {
failure.getRetryAfterSeconds()); failure.getRetryAfterSeconds());
} else if (result.isNetworkFailure()) { } else if (result.isNetworkFailure()) {
return String.format("Network failure for \"%s\"", identifier); return String.format("Network failure for \"%s\"", identifier);
} else if (result.isRateLimitFailure()) {
return String.format("Rate limit failure for \"%s\"", identifier);
} else if (result.isUnregisteredFailure()) { } else if (result.isUnregisteredFailure()) {
return String.format("Unregistered user \"%s\"", identifier); return String.format("Unregistered user \"%s\"", identifier);
} else if (result.isIdentityFailure()) { } else if (result.isIdentityFailure()) {