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

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

View file

@ -11,29 +11,30 @@ public record SendMessageResult(
boolean isNetworkFailure,
boolean isUnregisteredFailure,
boolean isIdentityFailure,
boolean isRateLimitFailure,
ProofRequiredException proofRequiredFailure
) {
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) {
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) {
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) {
return new SendMessageResult(address, false, false, false, true, null);
return new SendMessageResult(address, false, false, false, true, false, null);
}
public static SendMessageResult proofRequiredFailure(
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(
@ -47,10 +48,9 @@ public record SendMessageResult(
sendMessageResult.isNetworkFailure(),
sendMessageResult.isUnregisteredFailure(),
sendMessageResult.getIdentityFailure() != null,
sendMessageResult.getRateLimitFailure() != null,
sendMessageResult.getProofRequiredFailure() == null
? null
: new ProofRequiredException(sendMessageResult.getProofRequiredFailure()));
}
public record IdentityFailure(IdentityKey identityKey) {}
}

View file

@ -30,7 +30,7 @@ public class ServiceConfig {
public static final AccountAttributes.Capabilities capabilities;
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 {
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.SignalServiceGroup;
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.ServiceId;
import org.whispersystems.signalservice.api.push.exceptions.ConflictException;
import java.io.File;
@ -391,8 +391,8 @@ public class GroupHelper {
private void storeProfileKeysFromMembers(final DecryptedGroup group) {
for (var member : group.getMembersList()) {
final var aci = ACI.fromByteString(member.getUuid());
final var recipientId = account.getRecipientStore().resolveRecipient(aci);
final var serviceId = ServiceId.fromByteString(member.getUuid());
final var recipientId = account.getRecipientStore().resolveRecipient(serviceId);
try {
account.getProfileStore()
.storeProfileKey(recipientId, new ProfileKey(member.getProfileKey().toByteArray()));

View file

@ -12,6 +12,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.libsignal.InvalidKeyException;
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.internal.contacts.crypto.Quote;
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 {
if (recipient instanceof RecipientIdentifier.Uuid uuidRecipient) {
return account.getRecipientStore().resolveRecipient(ACI.from(uuidRecipient.uuid()));
return account.getRecipientStore().resolveRecipient(ServiceId.from(uuidRecipient.uuid()));
} else {
final var number = ((RecipientIdentifier.Number) recipient).number();
return account.getRecipientStore().resolveRecipient(number, () -> {

View file

@ -190,9 +190,10 @@ public class SendHelper {
SignalServiceTypingMessage message, RecipientId recipientId
) {
final var result = handleSendMessage(recipientId,
(messageSender, address, unidentifiedAccess) -> messageSender.sendTyping(address,
unidentifiedAccess,
message));
(messageSender, address, unidentifiedAccess) -> messageSender.sendTyping(List.of(address),
List.of(unidentifiedAccess),
message,
null).get(0));
handleSendMessageResult(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.EnabledState;
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.ServiceId;
import java.util.Set;
import java.util.stream.Collectors;
@ -112,7 +112,7 @@ public final class GroupInfoV2 extends GroupInfo {
}
return group.getMembersList()
.stream()
.map(m -> ACI.fromByteString(m.getUuid()))
.map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet());
}
@ -124,7 +124,7 @@ public final class GroupInfoV2 extends GroupInfo {
}
return group.getPendingMembersList()
.stream()
.map(m -> ACI.fromByteString(m.getUuid()))
.map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet());
}
@ -136,7 +136,7 @@ public final class GroupInfoV2 extends GroupInfo {
}
return group.getRequestingMembersList()
.stream()
.map(m -> ACI.fromByteString(m.getUuid()))
.map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet());
}
@ -149,7 +149,7 @@ public final class GroupInfoV2 extends GroupInfo {
return group.getMembersList()
.stream()
.filter(m -> m.getRole() == Member.Role.ADMINISTRATOR)
.map(m -> ACI.fromByteString(m.getUuid()))
.map(m -> ServiceId.fromByteString(m.getUuid()))
.map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet());
}

View file

@ -1,6 +1,6 @@
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 java.util.Optional;
@ -8,7 +8,7 @@ import java.util.UUID;
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.
@ -62,7 +62,7 @@ public record RecipientAddress(Optional<UUID> uuid, Optional<String> number) {
}
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)));
}
}

View file

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

View file

@ -35,7 +35,7 @@ public class ProfileUtils {
getUnidentifiedAccessMode(encryptedProfile, profileCipher),
getCapabilities(encryptedProfile));
} 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;
}
}