Rename some protos.

This commit is contained in:
Greyson Parrelli 2023-07-13 13:08:07 -04:00 committed by Nicholas Tinsley
parent 1af50ba0f5
commit 8fc1065dd6
24 changed files with 177 additions and 184 deletions

View file

@ -70,7 +70,7 @@ class EditMessageSyncProcessorTest {
val syncContent = SignalServiceProtos.Content.newBuilder().setSyncMessage(
SignalServiceProtos.SyncMessage.newBuilder().setSent(
SignalServiceProtos.SyncMessage.Sent.newBuilder()
.setDestinationUuid(metadata.destinationServiceId.toString())
.setDestinationServiceId(metadata.destinationServiceId.toString())
.setTimestamp(originalTimestamp)
.setExpirationStartTimestamp(originalTimestamp)
.setMessage(content.dataMessage)
@ -89,7 +89,7 @@ class EditMessageSyncProcessorTest {
val editSyncContent = SignalServiceProtos.Content.newBuilder().setSyncMessage(
SignalServiceProtos.SyncMessage.newBuilder().setSent(
SignalServiceProtos.SyncMessage.Sent.newBuilder()
.setDestinationUuid(metadata.destinationServiceId.toString())
.setDestinationServiceId(metadata.destinationServiceId.toString())
.setTimestamp(editTimestamp)
.setExpirationStartTimestamp(editTimestamp)
.setEditMessage(

View file

@ -69,7 +69,7 @@ object FakeClientHelpers {
.setSourceDevice(1)
.setTimestamp(timestamp)
.setServerTimestamp(timestamp + 1)
.setDestinationUuid(destination.toString())
.setDestinationServiceId(destination.toString())
.setServerGuid(UUID.randomUUID().toString())
.setContent(Base64.decode(this.content).toProtoByteString())
.setUrgent(true)

View file

@ -105,7 +105,7 @@ object MessageContentFuzzer {
addAllUnidentifiedStatus(
deliveredTo.map {
SyncMessage.Sent.UnidentifiedDeliveryStatus.newBuilder().buildWith {
destinationUuid = Recipient.resolved(it).requireServiceId().toString()
destinationServiceId = Recipient.resolved(it).requireServiceId().toString()
unidentified = true
}
}
@ -135,7 +135,7 @@ object MessageContentFuzzer {
val quoted = quoteAble.random(random)
quote = DataMessage.Quote.newBuilder().buildWith {
id = quoted.envelope.timestamp
authorUuid = quoted.metadata.sourceServiceId.toString()
authorAci = quoted.metadata.sourceServiceId.toString()
text = quoted.content.dataMessage.body
addAllAttachments(quoted.content.dataMessage.attachmentsList)
addAllBodyRanges(quoted.content.dataMessage.bodyRangesList)
@ -147,7 +147,7 @@ object MessageContentFuzzer {
val quoted = quoteAble.random(random)
quote = DataMessage.Quote.newBuilder().buildWith {
id = random.nextLong(quoted.envelope.timestamp - 1000000, quoted.envelope.timestamp)
authorUuid = quoted.metadata.sourceServiceId.toString()
authorAci = quoted.metadata.sourceServiceId.toString()
text = quoted.content.dataMessage.body
}
}
@ -174,7 +174,7 @@ object MessageContentFuzzer {
reaction = DataMessage.Reaction.newBuilder().buildWith {
emoji = emojis.random(random)
remove = false
targetAuthorUuid = reactTo.metadata.sourceServiceId.toString()
targetAuthorAci = reactTo.metadata.sourceServiceId.toString()
targetSentTimestamp = reactTo.envelope.timestamp
}
}

View file

@ -41,7 +41,7 @@ class TestProtos private constructor() {
authorUuid: String = UUID.randomUUID().toString()
): DataMessage.StoryContext.Builder {
return DataMessage.StoryContext.newBuilder()
.setAuthorUuid(authorUuid)
.setAuthorAci(authorUuid)
.setSentTimestamp(sentTimestamp)
}

View file

@ -4529,7 +4529,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
}
fun setTimestampReadFromSyncMessageProto(readMessages: List<SyncMessage.Read>, proposedExpireStarted: Long, threadToLatestRead: MutableMap<Long, Long>): Collection<SyncMessageId> {
val reads: List<ReadMessage> = readMessages.map { r -> ReadMessage(ServiceId.parseOrThrow(r.senderUuid), r.timestamp) }
val reads: List<ReadMessage> = readMessages.map { r -> ReadMessage(ServiceId.parseOrThrow(r.senderAci), r.timestamp) }
return setTimestampReadFromSyncMessage(reads, proposedExpireStarted, threadToLatestRead)
}

View file

@ -57,7 +57,7 @@ public class PushTable extends DatabaseTable {
} else {
ContentValues values = new ContentValues();
values.put(TYPE, envelope.getType());
values.put(SOURCE_UUID, envelope.getSourceUuid().orElse(null));
values.put(SOURCE_UUID, envelope.getSourceServiceId().orElse(null));
values.put(DEVICE_ID, envelope.getSourceDevice());
values.put(CONTENT, envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : "");
values.put(TIMESTAMP, envelope.getTimestamp());
@ -132,7 +132,7 @@ public class PushTable extends DatabaseTable {
String.valueOf(envelope.getSourceDevice()),
envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : "",
String.valueOf(envelope.getTimestamp()),
String.valueOf(envelope.getSourceUuid().orElse(null)) };
String.valueOf(envelope.getSourceServiceId().orElse(null)) };
try (Cursor cursor = database.query(TABLE_NAME, null, query, args, null, null, null)) {

View file

@ -87,7 +87,7 @@ data class SentStorySyncManifest(
fun fromRecipientsSet(recipients: List<SignalServiceProtos.SyncMessage.Sent.StoryMessageRecipient>): SentStorySyncManifest {
val entries = recipients.toSet().map { recipient ->
Entry(
recipientId = RecipientId.from(ServiceId.parseOrThrow(recipient.destinationUuid)),
recipientId = RecipientId.from(ServiceId.parseOrThrow(recipient.destinationServiceId)),
allowedToReply = recipient.isAllowedToReply,
distributionLists = recipient.distributionListIdsList.map { DistributionId.from(it) }
)

View file

@ -130,8 +130,8 @@ class PushProcessMessageJobV2 private constructor(
requireNetwork = true
}
}
} else if (result.content.hasSyncMessage() && result.content.syncMessage.hasSent() && result.content.syncMessage.sent.hasDestinationUuid()) {
queueName = getQueueName(RecipientId.from(ServiceId.parseOrThrow(result.content.syncMessage.sent.destinationUuid)))
} else if (result.content.hasSyncMessage() && result.content.syncMessage.hasSent() && result.content.syncMessage.sent.hasDestinationServiceId()) {
queueName = getQueueName(RecipientId.from(ServiceId.parseOrThrow(result.content.syncMessage.sent.destinationServiceId)))
} else {
queueName = getQueueName(RecipientId.from(result.metadata.sourceServiceId))
}

View file

@ -368,7 +368,7 @@ object DataMessageProcessor {
return null
}
val authorServiceId: ServiceId = ServiceId.parseOrThrow(message.storyContext.authorUuid)
val authorServiceId: ServiceId = ServiceId.parseOrThrow(message.storyContext.authorAci)
val sentTimestamp = message.storyContext.sentTimestamp
SignalDatabase.messages.beginTransaction()
@ -459,7 +459,7 @@ object DataMessageProcessor {
val emoji: String = message.reaction.emoji
val isRemove: Boolean = message.reaction.remove
val targetAuthorServiceId: ServiceId = ServiceId.parseOrThrow(message.reaction.targetAuthorUuid)
val targetAuthorServiceId: ServiceId = ServiceId.parseOrThrow(message.reaction.targetAuthorAci)
val targetSentTimestamp = message.reaction.targetSentTimestamp
if (targetAuthorServiceId.isUnknown) {
@ -668,7 +668,7 @@ object DataMessageProcessor {
): MessageId? {
log(envelope.timestamp, "Story reply.")
val authorServiceId: ServiceId = ServiceId.parseOrThrow(message.storyContext.authorUuid)
val authorServiceId: ServiceId = ServiceId.parseOrThrow(message.storyContext.authorAci)
val sentTimestamp = message.storyContext.sentTimestamp
SignalDatabase.messages.beginTransaction()
@ -990,9 +990,9 @@ object DataMessageProcessor {
fun getMentions(mentionBodyRanges: List<BodyRange>): List<Mention> {
return mentionBodyRanges
.filter { it.hasMentionUuid() }
.filter { it.hasMentionAci() }
.mapNotNull {
val serviceId = ServiceId.parseOrNull(it.mentionUuid)
val serviceId = ServiceId.parseOrNull(it.mentionAci)
if (serviceId != null && !serviceId.isUnknown) {
val id = Recipient.externalPush(serviceId).id
@ -1031,7 +1031,7 @@ object DataMessageProcessor {
return null
}
val authorId = Recipient.externalPush(ServiceId.parseOrThrow(quote.authorUuid)).id
val authorId = Recipient.externalPush(ServiceId.parseOrThrow(quote.authorAci)).id
var quotedMessage = SignalDatabase.messages.getMessageFor(quote.id, authorId) as? MediaMmsMessageRecord
if (quotedMessage != null && !quotedMessage.isRemoteDelete) {
@ -1086,7 +1086,7 @@ object DataMessageProcessor {
quote.attachmentsList.mapNotNull { PointerAttachment.forPointer(it).orNull() },
getMentions(quote.bodyRangesList),
QuoteModel.Type.fromProto(quote.type),
quote.bodyRangesList.filterNot { it.hasMentionUuid() }.toBodyRangeList()
quote.bodyRangesList.filterNot { it.hasMentionAci() }.toBodyRangeList()
)
}

View file

@ -328,12 +328,12 @@ class IncomingMessageObserver(private val context: Application) {
}
private fun processReceipt(envelope: SignalServiceProtos.Envelope) {
if (!UuidUtil.isUuid(envelope.sourceUuid)) {
if (!UuidUtil.isUuid(envelope.sourceServiceId)) {
Log.w(TAG, "Invalid envelope source UUID!")
return
}
val senderId = RecipientId.from(ServiceId.parseOrThrow(envelope.sourceUuid))
val senderId = RecipientId.from(ServiceId.parseOrThrow(envelope.sourceServiceId))
Log.i(TAG, "Received server receipt. Sender: $senderId, Device: ${envelope.sourceDevice}, Timestamp: ${envelope.timestamp}")
SignalDatabase.messages.incrementDeliveryReceiptCount(envelope.timestamp, senderId, System.currentTimeMillis())

View file

@ -89,10 +89,10 @@ object MessageDecryptor {
val destination: ServiceId = envelope.getDestination(selfAci, selfPni)
if (destination == selfPni && envelope.hasSourceUuid()) {
if (destination == selfPni && envelope.hasSourceServiceId()) {
Log.i(TAG, "${logPrefix(envelope)} Received a message at our PNI. Marking as needing a PNI signature.")
val sourceServiceId = ServiceId.parseOrNull(envelope.sourceUuid)
val sourceServiceId = ServiceId.parseOrNull(envelope.sourceServiceId)
if (sourceServiceId != null) {
val sender = RecipientId.from(sourceServiceId)
@ -102,7 +102,7 @@ object MessageDecryptor {
}
}
if (destination == selfPni && !envelope.hasSourceUuid()) {
if (destination == selfPni && !envelope.hasSourceServiceId()) {
Log.w(TAG, "${logPrefix(envelope)} Got a sealed sender message to our PNI? Invalid message, ignoring.")
return Result.Ignore(envelope, serverDeliveredTimestamp, emptyList())
}
@ -352,7 +352,7 @@ object MessageDecryptor {
}
private fun logPrefix(envelope: Envelope): String {
return logPrefix(envelope.timestamp, envelope.sourceUuid ?: "<sealed>", envelope.sourceDevice)
return logPrefix(envelope.timestamp, envelope.sourceServiceId ?: "<sealed>", envelope.sourceDevice)
}
private fun logPrefix(envelope: Envelope, sender: ServiceId): String {
@ -367,7 +367,7 @@ object MessageDecryptor {
return if (exception.sender != null) {
logPrefix(envelope.timestamp, exception.sender, exception.senderDevice)
} else {
logPrefix(envelope.timestamp, envelope.sourceUuid, envelope.sourceDevice)
logPrefix(envelope.timestamp, envelope.sourceServiceId, envelope.sourceDevice)
}
}
@ -409,8 +409,8 @@ object MessageDecryptor {
private fun Envelope.getDestination(selfAci: ServiceId, selfPni: ServiceId): ServiceId {
return if (!FeatureFlags.phoneNumberPrivacy()) {
selfAci
} else if (this.hasDestinationUuid()) {
val serviceId = ServiceId.parseOrThrow(this.destinationUuid)
} else if (this.hasDestinationServiceId()) {
val serviceId = ServiceId.parseOrThrow(this.destinationServiceId)
if (serviceId == selfAci || serviceId == selfPni) {
serviceId
} else {

View file

@ -131,14 +131,14 @@ object SignalServiceProtoUtil {
}
fun Sent.isUnidentified(serviceId: ServiceId?): Boolean {
return serviceId != null && unidentifiedStatusList.firstOrNull { ServiceId.parseOrNull(it.destinationUuid) == serviceId }?.unidentified ?: false
return serviceId != null && unidentifiedStatusList.firstOrNull { ServiceId.parseOrNull(it.destinationServiceId) == serviceId }?.unidentified ?: false
}
val Sent.serviceIdsToUnidentifiedStatus: Map<ServiceId, Boolean>
get() {
return unidentifiedStatusList
.mapNotNull { status ->
val serviceId = ServiceId.parseOrNull(status.destinationUuid)
val serviceId = ServiceId.parseOrNull(status.destinationServiceId)
if (serviceId != null) {
serviceId to status.unidentified
} else {

View file

@ -71,7 +71,7 @@ object StoryMessageProcessor {
isStoryEmbed = true
),
serverGuid = envelope.serverGuid,
messageRanges = storyMessage.bodyRangesList.filterNot { it.hasMentionUuid() }.toBodyRangeList()
messageRanges = storyMessage.bodyRangesList.filterNot { it.hasMentionAci() }.toBodyRangeList()
)
insertResult = SignalDatabase.messages.insertSecureDecryptedMessageInbox(mediaMessage, -1).orNull()

View file

@ -238,7 +238,7 @@ object SyncMessageProcessor {
return if (message.message.hasGroupContext) {
Recipient.externalPossiblyMigratedGroup(GroupId.v2(message.message.groupV2.groupMasterKey))
} else {
Recipient.externalPush(SignalServiceAddress(ServiceId.parseOrThrow(message.destinationUuid), message.destinationE164))
Recipient.externalPush(SignalServiceAddress(ServiceId.parseOrThrow(message.destinationServiceId), message.destinationE164))
}
}
@ -265,7 +265,7 @@ object SyncMessageProcessor {
val toRecipient: Recipient = if (message.hasGroupContext) {
Recipient.externalPossiblyMigratedGroup(GroupId.v2(message.groupV2.groupMasterKey))
} else {
Recipient.externalPush(ServiceId.parseOrThrow(sent.destinationUuid))
Recipient.externalPush(ServiceId.parseOrThrow(sent.destinationServiceId))
}
if (message.isMediaMessage) {
handleSynchronizeSentEditMediaMessage(context, targetMessage, toRecipient, sent, message, envelope.timestamp)
@ -287,7 +287,7 @@ object SyncMessageProcessor {
log(envelopeTimestamp, "Synchronize sent edit text message for message: ${targetMessage.id}")
val body = message.body ?: ""
val bodyRanges = message.bodyRangesList.filterNot { it.hasMentionUuid() }.toBodyRangeList()
val bodyRanges = message.bodyRangesList.filterNot { it.hasMentionAci() }.toBodyRangeList()
val threadId = SignalDatabase.threads.getOrCreateThreadIdFor(toRecipient)
val isGroup = toRecipient.isGroup
@ -637,7 +637,7 @@ object SyncMessageProcessor {
try {
val reaction: DataMessage.Reaction = sent.message.reaction
val parentStoryId: ParentStoryId
val authorServiceId: ServiceId = ServiceId.parseOrThrow(sent.message.storyContext.authorUuid)
val authorServiceId: ServiceId = ServiceId.parseOrThrow(sent.message.storyContext.authorAci)
val sentTimestamp: Long = sent.message.storyContext.sentTimestamp
val recipient: Recipient = getSyncMessageDestination(sent)
var quoteModel: QuoteModel? = null
@ -812,7 +812,7 @@ object SyncMessageProcessor {
val recipient = getSyncMessageDestination(sent)
val body = sent.message.body ?: ""
val expiresInMillis = sent.message.expireTimer.seconds.inWholeMilliseconds
val bodyRanges = sent.message.bodyRangesList.filterNot { it.hasMentionUuid() }.toBodyRangeList()
val bodyRanges = sent.message.bodyRangesList.filterNot { it.hasMentionAci() }.toBodyRangeList()
if (recipient.expiresInSeconds != sent.message.expireTimer) {
handleSynchronizeSentExpirationUpdate(sent, sideEffect = true)
@ -923,7 +923,7 @@ object SyncMessageProcessor {
val records = viewedMessages
.mapNotNull { message ->
val author = Recipient.externalPush(ServiceId.parseOrThrow(message.senderUuid)).id
val author = Recipient.externalPush(ServiceId.parseOrThrow(message.senderAci)).id
SignalDatabase.messages.getMessageFor(message.timestamp, author)
}
@ -950,7 +950,7 @@ object SyncMessageProcessor {
private fun handleSynchronizeViewOnceOpenMessage(context: Context, openMessage: ViewOnceOpen, envelopeTimestamp: Long, earlyMessageCacheEntry: EarlyMessageCacheEntry?) {
log(envelopeTimestamp, "Handling a view-once open for message: " + openMessage.timestamp)
val author: RecipientId = Recipient.externalPush(ServiceId.parseOrThrow(openMessage.senderUuid)).id
val author: RecipientId = Recipient.externalPush(ServiceId.parseOrThrow(openMessage.senderAci)).id
val timestamp: Long = openMessage.timestamp
val record: MessageRecord? = SignalDatabase.messages.getMessageFor(timestamp, author)
@ -1019,7 +1019,7 @@ object SyncMessageProcessor {
}
private fun handleSynchronizeBlockedListMessage(blockMessage: Blocked) {
val addresses: List<SignalServiceAddress> = blockMessage.uuidsList.mapNotNull { SignalServiceAddress.fromRaw(it, null).orNull() }
val addresses: List<SignalServiceAddress> = blockMessage.acisList.mapNotNull { SignalServiceAddress.fromRaw(it, null).orNull() }
val groupIds: List<ByteArray> = blockMessage.groupIdsList.mapNotNull { it.toByteArray() }
SignalDatabase.recipients.applyBlockedUpdate(addresses, groupIds)
@ -1039,8 +1039,8 @@ object SyncMessageProcessor {
private fun handleSynchronizeMessageRequestResponse(response: MessageRequestResponse, envelopeTimestamp: Long) {
log(envelopeTimestamp, "Synchronize message request response.")
val recipient: Recipient = if (response.hasThreadUuid()) {
Recipient.externalPush(ServiceId.parseOrThrow(response.threadUuid))
val recipient: Recipient = if (response.hasThreadAci()) {
Recipient.externalPush(ServiceId.parseOrThrow(response.threadAci))
} else if (response.hasGroupId()) {
val groupId: GroupId = GroupId.push(response.groupId)
Recipient.externalPossiblyMigratedGroup(groupId)
@ -1083,7 +1083,7 @@ object SyncMessageProcessor {
return
}
var recipientId: RecipientId? = ServiceId.parseOrNull(outgoingPayment.recipientUuid)?.let { RecipientId.from(it) }
var recipientId: RecipientId? = ServiceId.parseOrNull(outgoingPayment.recipientServiceId)?.let { RecipientId.from(it) }
var timestamp = outgoingPayment.mobileCoin.ledgerBlockTimestamp
if (timestamp == 0L) {

View file

@ -178,7 +178,7 @@ public final class IdentityUtil {
}
public static void processVerifiedMessage(Context context, SignalServiceProtos.Verified verified) throws InvalidKeyException {
SignalServiceAddress destination = new SignalServiceAddress(ServiceId.parseOrThrow(verified.getDestinationUuid()));
SignalServiceAddress destination = new SignalServiceAddress(ServiceId.parseOrThrow(verified.getDestinationAci()));
IdentityKey identityKey = new IdentityKey(verified.getIdentityKey().toByteArray(), 0);
VerifiedMessage.VerifiedState state;

View file

@ -1036,7 +1036,7 @@ public class SignalServiceMessageSender {
DataMessage.Quote.Builder quoteBuilder = DataMessage.Quote.newBuilder()
.setId(message.getQuote().get().getId())
.setText(message.getQuote().get().getText())
.setAuthorUuid(message.getQuote().get().getAuthor().toString())
.setAuthorAci(message.getQuote().get().getAuthor().toString())
.setType(message.getQuote().get().getType().getProtoType());
List<SignalServiceDataMessage.Mention> mentions = message.getQuote().get().getMentions();
@ -1045,7 +1045,7 @@ public class SignalServiceMessageSender {
quoteBuilder.addBodyRanges(BodyRange.newBuilder()
.setStart(mention.getStart())
.setLength(mention.getLength())
.setMentionUuid(mention.getServiceId().toString()));
.setMentionAci(mention.getServiceId().toString()));
}
builder.setRequiredProtocolVersion(Math.max(DataMessage.ProtocolVersion.MENTIONS_VALUE, builder.getRequiredProtocolVersion()));
@ -1093,7 +1093,7 @@ public class SignalServiceMessageSender {
builder.addBodyRanges(BodyRange.newBuilder()
.setStart(mention.getStart())
.setLength(mention.getLength())
.setMentionUuid(mention.getServiceId().toString()));
.setMentionAci(mention.getServiceId().toString()));
}
builder.setRequiredProtocolVersion(Math.max(DataMessage.ProtocolVersion.MENTIONS_VALUE, builder.getRequiredProtocolVersion()));
}
@ -1128,7 +1128,7 @@ public class SignalServiceMessageSender {
.setEmoji(message.getReaction().get().getEmoji())
.setRemove(message.getReaction().get().isRemove())
.setTargetSentTimestamp(message.getReaction().get().getTargetSentTimestamp())
.setTargetAuthorUuid(message.getReaction().get().getTargetAuthor().toString());
.setTargetAuthorAci(message.getReaction().get().getTargetAuthor().toString());
builder.setReaction(reactionBuilder.build());
builder.setRequiredProtocolVersion(Math.max(DataMessage.ProtocolVersion.REACTIONS_VALUE, builder.getRequiredProtocolVersion()));
@ -1172,7 +1172,7 @@ public class SignalServiceMessageSender {
SignalServiceDataMessage.StoryContext storyContext = message.getStoryContext().get();
builder.setStoryContext(DataMessage.StoryContext.newBuilder()
.setAuthorUuid(storyContext.getAuthorServiceId().toString())
.setAuthorAci(storyContext.getAuthorServiceId().toString())
.setSentTimestamp(storyContext.getSentTimestamp()));
}
@ -1338,7 +1338,7 @@ public class SignalServiceMessageSender {
for (SendMessageResult result : sendMessageResults) {
if (result.getSuccess() != null) {
sentMessage.addUnidentifiedStatus(SyncMessage.Sent.UnidentifiedDeliveryStatus.newBuilder()
.setDestinationUuid(result.getAddress().getServiceId().toString())
.setDestinationServiceId(result.getAddress().getServiceId().toString())
.setUnidentified(result.getSuccess().isUnidentified())
.build());
@ -1346,7 +1346,7 @@ public class SignalServiceMessageSender {
}
if (recipient.isPresent()) {
sentMessage.setDestinationUuid(recipient.get().getServiceId().toString());
sentMessage.setDestinationServiceId(recipient.get().getServiceId().toString());
if (recipient.get().getNumber().isPresent()) {
sentMessage.setDestinationE164(recipient.get().getNumber().get());
}
@ -1384,7 +1384,7 @@ public class SignalServiceMessageSender {
private SyncMessage.Sent.StoryMessageRecipient createStoryMessageRecipient(SignalServiceStoryMessageRecipient storyMessageRecipient) {
return SyncMessage.Sent.StoryMessageRecipient.newBuilder()
.addAllDistributionListIds(storyMessageRecipient.getDistributionListIds())
.setDestinationUuid(storyMessageRecipient.getSignalServiceAddress().getIdentifier())
.setDestinationServiceId(storyMessageRecipient.getSignalServiceAddress().getIdentifier())
.setIsAllowedToReply(storyMessageRecipient.isAllowedToReply())
.build();
}
@ -1396,7 +1396,7 @@ public class SignalServiceMessageSender {
for (ReadMessage readMessage : readMessages) {
builder.addRead(SyncMessage.Read.newBuilder()
.setTimestamp(readMessage.getTimestamp())
.setSenderUuid(readMessage.getSender().toString()));
.setSenderAci(readMessage.getSender().toString()));
}
return container.setSyncMessage(builder).build();
@ -1409,7 +1409,7 @@ public class SignalServiceMessageSender {
for (ViewedMessage readMessage : readMessages) {
builder.addViewed(SyncMessage.Viewed.newBuilder()
.setTimestamp(readMessage.getTimestamp())
.setSenderUuid(readMessage.getSender().toString()));
.setSenderAci(readMessage.getSender().toString()));
}
return container.setSyncMessage(builder).build();
@ -1421,7 +1421,7 @@ public class SignalServiceMessageSender {
builder.setViewOnceOpen(SyncMessage.ViewOnceOpen.newBuilder()
.setTimestamp(readMessage.getTimestamp())
.setSenderUuid(readMessage.getSender().toString()));
.setSenderAci(readMessage.getSender().toString()));
return container.setSyncMessage(builder).build();
}
@ -1432,7 +1432,7 @@ public class SignalServiceMessageSender {
SyncMessage.Blocked.Builder blockedMessage = SyncMessage.Blocked.newBuilder();
for (SignalServiceAddress address : blocked.getAddresses()) {
blockedMessage.addUuids(address.getServiceId().toString());
blockedMessage.addAcis(address.getServiceId().toString());
if (address.getNumber().isPresent()) {
blockedMessage.addNumbers(address.getNumber().get());
}
@ -1532,7 +1532,7 @@ public class SignalServiceMessageSender {
}
if (message.getPerson().isPresent()) {
responseMessage.setThreadUuid(message.getPerson().get().toString());
responseMessage.setThreadAci(message.getPerson().get().toString());
}
switch (message.getType()) {
@ -1565,7 +1565,7 @@ public class SignalServiceMessageSender {
SyncMessage.OutgoingPayment.Builder paymentMessage = SyncMessage.OutgoingPayment.newBuilder();
if (message.getRecipient().isPresent()) {
paymentMessage.setRecipientUuid(message.getRecipient().get().toString());
paymentMessage.setRecipientServiceId(message.getRecipient().get().toString());
}
if (message.getNote().isPresent()) {
@ -1617,7 +1617,7 @@ public class SignalServiceMessageSender {
verifiedMessageBuilder.setNullMessage(ByteString.copyFrom(nullMessage));
verifiedMessageBuilder.setIdentityKey(ByteString.copyFrom(verifiedMessage.getIdentityKey().serialize()));
verifiedMessageBuilder.setDestinationUuid(verifiedMessage.getDestination().getServiceId().toString());
verifiedMessageBuilder.setDestinationAci(verifiedMessage.getDestination().getServiceId().toString());
switch(verifiedMessage.getVerified()) {

View file

@ -209,27 +209,27 @@ public class SignalServiceCipher {
byte[] paddedMessage;
SignalServiceMetadata metadata;
if (!envelope.hasSourceUuid() && envelope.getType().getNumber() != Envelope.Type.UNIDENTIFIED_SENDER_VALUE) {
if (!envelope.hasSourceServiceId() && envelope.getType().getNumber() != Envelope.Type.UNIDENTIFIED_SENDER_VALUE) {
throw new InvalidMessageStructureException("Non-UD envelope is missing a UUID!");
}
if (envelope.getType().getNumber() == Envelope.Type.PREKEY_BUNDLE_VALUE) {
SignalProtocolAddress sourceAddress = new SignalProtocolAddress(envelope.getSourceUuid(), envelope.getSourceDevice());
SignalProtocolAddress sourceAddress = new SignalProtocolAddress(envelope.getSourceServiceId(), envelope.getSourceDevice());
SignalSessionCipher sessionCipher = new SignalSessionCipher(sessionLock, new SessionCipher(signalProtocolStore, sourceAddress));
paddedMessage = sessionCipher.decrypt(new PreKeySignalMessage(envelope.getContent().toByteArray()));
metadata = new SignalServiceMetadata(getSourceAddress(envelope), envelope.getSourceDevice(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, false, envelope.getServerGuid(), Optional.empty(), envelope.getDestinationUuid());
metadata = new SignalServiceMetadata(getSourceAddress(envelope), envelope.getSourceDevice(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, false, envelope.getServerGuid(), Optional.empty(), envelope.getDestinationServiceId());
signalProtocolStore.clearSenderKeySharedWith(Collections.singleton(sourceAddress));
} else if (envelope.getType().getNumber() == Envelope.Type.CIPHERTEXT_VALUE) {
SignalProtocolAddress sourceAddress = new SignalProtocolAddress(envelope.getSourceUuid(), envelope.getSourceDevice());
SignalProtocolAddress sourceAddress = new SignalProtocolAddress(envelope.getSourceServiceId(), envelope.getSourceDevice());
SignalSessionCipher sessionCipher = new SignalSessionCipher(sessionLock, new SessionCipher(signalProtocolStore, sourceAddress));
paddedMessage = sessionCipher.decrypt(new SignalMessage(envelope.getContent().toByteArray()));
metadata = new SignalServiceMetadata(getSourceAddress(envelope), envelope.getSourceDevice(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, false, envelope.getServerGuid(), Optional.empty(), envelope.getDestinationUuid());
metadata = new SignalServiceMetadata(getSourceAddress(envelope), envelope.getSourceDevice(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, false, envelope.getServerGuid(), Optional.empty(), envelope.getDestinationServiceId());
} else if (envelope.getType().getNumber() == Envelope.Type.PLAINTEXT_CONTENT_VALUE) {
paddedMessage = new PlaintextContent(envelope.getContent().toByteArray()).getBody();
metadata = new SignalServiceMetadata(getSourceAddress(envelope), envelope.getSourceDevice(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, false, envelope.getServerGuid(), Optional.empty(), envelope.getDestinationUuid());
metadata = new SignalServiceMetadata(getSourceAddress(envelope), envelope.getSourceDevice(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, false, envelope.getServerGuid(), Optional.empty(), envelope.getDestinationServiceId());
} else if (envelope.getType().getNumber() == Envelope.Type.UNIDENTIFIED_SENDER_VALUE) {
SignalSealedSessionCipher sealedSessionCipher = new SignalSealedSessionCipher(sessionLock, new SealedSessionCipher(signalProtocolStore, localAddress.getServiceId().uuid(), localAddress.getNumber().orElse(null), localDeviceId));
DecryptionResult result = sealedSessionCipher.decrypt(certificateValidator, envelope.getContent().toByteArray(), envelope.getServerTimestamp());
@ -237,7 +237,7 @@ public class SignalServiceCipher {
Optional<byte[]> groupId = result.getGroupId();
boolean needsReceipt = true;
if (envelope.hasSourceUuid()) {
if (envelope.hasSourceServiceId()) {
Log.w(TAG, "[" + envelope.getTimestamp() + "] Received a UD-encrypted message sent over an identified channel. Marking as needsReceipt=false");
needsReceipt = false;
}
@ -247,7 +247,7 @@ public class SignalServiceCipher {
}
paddedMessage = result.getPaddedMessage();
metadata = new SignalServiceMetadata(resultAddress, result.getDeviceId(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, needsReceipt, envelope.getServerGuid(), groupId, envelope.getDestinationUuid());
metadata = new SignalServiceMetadata(resultAddress, result.getDeviceId(), envelope.getTimestamp(), envelope.getServerTimestamp(), serverDeliveredTimestamp, needsReceipt, envelope.getServerGuid(), groupId, envelope.getDestinationServiceId());
} else {
throw new InvalidMetadataMessageException("Unknown type: " + envelope.getType());
}
@ -257,26 +257,26 @@ public class SignalServiceCipher {
return new Plaintext(metadata, data);
} catch (DuplicateMessageException e) {
throw new ProtocolDuplicateMessageException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolDuplicateMessageException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (LegacyMessageException e) {
throw new ProtocolLegacyMessageException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolLegacyMessageException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidMessageException e) {
throw new ProtocolInvalidMessageException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolInvalidMessageException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidKeyIdException e) {
throw new ProtocolInvalidKeyIdException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolInvalidKeyIdException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidKeyException e) {
throw new ProtocolInvalidKeyException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolInvalidKeyException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (UntrustedIdentityException e) {
throw new ProtocolUntrustedIdentityException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolUntrustedIdentityException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidVersionException e) {
throw new ProtocolInvalidVersionException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolInvalidVersionException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (NoSessionException e) {
throw new ProtocolNoSessionException(e, envelope.getSourceUuid(), envelope.getSourceDevice());
throw new ProtocolNoSessionException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
}
}
private static SignalServiceAddress getSourceAddress(Envelope envelope) {
return new SignalServiceAddress(ServiceId.parseOrNull(envelope.getSourceUuid()));
return new SignalServiceAddress(ServiceId.parseOrNull(envelope.getSourceServiceId()));
}
private static class Plaintext {

View file

@ -67,7 +67,7 @@ object EnvelopeContentValidator {
Result.Invalid("[DataMessage] Timestamps don't match! envelope: ${envelope.timestamp}, content: ${dataMessage.timestamp}")
}
if (dataMessage.hasQuote() && dataMessage.quote.authorUuid.isNullOrInvalidOrUnknownUuid()) {
if (dataMessage.hasQuote() && dataMessage.quote.authorAci.isNullOrInvalidOrUnknownUuid()) {
return Result.Invalid("[DataMessage] Invalid UUID on quote!")
}
@ -79,7 +79,7 @@ object EnvelopeContentValidator {
return Result.Invalid("[DataMessage] Invalid AttachmentPointer on DataMessage.previewList.image!")
}
if (dataMessage.bodyRangesList.any { it.hasMentionUuid() && it.mentionUuid.isNullOrInvalidOrUnknownUuid() }) {
if (dataMessage.bodyRangesList.any { it.hasMentionAci() && it.mentionAci.isNullOrInvalidOrUnknownUuid() }) {
return Result.Invalid("[DataMessage] Invalid UUID on body range!")
}
@ -91,7 +91,7 @@ object EnvelopeContentValidator {
if (!dataMessage.reaction.hasTargetSentTimestamp()) {
return Result.Invalid("[DataMessage] Missing timestamp on DataMessage.reaction!")
}
if (dataMessage.reaction.targetAuthorUuid.isNullOrInvalidOrUnknownUuid()) {
if (dataMessage.reaction.targetAuthorAci.isNullOrInvalidOrUnknownUuid()) {
return Result.Invalid("[DataMessage] Invalid UUID on DataMessage.reaction!")
}
}
@ -100,7 +100,7 @@ object EnvelopeContentValidator {
return Result.Invalid("[DataMessage] Missing timestamp on DataMessage.delete!")
}
if (dataMessage.hasStoryContext() && dataMessage.storyContext.authorUuid.isNullOrInvalidOrUnknownUuid()) {
if (dataMessage.hasStoryContext() && dataMessage.storyContext.authorAci.isNullOrInvalidOrUnknownUuid()) {
return Result.Invalid("[DataMessage] Invalid UUID on DataMessage.storyContext!")
}
@ -130,7 +130,7 @@ object EnvelopeContentValidator {
private fun validateSyncMessage(envelope: Envelope, syncMessage: SyncMessage): Result {
if (syncMessage.hasSent()) {
val validAddress = syncMessage.sent.destinationUuid.isValidUuid()
val validAddress = syncMessage.sent.destinationServiceId.isValidUuid()
val hasDataGroup = syncMessage.sent.message?.hasGroupV2() ?: false
val hasStoryGroup = syncMessage.sent.storyMessage?.hasGroup() ?: false
val hasStoryManifest = syncMessage.sent.storyMessageRecipientsList.isNotEmpty()
@ -153,7 +153,7 @@ object EnvelopeContentValidator {
}
for (status in syncMessage.sent.unidentifiedStatusList) {
if (status.destinationUuid.isNullOrInvalidUuid()) {
if (status.destinationServiceId.isNullOrInvalidUuid()) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.sent.unidentifiedStatusList!")
}
}
@ -169,19 +169,19 @@ object EnvelopeContentValidator {
}
}
if (syncMessage.readList.any { it.senderUuid.isNullOrInvalidOrUnknownUuid() }) {
if (syncMessage.readList.any { it.senderAci.isNullOrInvalidOrUnknownUuid() }) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.readList!")
}
if (syncMessage.viewedList.any { it.senderUuid.isNullOrInvalidOrUnknownUuid() }) {
if (syncMessage.viewedList.any { it.senderAci.isNullOrInvalidOrUnknownUuid() }) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.viewList!")
}
if (syncMessage.hasViewOnceOpen() && syncMessage.viewOnceOpen.senderUuid.isNullOrInvalidOrUnknownUuid()) {
if (syncMessage.hasViewOnceOpen() && syncMessage.viewOnceOpen.senderAci.isNullOrInvalidOrUnknownUuid()) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.viewOnceOpen!")
}
if (syncMessage.hasVerified() && syncMessage.verified.destinationUuid.isNullOrInvalidOrUnknownUuid()) {
if (syncMessage.hasVerified() && syncMessage.verified.destinationAci.isNullOrInvalidOrUnknownUuid()) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.verified!")
}
@ -189,11 +189,11 @@ object EnvelopeContentValidator {
return Result.Invalid("[SyncMessage] Missing packId in stickerPackOperationList!")
}
if (syncMessage.hasBlocked() && syncMessage.blocked.uuidsList.any { it.isNullOrInvalidOrUnknownUuid() }) {
if (syncMessage.hasBlocked() && syncMessage.blocked.acisList.any { it.isNullOrInvalidOrUnknownUuid() }) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.blocked!")
}
if (syncMessage.hasMessageRequestResponse() && !syncMessage.messageRequestResponse.hasGroupId() && syncMessage.messageRequestResponse.threadUuid.isNullOrInvalidOrUnknownUuid()) {
if (syncMessage.hasMessageRequestResponse() && !syncMessage.messageRequestResponse.hasGroupId() && syncMessage.messageRequestResponse.threadAci.isNullOrInvalidOrUnknownUuid()) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.messageRequestResponse!")
}
@ -259,7 +259,7 @@ object EnvelopeContentValidator {
return Result.Invalid("[EditMessage] Invalid AttachmentPointer on DataMessage.previewList.image!")
}
if (dataMessage.bodyRangesList.any { it.hasMentionUuid() && it.mentionUuid.isNullOrInvalidOrUnknownUuid() }) {
if (dataMessage.bodyRangesList.any { it.hasMentionAci() && it.mentionAci.isNullOrInvalidOrUnknownUuid() }) {
return Result.Invalid("[EditMessage] Invalid UUID on body range!")
}

View file

@ -826,8 +826,8 @@ public final class SignalServiceContent {
Optional<SignalServiceDataMessage> dataMessage = sentContent.hasMessage() ? Optional.of(createSignalServiceDataMessage(metadata, sentContent.getMessage())) : Optional.empty();
Optional<SignalServiceStoryMessage> storyMessage = sentContent.hasStoryMessage() ? Optional.of(createStoryMessage(sentContent.getStoryMessage())) : Optional.empty();
Optional<SignalServiceEditMessage> editMessage = sentContent.hasEditMessage() ? Optional.of(createEditMessage(metadata, sentContent.getEditMessage())) : Optional.empty();
Optional<SignalServiceAddress> address = SignalServiceAddress.isValidAddress(sentContent.getDestinationUuid())
? Optional.of(new SignalServiceAddress(ServiceId.parseOrThrow(sentContent.getDestinationUuid()), sentContent.getDestinationE164()))
Optional<SignalServiceAddress> address = SignalServiceAddress.isValidAddress(sentContent.getDestinationServiceId())
? Optional.of(new SignalServiceAddress(ServiceId.parseOrThrow(sentContent.getDestinationServiceId()), sentContent.getDestinationE164()))
: Optional.empty();
Set<SignalServiceStoryMessageRecipient> recipientManifest = sentContent.getStoryMessageRecipientsList()
.stream()
@ -843,8 +843,8 @@ public final class SignalServiceContent {
}
for (SignalServiceProtos.SyncMessage.Sent.UnidentifiedDeliveryStatus status : sentContent.getUnidentifiedStatusList()) {
if (SignalServiceAddress.isValidAddress(status.getDestinationUuid(), null)) {
unidentifiedStatuses.put(ServiceId.parseOrNull(status.getDestinationUuid()), status.getUnidentified());
if (SignalServiceAddress.isValidAddress(status.getDestinationServiceId(), null)) {
unidentifiedStatuses.put(ServiceId.parseOrNull(status.getDestinationServiceId()), status.getUnidentified());
} else {
Log.w(TAG, "Encountered an invalid UnidentifiedDeliveryStatus in a SentTranscript! Ignoring.");
}
@ -869,7 +869,7 @@ public final class SignalServiceContent {
List<ReadMessage> readMessages = new LinkedList<>();
for (SignalServiceProtos.SyncMessage.Read read : content.getReadList()) {
ServiceId serviceId = ServiceId.parseOrNull(read.getSenderUuid());
ServiceId serviceId = ServiceId.parseOrNull(read.getSenderAci());
if (serviceId != null) {
readMessages.add(new ReadMessage(serviceId, read.getTimestamp()));
} else {
@ -884,7 +884,7 @@ public final class SignalServiceContent {
List<ViewedMessage> viewedMessages = new LinkedList<>();
for (SignalServiceProtos.SyncMessage.Viewed viewed : content.getViewedList()) {
ServiceId serviceId = ServiceId.parseOrNull(viewed.getSenderUuid());
ServiceId serviceId = ServiceId.parseOrNull(viewed.getSenderAci());
if (serviceId != null) {
viewedMessages.add(new ViewedMessage(serviceId, viewed.getTimestamp()));
} else {
@ -896,7 +896,7 @@ public final class SignalServiceContent {
}
if (content.hasViewOnceOpen()) {
ServiceId serviceId = ServiceId.parseOrNull(content.getViewOnceOpen().getSenderUuid());
ServiceId serviceId = ServiceId.parseOrNull(content.getViewOnceOpen().getSenderAci());
if (serviceId != null) {
ViewOnceOpenMessage timerRead = new ViewOnceOpenMessage(serviceId, content.getViewOnceOpen().getTimestamp());
return SignalServiceSyncMessage.forViewOnceOpen(timerRead);
@ -906,10 +906,10 @@ public final class SignalServiceContent {
}
if (content.hasVerified()) {
if (SignalServiceAddress.isValidAddress(content.getVerified().getDestinationUuid())) {
if (SignalServiceAddress.isValidAddress(content.getVerified().getDestinationAci())) {
try {
SignalServiceProtos.Verified verified = content.getVerified();
SignalServiceAddress destination = new SignalServiceAddress(ServiceId.parseOrThrow(verified.getDestinationUuid()));
SignalServiceAddress destination = new SignalServiceAddress(ServiceId.parseOrThrow(verified.getDestinationAci()));
IdentityKey identityKey = new IdentityKey(verified.getIdentityKey().toByteArray(), 0);
VerifiedMessage.VerifiedState verifiedState;
@ -957,7 +957,7 @@ public final class SignalServiceContent {
if (content.hasBlocked()) {
List<String> numbers = content.getBlocked().getNumbersList();
List<String> uuids = content.getBlocked().getUuidsList();
List<String> uuids = content.getBlocked().getAcisList();
List<SignalServiceAddress> addresses = new ArrayList<>(numbers.size() + uuids.size());
List<byte[]> groupIds = new ArrayList<>(content.getBlocked().getGroupIdsList().size());
@ -1021,7 +1021,7 @@ public final class SignalServiceContent {
if (content.getMessageRequestResponse().hasGroupId()) {
responseMessage = MessageRequestResponseMessage.forGroup(content.getMessageRequestResponse().getGroupId().toByteArray(), type);
} else {
ServiceId serviceId = ServiceId.parseOrNull(content.getMessageRequestResponse().getThreadUuid());
ServiceId serviceId = ServiceId.parseOrNull(content.getMessageRequestResponse().getThreadAci());
if (serviceId != null) {
responseMessage = MessageRequestResponseMessage.forIndividual(serviceId, type);
} else {
@ -1040,7 +1040,7 @@ public final class SignalServiceContent {
Money.MobileCoin amount = Money.picoMobileCoin(mobileCoin.getAmountPicoMob());
Money.MobileCoin fee = Money.picoMobileCoin(mobileCoin.getFeePicoMob());
ByteString address = mobileCoin.getRecipientAddress();
Optional<ServiceId> recipient = Optional.ofNullable(ServiceId.parseOrNull(outgoingPayment.getRecipientUuid()));
Optional<ServiceId> recipient = Optional.ofNullable(ServiceId.parseOrNull(outgoingPayment.getRecipientServiceId()));
return SignalServiceSyncMessage.forOutgoingPayment(new OutgoingPaymentMessage(recipient,
amount,
@ -1077,7 +1077,7 @@ public final class SignalServiceContent {
private static SignalServiceStoryMessageRecipient createSignalServiceStoryMessageRecipient(SignalServiceProtos.SyncMessage.Sent.StoryMessageRecipient storyMessageRecipient) {
return new SignalServiceStoryMessageRecipient(
new SignalServiceAddress(ServiceId.parseOrThrow(storyMessageRecipient.getDestinationUuid())),
new SignalServiceAddress(ServiceId.parseOrThrow(storyMessageRecipient.getDestinationServiceId())),
storyMessageRecipient.getDistributionListIdsList(),
storyMessageRecipient.getIsAllowedToReply()
);
@ -1194,7 +1194,7 @@ public final class SignalServiceContent {
attachment.hasThumbnail() ? createAttachmentPointer(attachment.getThumbnail()) : null));
}
ServiceId author = ServiceId.parseOrNull(content.getQuote().getAuthorUuid());
ServiceId author = ServiceId.parseOrNull(content.getQuote().getAuthorAci());
if (author != null) {
return new SignalServiceDataMessage.Quote(content.getQuote().getId(),
author,
@ -1245,9 +1245,9 @@ public final class SignalServiceContent {
List<SignalServiceDataMessage.Mention> mentions = new LinkedList<>();
for (SignalServiceProtos.BodyRange bodyRange : bodyRanges) {
if (bodyRange.hasMentionUuid()) {
if (bodyRange.hasMentionAci()) {
try {
mentions.add(new SignalServiceDataMessage.Mention(ServiceId.parseOrThrow(bodyRange.getMentionUuid()), bodyRange.getStart(), bodyRange.getLength()));
mentions.add(new SignalServiceDataMessage.Mention(ServiceId.parseOrThrow(bodyRange.getMentionAci()), bodyRange.getStart(), bodyRange.getLength()));
} catch (IllegalArgumentException e) {
throw new InvalidMessageStructureException("Invalid body range!");
}
@ -1299,14 +1299,14 @@ public final class SignalServiceContent {
private static @Nullable SignalServiceDataMessage.Reaction createReaction(SignalServiceProtos.DataMessage content) {
if (!content.hasReaction() ||
!content.getReaction().hasEmoji() ||
!content.getReaction().hasTargetAuthorUuid() ||
!content.getReaction().hasTargetAuthorAci() ||
!content.getReaction().hasTargetSentTimestamp())
{
return null;
}
SignalServiceProtos.DataMessage.Reaction reaction = content.getReaction();
ServiceId serviceId = ServiceId.parseOrNull(reaction.getTargetAuthorUuid());
ServiceId serviceId = ServiceId.parseOrNull(reaction.getTargetAuthorAci());
if (serviceId == null) {
Log.w(TAG, "Cannot parse author UUID on reaction");
@ -1361,7 +1361,7 @@ public final class SignalServiceContent {
return null;
}
ServiceId serviceId = ServiceId.parseOrNull(content.getStoryContext().getAuthorUuid());
ServiceId serviceId = ServiceId.parseOrNull(content.getStoryContext().getAuthorAci());
if (serviceId == null) {
throw new InvalidMessageStructureException("Invalid author ACI!");

View file

@ -63,7 +63,7 @@ public class SignalServiceEnvelope {
long serverReceivedTimestamp,
long serverDeliveredTimestamp,
String uuid,
String destinationUuid,
String destinationServiceId,
boolean urgent,
boolean story,
byte[] reportingToken)
@ -73,12 +73,12 @@ public class SignalServiceEnvelope {
.setSourceDevice(senderDevice)
.setTimestamp(timestamp)
.setServerTimestamp(serverReceivedTimestamp)
.setDestinationUuid(destinationUuid)
.setDestinationServiceId(destinationServiceId)
.setUrgent(urgent)
.setStory(story);
if (sender.isPresent()) {
builder.setSourceUuid(sender.get().getServiceId().toString());
builder.setSourceServiceId(sender.get().getServiceId().toString());
}
if (uuid != null) {
@ -103,7 +103,7 @@ public class SignalServiceEnvelope {
long serverReceivedTimestamp,
long serverDeliveredTimestamp,
String uuid,
String destinationUuid,
String destinationServiceId,
boolean urgent,
boolean story,
byte[] reportingToken)
@ -112,7 +112,7 @@ public class SignalServiceEnvelope {
.setType(Envelope.Type.valueOf(type))
.setTimestamp(timestamp)
.setServerTimestamp(serverReceivedTimestamp)
.setDestinationUuid(destinationUuid)
.setDestinationServiceId(destinationServiceId)
.setUrgent(urgent)
.setStory(story);
@ -143,19 +143,19 @@ public class SignalServiceEnvelope {
/**
* @return True if either a source E164 or UUID is present.
*/
public boolean hasSourceUuid() {
return envelope.hasSourceUuid();
public boolean hasSourceServiceId() {
return envelope.hasSourceServiceId();
}
/**
* @return The envelope's sender as a UUID.
*/
public Optional<String> getSourceUuid() {
return Optional.ofNullable(envelope.getSourceUuid());
public Optional<String> getSourceServiceId() {
return Optional.ofNullable(envelope.getSourceServiceId());
}
public String getSourceIdentifier() {
return getSourceUuid().get().toString();
return getSourceServiceId().get().toString();
}
public boolean hasSourceDevice() {
@ -173,7 +173,7 @@ public class SignalServiceEnvelope {
* @return The envelope's sender as a SignalServiceAddress.
*/
public SignalServiceAddress getSourceAddress() {
return new SignalServiceAddress(ServiceId.parseOrNull(envelope.getSourceUuid()));
return new SignalServiceAddress(ServiceId.parseOrNull(envelope.getSourceServiceId()));
}
/**
@ -248,11 +248,11 @@ public class SignalServiceEnvelope {
}
public boolean hasDestinationUuid() {
return envelope.hasDestinationUuid() && UuidUtil.isUuid(envelope.getDestinationUuid());
return envelope.hasDestinationServiceId() && UuidUtil.isUuid(envelope.getDestinationServiceId());
}
public String getDestinationUuid() {
return envelope.getDestinationUuid();
public String getDestinationServiceId() {
return envelope.getDestinationServiceId();
}
public boolean isUrgent() {
@ -285,8 +285,8 @@ public class SignalServiceEnvelope {
.setUrgent(isUrgent())
.setStory(isStory());
if (getSourceUuid().isPresent()) {
builder.setSourceUuid(getSourceUuid().get());
if (getSourceServiceId().isPresent()) {
builder.setSourceUuid(getSourceServiceId().get());
}
if (hasContent()) {
@ -298,7 +298,7 @@ public class SignalServiceEnvelope {
}
if (hasDestinationUuid()) {
builder.setDestinationUuid(getDestinationUuid());
builder.setDestinationUuid(getDestinationServiceId());
}
if (hasReportingToken()) {

View file

@ -41,11 +41,11 @@ public class DeviceContactsInputStream extends ChunkedInputStream {
SignalServiceProtos.ContactDetails details = SignalServiceProtos.ContactDetails.parseFrom(detailsSerialized);
if (!SignalServiceAddress.isValidAddress(details.getUuid(), details.getNumber())) {
if (!SignalServiceAddress.isValidAddress(details.getAci(), details.getNumber())) {
throw new IOException("Missing contact address!");
}
SignalServiceAddress address = new SignalServiceAddress(ServiceId.parseOrThrow(details.getUuid()), details.getNumber());
SignalServiceAddress address = new SignalServiceAddress(ServiceId.parseOrThrow(details.getAci()), details.getNumber());
Optional<String> name = Optional.ofNullable(details.getName());
Optional<SignalServiceAttachmentStream> avatar = Optional.empty();
Optional<String> color = details.hasColor() ? Optional.of(details.getColor()) : Optional.empty();
@ -66,11 +66,11 @@ public class DeviceContactsInputStream extends ChunkedInputStream {
if (details.hasVerified()) {
try {
if (!SignalServiceAddress.isValidAddress(details.getVerified().getDestinationUuid(), null)) {
if (!SignalServiceAddress.isValidAddress(details.getVerified().getDestinationAci(), null)) {
throw new InvalidMessageException("Missing Verified address!");
}
IdentityKey identityKey = new IdentityKey(details.getVerified().getIdentityKey().toByteArray(), 0);
SignalServiceAddress destination = new SignalServiceAddress(ServiceId.parseOrThrow(details.getVerified().getDestinationUuid()));
SignalServiceAddress destination = new SignalServiceAddress(ServiceId.parseOrThrow(details.getVerified().getDestinationAci()));
VerifiedMessage.VerifiedState state;

View file

@ -37,7 +37,7 @@ public class DeviceContactsOutputStream extends ChunkedOutputStream {
private void writeContactDetails(DeviceContact contact) throws IOException {
SignalServiceProtos.ContactDetails.Builder contactDetails = SignalServiceProtos.ContactDetails.newBuilder();
contactDetails.setUuid(contact.getAddress().getServiceId().toString());
contactDetails.setAci(contact.getAddress().getServiceId().toString());
if (contact.getAddress().getNumber().isPresent()) {
contactDetails.setNumber(contact.getAddress().getNumber().get());
@ -69,7 +69,7 @@ public class DeviceContactsOutputStream extends ChunkedOutputStream {
SignalServiceProtos.Verified.Builder verifiedBuilder = SignalServiceProtos.Verified.newBuilder()
.setIdentityKey(ByteString.copyFrom(contact.getVerified().get().getIdentityKey().serialize()))
.setDestinationUuid(contact.getVerified().get().getDestination().getServiceId().toString())
.setDestinationAci(contact.getVerified().get().getDestination().getServiceId().toString())
.setState(state);
contactDetails.setVerified(verifiedBuilder.build());

View file

@ -24,9 +24,9 @@ message Envelope {
optional Type type = 1;
reserved /*sourceE164*/ 2;
optional string sourceUuid = 11;
optional string sourceServiceId = 11;
optional uint32 sourceDevice = 7;
optional string destinationUuid = 13;
optional string destinationServiceId = 13;
reserved /*relay*/ 3;
optional uint64 timestamp = 5;
reserved /*legacyMessage*/ 6;
@ -141,7 +141,7 @@ message BodyRange {
optional uint32 length = 2;
oneof associatedValue {
string mentionUuid = 3;
string mentionAci = 3;
Style style = 4;
}
}
@ -167,7 +167,7 @@ message DataMessage {
optional uint64 id = 1;
reserved /*authorE164*/ 2;
optional string authorUuid = 5;
optional string authorAci = 5;
optional string text = 3;
repeated QuotedAttachment attachments = 4;
repeated BodyRange bodyRanges = 6;
@ -253,7 +253,7 @@ message DataMessage {
optional string emoji = 1;
optional bool remove = 2;
reserved /*targetAuthorE164*/ 3;
optional string targetAuthorUuid = 4;
optional string targetAuthorAci = 4;
optional uint64 targetSentTimestamp = 5;
}
@ -266,22 +266,11 @@ message DataMessage {
}
message StoryContext {
optional string authorUuid = 1;
optional string authorAci = 1;
optional uint64 sentTimestamp = 2;
}
message Payment {
message Address {
message MobileCoin {
optional bytes address = 1;
}
oneof Address {
MobileCoin mobileCoin = 1;
}
}
message Amount {
message MobileCoin {
optional uint64 picoMob = 1;
@ -302,6 +291,7 @@ message DataMessage {
}
optional string note = 2;
reserved /*requestId*/ 1003;
}
message Activation {
@ -317,6 +307,9 @@ message DataMessage {
Notification notification = 1;
Activation activation = 2;
}
reserved /*request*/ 1002;
reserved /*cancellation*/ 1003;
}
message GiftBadge {
@ -442,7 +435,7 @@ message Verified {
}
reserved /*destinationE164*/ 1;
optional string destinationUuid = 5;
optional string destinationAci = 5;
optional bytes identityKey = 2;
optional State state = 3;
optional bytes nullMessage = 4;
@ -452,18 +445,18 @@ message SyncMessage {
message Sent {
message UnidentifiedDeliveryStatus {
reserved /*destinationE164*/ 1;
optional string destinationUuid = 3;
optional string destinationServiceId = 3;
optional bool unidentified = 2;
}
message StoryMessageRecipient {
optional string destinationUuid = 1;
optional string destinationServiceId = 1;
repeated string distributionListIds = 2;
optional bool isAllowedToReply = 3;
}
optional string destinationE164 = 1;
optional string destinationUuid = 7;
optional string destinationServiceId = 7;
optional uint64 timestamp = 2;
optional DataMessage message = 3;
optional uint64 expirationStartTimestamp = 4;
@ -481,7 +474,7 @@ message SyncMessage {
message Blocked {
repeated string numbers = 1;
repeated string uuids = 3;
repeated string acis = 3;
repeated bytes groupIds = 2;
}
@ -501,13 +494,13 @@ message SyncMessage {
message Read {
reserved /*senderE164*/ 1;
optional string senderUuid = 3;
optional string senderAci = 3;
optional uint64 timestamp = 2;
}
message Viewed {
reserved /*senderE164*/ 1;
optional string senderUuid = 3;
optional string senderAci = 3;
optional uint64 timestamp = 2;
}
@ -533,7 +526,7 @@ message SyncMessage {
message ViewOnceOpen {
reserved /*senderE164*/ 1;
optional string senderUuid = 3;
optional string senderAci = 3;
optional uint64 timestamp = 2;
}
@ -562,7 +555,7 @@ message SyncMessage {
}
reserved /*threadE164*/ 1;
optional string threadUuid = 2;
optional string threadAci = 2;
optional bytes groupId = 3;
optional Type type = 4;
}
@ -581,7 +574,7 @@ message SyncMessage {
repeated bytes spentKeyImages = 7;
repeated bytes outputPublicKeys = 8;
}
optional string recipientUuid = 1;
optional string recipientServiceId = 1;
optional string note = 2;
oneof paymentDetail {
@ -719,7 +712,7 @@ message ContactDetails {
}
optional string number = 1;
optional string uuid = 9;
optional string aci = 9;
optional string name = 2;
optional Avatar avatar = 3;
optional string color = 4;

View file

@ -99,9 +99,9 @@ class SignalClient {
val encryptedContent: ByteArray = Base64.decode(outgoingPushMessage.content)
return SignalServiceProtos.Envelope.newBuilder()
.setSourceUuid(serviceId.toString())
.setSourceServiceId(serviceId.toString())
.setSourceDevice(1)
.setDestinationUuid(to.serviceId.toString())
.setDestinationServiceId(to.serviceId.toString())
.setTimestamp(sentTimestamp)
.setServerTimestamp(sentTimestamp)
.setServerGuid(UUID.randomUUID().toString())
@ -132,9 +132,9 @@ class SignalClient {
val encryptedContent: ByteArray = Base64.decode(outgoingPushMessage.content)
return SignalServiceProtos.Envelope.newBuilder()
.setSourceUuid(serviceId.toString())
.setSourceServiceId(serviceId.toString())
.setSourceDevice(1)
.setDestinationUuid(to.serviceId.toString())
.setDestinationServiceId(to.serviceId.toString())
.setTimestamp(sentTimestamp)
.setServerTimestamp(sentTimestamp)
.setServerGuid(UUID.randomUUID().toString())