Remove concept of 'highTrust' that is no longer necessary.

This commit is contained in:
Greyson Parrelli
2022-07-06 15:48:32 -04:00
committed by Alex Hart
parent d17896ea09
commit 04cf8676cc
44 changed files with 222 additions and 374 deletions

View File

@@ -31,7 +31,6 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.api.SignalSessionLock;
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
import org.whispersystems.signalservice.api.messages.SignalServiceGroupContext;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import java.io.Closeable;
import java.io.IOException;
@@ -89,7 +88,7 @@ public class IncomingMessageProcessor {
}
if (envelope.hasSourceUuid()) {
Recipient.externalHighTrustPush(context, envelope.getSourceAddress());
Recipient.externalPush(envelope.getSourceAddress());
}
if (envelope.isReceipt()) {
@@ -165,7 +164,7 @@ public class IncomingMessageProcessor {
}
private void processReceipt(@NonNull SignalServiceEnvelope envelope) {
Recipient sender = Recipient.externalHighTrustPush(context, envelope.getSourceAddress());
Recipient sender = Recipient.externalPush(envelope.getSourceAddress());
Log.i(TAG, "Received server receipt. Sender: " + sender.getId() + ", Device: " + envelope.getSourceDevice() + ", Timestamp: " + envelope.getTimestamp());
mmsSmsDatabase.incrementDeliveryReceiptCount(new SyncMessageId(sender.getId(), envelope.getTimestamp()), System.currentTimeMillis());
@@ -185,7 +184,7 @@ public class IncomingMessageProcessor {
GroupId groupId = GroupUtil.idFromGroupContext(groupContext);
if (groupId.isV2()) {
String queueName = PushProcessMessageJob.getQueueName(Recipient.externalPossiblyMigratedGroup(context, groupId).getId());
String queueName = PushProcessMessageJob.getQueueName(Recipient.externalPossiblyMigratedGroup(groupId).getId());
GroupDatabase groupDatabase = SignalDatabase.groups();
return !jobManager.isQueueEmpty(queueName) ||
@@ -199,7 +198,7 @@ public class IncomingMessageProcessor {
return false;
}
} else if (result.getContent() != null) {
RecipientId recipientId = RecipientId.fromHighTrust(result.getContent().getSender());
RecipientId recipientId = RecipientId.from(result.getContent().getSender());
String queueKey = PushProcessMessageJob.getQueueName(recipientId);
return !jobManager.isQueueEmpty(queueKey);

View File

@@ -234,7 +234,7 @@ public final class MessageContentProcessor {
if (messageState == MessageState.DECRYPTED_OK) {
if (content != null) {
Recipient senderRecipient = Recipient.externalHighTrustPush(context, content.getSender());
Recipient senderRecipient = Recipient.externalPush(content.getSender());
handleMessage(content, timestamp, senderRecipient, optionalSmsMessageId);
@@ -1103,7 +1103,7 @@ public final class MessageContentProcessor {
recipient = Recipient.externalPush(response.getPerson().get());
} else if (response.getGroupId().isPresent()) {
GroupId groupId = GroupId.v1(response.getGroupId().get());
recipient = Recipient.externalPossiblyMigratedGroup(context, groupId);
recipient = Recipient.externalPossiblyMigratedGroup(groupId);
} else {
warn("Message request response was missing a thread recipient! Skipping.");
return;
@@ -1562,7 +1562,7 @@ public final class MessageContentProcessor {
database.beginTransaction();
try {
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId(), null);
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId());
ParentStoryId parentStoryId;
QuoteModel quoteModel = null;
long expiresInMillis = 0;
@@ -1656,7 +1656,7 @@ public final class MessageContentProcessor {
database.beginTransaction();
try {
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId(), null);
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId());
ParentStoryId parentStoryId;
QuoteModel quoteModel = null;
long expiresInMillis = 0L;
@@ -1937,7 +1937,7 @@ public final class MessageContentProcessor {
Recipient recipient = getSyncMessageDestination(message);
QuoteModel quoteModel = null;
long expiresInMillis = 0L;
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId(), null);
RecipientId storyAuthorRecipient = RecipientId.from(storyContext.getAuthorServiceId());
MessageId storyMessageId = database.getStoryId(storyAuthorRecipient, storyContext.getSentTimestamp());
MmsMessageRecord story = (MmsMessageRecord) database.getMessageRecord(storyMessageId.getId());
Recipient threadRecipient = SignalDatabase.threads().getRecipientForThreadId(story.getThreadId());
@@ -2552,7 +2552,7 @@ public final class MessageContentProcessor {
@NonNull SignalServiceDataMessage message,
@NonNull MessageId messageId)
{
ApplicationDependencies.getJobManager().add(new SendDeliveryReceiptJob(RecipientId.fromHighTrust(content.getSender()), message.getTimestamp(), messageId));
ApplicationDependencies.getJobManager().add(new SendDeliveryReceiptJob(RecipientId.from(content.getSender()), message.getTimestamp(), messageId));
}
private void handleViewedReceipt(@NonNull SignalServiceContent content,
@@ -2666,7 +2666,7 @@ public final class MessageContentProcessor {
return;
}
Recipient groupRecipient = Recipient.externalPossiblyMigratedGroup(context, groupId);
Recipient groupRecipient = Recipient.externalPossiblyMigratedGroup(groupId);
threadId = SignalDatabase.threads().getOrCreateThreadIdFor(groupRecipient);
} else {
@@ -2990,7 +2990,7 @@ public final class MessageContentProcessor {
List<Mention> mentions = new ArrayList<>(signalServiceMentions.size());
for (SignalServiceDataMessage.Mention mention : signalServiceMentions) {
mentions.add(new Mention(Recipient.externalPush(mention.getServiceId(), null, false).getId(), mention.getStart(), mention.getLength()));
mentions.add(new Mention(Recipient.externalPush(mention.getServiceId()).getId(), mention.getStart(), mention.getLength()));
}
return mentions;
@@ -3026,14 +3026,14 @@ public final class MessageContentProcessor {
private Recipient getMessageDestination(@NonNull SignalServiceContent content) throws BadGroupIdException {
SignalServiceDataMessage message = content.getDataMessage().orElse(null);
return getGroupRecipient(message != null ? message.getGroupContext() : Optional.empty()).orElseGet(() -> Recipient.externalHighTrustPush(context, content.getSender()));
return getGroupRecipient(message != null ? message.getGroupContext() : Optional.empty()).orElseGet(() -> Recipient.externalPush(content.getSender()));
}
private Optional<Recipient> getGroupRecipient(Optional<SignalServiceGroupContext> message)
throws BadGroupIdException
{
if (message.isPresent()) {
return Optional.of(Recipient.externalPossiblyMigratedGroup(context, GroupUtil.idFromGroupContext(message.get())));
return Optional.of(Recipient.externalPossiblyMigratedGroup(GroupUtil.idFromGroupContext(message.get())));
}
return Optional.empty();
}
@@ -3093,7 +3093,7 @@ public final class MessageContentProcessor {
if (content.getTypingMessage().get().getGroupId().isPresent()) {
GroupId groupId = GroupId.push(content.getTypingMessage().get().getGroupId().get());
Recipient groupRecipient = Recipient.externalPossiblyMigratedGroup(context, groupId);
Recipient groupRecipient = Recipient.externalPossiblyMigratedGroup(groupId);
if (groupRecipient.isBlocked() || !groupRecipient.isActiveGroup()) {
return true;

View File

@@ -164,7 +164,7 @@ public final class MessageDecryptionUtil {
long threadId;
if (groupId.isPresent()) {
Recipient groupRecipient = Recipient.externalPossiblyMigratedGroup(context, groupId.get());
Recipient groupRecipient = Recipient.externalPossiblyMigratedGroup(groupId.get());
threadId = SignalDatabase.threads().getOrCreateThreadIdFor(groupRecipient);
} else {
threadId = SignalDatabase.threads().getOrCreateThreadIdFor(sender);