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

View File

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

View File

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

View File

@@ -41,7 +41,7 @@ class TestProtos private constructor() {
authorUuid: String = UUID.randomUUID().toString() authorUuid: String = UUID.randomUUID().toString()
): DataMessage.StoryContext.Builder { ): DataMessage.StoryContext.Builder {
return DataMessage.StoryContext.newBuilder() return DataMessage.StoryContext.newBuilder()
.setAuthorUuid(authorUuid) .setAuthorAci(authorUuid)
.setSentTimestamp(sentTimestamp) .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> { 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) return setTimestampReadFromSyncMessage(reads, proposedExpireStarted, threadToLatestRead)
} }

View File

@@ -57,7 +57,7 @@ public class PushTable extends DatabaseTable {
} else { } else {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(TYPE, envelope.getType()); 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(DEVICE_ID, envelope.getSourceDevice());
values.put(CONTENT, envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : ""); values.put(CONTENT, envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : "");
values.put(TIMESTAMP, envelope.getTimestamp()); values.put(TIMESTAMP, envelope.getTimestamp());
@@ -132,7 +132,7 @@ public class PushTable extends DatabaseTable {
String.valueOf(envelope.getSourceDevice()), String.valueOf(envelope.getSourceDevice()),
envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : "", envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : "",
String.valueOf(envelope.getTimestamp()), 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)) { 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 { fun fromRecipientsSet(recipients: List<SignalServiceProtos.SyncMessage.Sent.StoryMessageRecipient>): SentStorySyncManifest {
val entries = recipients.toSet().map { recipient -> val entries = recipients.toSet().map { recipient ->
Entry( Entry(
recipientId = RecipientId.from(ServiceId.parseOrThrow(recipient.destinationUuid)), recipientId = RecipientId.from(ServiceId.parseOrThrow(recipient.destinationServiceId)),
allowedToReply = recipient.isAllowedToReply, allowedToReply = recipient.isAllowedToReply,
distributionLists = recipient.distributionListIdsList.map { DistributionId.from(it) } distributionLists = recipient.distributionListIdsList.map { DistributionId.from(it) }
) )

View File

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

View File

@@ -368,7 +368,7 @@ object DataMessageProcessor {
return null return null
} }
val authorServiceId: ServiceId = ServiceId.parseOrThrow(message.storyContext.authorUuid) val authorServiceId: ServiceId = ServiceId.parseOrThrow(message.storyContext.authorAci)
val sentTimestamp = message.storyContext.sentTimestamp val sentTimestamp = message.storyContext.sentTimestamp
SignalDatabase.messages.beginTransaction() SignalDatabase.messages.beginTransaction()
@@ -459,7 +459,7 @@ object DataMessageProcessor {
val emoji: String = message.reaction.emoji val emoji: String = message.reaction.emoji
val isRemove: Boolean = message.reaction.remove 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 val targetSentTimestamp = message.reaction.targetSentTimestamp
if (targetAuthorServiceId.isUnknown) { if (targetAuthorServiceId.isUnknown) {
@@ -668,7 +668,7 @@ object DataMessageProcessor {
): MessageId? { ): MessageId? {
log(envelope.timestamp, "Story reply.") 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 val sentTimestamp = message.storyContext.sentTimestamp
SignalDatabase.messages.beginTransaction() SignalDatabase.messages.beginTransaction()
@@ -990,9 +990,9 @@ object DataMessageProcessor {
fun getMentions(mentionBodyRanges: List<BodyRange>): List<Mention> { fun getMentions(mentionBodyRanges: List<BodyRange>): List<Mention> {
return mentionBodyRanges return mentionBodyRanges
.filter { it.hasMentionUuid() } .filter { it.hasMentionAci() }
.mapNotNull { .mapNotNull {
val serviceId = ServiceId.parseOrNull(it.mentionUuid) val serviceId = ServiceId.parseOrNull(it.mentionAci)
if (serviceId != null && !serviceId.isUnknown) { if (serviceId != null && !serviceId.isUnknown) {
val id = Recipient.externalPush(serviceId).id val id = Recipient.externalPush(serviceId).id
@@ -1031,7 +1031,7 @@ object DataMessageProcessor {
return null 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 var quotedMessage = SignalDatabase.messages.getMessageFor(quote.id, authorId) as? MediaMmsMessageRecord
if (quotedMessage != null && !quotedMessage.isRemoteDelete) { if (quotedMessage != null && !quotedMessage.isRemoteDelete) {
@@ -1086,7 +1086,7 @@ object DataMessageProcessor {
quote.attachmentsList.mapNotNull { PointerAttachment.forPointer(it).orNull() }, quote.attachmentsList.mapNotNull { PointerAttachment.forPointer(it).orNull() },
getMentions(quote.bodyRangesList), getMentions(quote.bodyRangesList),
QuoteModel.Type.fromProto(quote.type), 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) { private fun processReceipt(envelope: SignalServiceProtos.Envelope) {
if (!UuidUtil.isUuid(envelope.sourceUuid)) { if (!UuidUtil.isUuid(envelope.sourceServiceId)) {
Log.w(TAG, "Invalid envelope source UUID!") Log.w(TAG, "Invalid envelope source UUID!")
return 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}") Log.i(TAG, "Received server receipt. Sender: $senderId, Device: ${envelope.sourceDevice}, Timestamp: ${envelope.timestamp}")
SignalDatabase.messages.incrementDeliveryReceiptCount(envelope.timestamp, senderId, System.currentTimeMillis()) SignalDatabase.messages.incrementDeliveryReceiptCount(envelope.timestamp, senderId, System.currentTimeMillis())

View File

@@ -89,10 +89,10 @@ object MessageDecryptor {
val destination: ServiceId = envelope.getDestination(selfAci, selfPni) 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.") 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) { if (sourceServiceId != null) {
val sender = RecipientId.from(sourceServiceId) 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.") Log.w(TAG, "${logPrefix(envelope)} Got a sealed sender message to our PNI? Invalid message, ignoring.")
return Result.Ignore(envelope, serverDeliveredTimestamp, emptyList()) return Result.Ignore(envelope, serverDeliveredTimestamp, emptyList())
} }
@@ -352,7 +352,7 @@ object MessageDecryptor {
} }
private fun logPrefix(envelope: Envelope): String { 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 { private fun logPrefix(envelope: Envelope, sender: ServiceId): String {
@@ -367,7 +367,7 @@ object MessageDecryptor {
return if (exception.sender != null) { return if (exception.sender != null) {
logPrefix(envelope.timestamp, exception.sender, exception.senderDevice) logPrefix(envelope.timestamp, exception.sender, exception.senderDevice)
} else { } 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 { private fun Envelope.getDestination(selfAci: ServiceId, selfPni: ServiceId): ServiceId {
return if (!FeatureFlags.phoneNumberPrivacy()) { return if (!FeatureFlags.phoneNumberPrivacy()) {
selfAci selfAci
} else if (this.hasDestinationUuid()) { } else if (this.hasDestinationServiceId()) {
val serviceId = ServiceId.parseOrThrow(this.destinationUuid) val serviceId = ServiceId.parseOrThrow(this.destinationServiceId)
if (serviceId == selfAci || serviceId == selfPni) { if (serviceId == selfAci || serviceId == selfPni) {
serviceId serviceId
} else { } else {

View File

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

View File

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

View File

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

View File

@@ -178,7 +178,7 @@ public final class IdentityUtil {
} }
public static void processVerifiedMessage(Context context, SignalServiceProtos.Verified verified) throws InvalidKeyException { 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); IdentityKey identityKey = new IdentityKey(verified.getIdentityKey().toByteArray(), 0);
VerifiedMessage.VerifiedState state; VerifiedMessage.VerifiedState state;

View File

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

View File

@@ -209,27 +209,27 @@ public class SignalServiceCipher {
byte[] paddedMessage; byte[] paddedMessage;
SignalServiceMetadata metadata; 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!"); throw new InvalidMessageStructureException("Non-UD envelope is missing a UUID!");
} }
if (envelope.getType().getNumber() == Envelope.Type.PREKEY_BUNDLE_VALUE) { 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)); SignalSessionCipher sessionCipher = new SignalSessionCipher(sessionLock, new SessionCipher(signalProtocolStore, sourceAddress));
paddedMessage = sessionCipher.decrypt(new PreKeySignalMessage(envelope.getContent().toByteArray())); 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)); signalProtocolStore.clearSenderKeySharedWith(Collections.singleton(sourceAddress));
} else if (envelope.getType().getNumber() == Envelope.Type.CIPHERTEXT_VALUE) { } 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)); SignalSessionCipher sessionCipher = new SignalSessionCipher(sessionLock, new SessionCipher(signalProtocolStore, sourceAddress));
paddedMessage = sessionCipher.decrypt(new SignalMessage(envelope.getContent().toByteArray())); 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) { } else if (envelope.getType().getNumber() == Envelope.Type.PLAINTEXT_CONTENT_VALUE) {
paddedMessage = new PlaintextContent(envelope.getContent().toByteArray()).getBody(); 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) { } 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)); 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()); DecryptionResult result = sealedSessionCipher.decrypt(certificateValidator, envelope.getContent().toByteArray(), envelope.getServerTimestamp());
@@ -237,7 +237,7 @@ public class SignalServiceCipher {
Optional<byte[]> groupId = result.getGroupId(); Optional<byte[]> groupId = result.getGroupId();
boolean needsReceipt = true; 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"); Log.w(TAG, "[" + envelope.getTimestamp() + "] Received a UD-encrypted message sent over an identified channel. Marking as needsReceipt=false");
needsReceipt = false; needsReceipt = false;
} }
@@ -247,7 +247,7 @@ public class SignalServiceCipher {
} }
paddedMessage = result.getPaddedMessage(); 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 { } else {
throw new InvalidMetadataMessageException("Unknown type: " + envelope.getType()); throw new InvalidMetadataMessageException("Unknown type: " + envelope.getType());
} }
@@ -257,26 +257,26 @@ public class SignalServiceCipher {
return new Plaintext(metadata, data); return new Plaintext(metadata, data);
} catch (DuplicateMessageException e) { } catch (DuplicateMessageException e) {
throw new ProtocolDuplicateMessageException(e, envelope.getSourceUuid(), envelope.getSourceDevice()); throw new ProtocolDuplicateMessageException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (LegacyMessageException e) { } catch (LegacyMessageException e) {
throw new ProtocolLegacyMessageException(e, envelope.getSourceUuid(), envelope.getSourceDevice()); throw new ProtocolLegacyMessageException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidMessageException e) { } catch (InvalidMessageException e) {
throw new ProtocolInvalidMessageException(e, envelope.getSourceUuid(), envelope.getSourceDevice()); throw new ProtocolInvalidMessageException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidKeyIdException e) { } catch (InvalidKeyIdException e) {
throw new ProtocolInvalidKeyIdException(e, envelope.getSourceUuid(), envelope.getSourceDevice()); throw new ProtocolInvalidKeyIdException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidKeyException e) { } catch (InvalidKeyException e) {
throw new ProtocolInvalidKeyException(e, envelope.getSourceUuid(), envelope.getSourceDevice()); throw new ProtocolInvalidKeyException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (UntrustedIdentityException e) { } catch (UntrustedIdentityException e) {
throw new ProtocolUntrustedIdentityException(e, envelope.getSourceUuid(), envelope.getSourceDevice()); throw new ProtocolUntrustedIdentityException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (InvalidVersionException e) { } catch (InvalidVersionException e) {
throw new ProtocolInvalidVersionException(e, envelope.getSourceUuid(), envelope.getSourceDevice()); throw new ProtocolInvalidVersionException(e, envelope.getSourceServiceId(), envelope.getSourceDevice());
} catch (NoSessionException e) { } 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) { private static SignalServiceAddress getSourceAddress(Envelope envelope) {
return new SignalServiceAddress(ServiceId.parseOrNull(envelope.getSourceUuid())); return new SignalServiceAddress(ServiceId.parseOrNull(envelope.getSourceServiceId()));
} }
private static class Plaintext { 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}") 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!") return Result.Invalid("[DataMessage] Invalid UUID on quote!")
} }
@@ -79,7 +79,7 @@ object EnvelopeContentValidator {
return Result.Invalid("[DataMessage] Invalid AttachmentPointer on DataMessage.previewList.image!") 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!") return Result.Invalid("[DataMessage] Invalid UUID on body range!")
} }
@@ -91,7 +91,7 @@ object EnvelopeContentValidator {
if (!dataMessage.reaction.hasTargetSentTimestamp()) { if (!dataMessage.reaction.hasTargetSentTimestamp()) {
return Result.Invalid("[DataMessage] Missing timestamp on DataMessage.reaction!") 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!") return Result.Invalid("[DataMessage] Invalid UUID on DataMessage.reaction!")
} }
} }
@@ -100,7 +100,7 @@ object EnvelopeContentValidator {
return Result.Invalid("[DataMessage] Missing timestamp on DataMessage.delete!") 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!") return Result.Invalid("[DataMessage] Invalid UUID on DataMessage.storyContext!")
} }
@@ -130,7 +130,7 @@ object EnvelopeContentValidator {
private fun validateSyncMessage(envelope: Envelope, syncMessage: SyncMessage): Result { private fun validateSyncMessage(envelope: Envelope, syncMessage: SyncMessage): Result {
if (syncMessage.hasSent()) { if (syncMessage.hasSent()) {
val validAddress = syncMessage.sent.destinationUuid.isValidUuid() val validAddress = syncMessage.sent.destinationServiceId.isValidUuid()
val hasDataGroup = syncMessage.sent.message?.hasGroupV2() ?: false val hasDataGroup = syncMessage.sent.message?.hasGroupV2() ?: false
val hasStoryGroup = syncMessage.sent.storyMessage?.hasGroup() ?: false val hasStoryGroup = syncMessage.sent.storyMessage?.hasGroup() ?: false
val hasStoryManifest = syncMessage.sent.storyMessageRecipientsList.isNotEmpty() val hasStoryManifest = syncMessage.sent.storyMessageRecipientsList.isNotEmpty()
@@ -153,7 +153,7 @@ object EnvelopeContentValidator {
} }
for (status in syncMessage.sent.unidentifiedStatusList) { for (status in syncMessage.sent.unidentifiedStatusList) {
if (status.destinationUuid.isNullOrInvalidUuid()) { if (status.destinationServiceId.isNullOrInvalidUuid()) {
return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.sent.unidentifiedStatusList!") 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!") 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!") 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!") 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!") return Result.Invalid("[SyncMessage] Invalid UUID in SyncMessage.verified!")
} }
@@ -189,11 +189,11 @@ object EnvelopeContentValidator {
return Result.Invalid("[SyncMessage] Missing packId in stickerPackOperationList!") 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!") 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!") 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!") 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!") 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<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<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<SignalServiceEditMessage> editMessage = sentContent.hasEditMessage() ? Optional.of(createEditMessage(metadata, sentContent.getEditMessage())) : Optional.empty();
Optional<SignalServiceAddress> address = SignalServiceAddress.isValidAddress(sentContent.getDestinationUuid()) Optional<SignalServiceAddress> address = SignalServiceAddress.isValidAddress(sentContent.getDestinationServiceId())
? Optional.of(new SignalServiceAddress(ServiceId.parseOrThrow(sentContent.getDestinationUuid()), sentContent.getDestinationE164())) ? Optional.of(new SignalServiceAddress(ServiceId.parseOrThrow(sentContent.getDestinationServiceId()), sentContent.getDestinationE164()))
: Optional.empty(); : Optional.empty();
Set<SignalServiceStoryMessageRecipient> recipientManifest = sentContent.getStoryMessageRecipientsList() Set<SignalServiceStoryMessageRecipient> recipientManifest = sentContent.getStoryMessageRecipientsList()
.stream() .stream()
@@ -843,8 +843,8 @@ public final class SignalServiceContent {
} }
for (SignalServiceProtos.SyncMessage.Sent.UnidentifiedDeliveryStatus status : sentContent.getUnidentifiedStatusList()) { for (SignalServiceProtos.SyncMessage.Sent.UnidentifiedDeliveryStatus status : sentContent.getUnidentifiedStatusList()) {
if (SignalServiceAddress.isValidAddress(status.getDestinationUuid(), null)) { if (SignalServiceAddress.isValidAddress(status.getDestinationServiceId(), null)) {
unidentifiedStatuses.put(ServiceId.parseOrNull(status.getDestinationUuid()), status.getUnidentified()); unidentifiedStatuses.put(ServiceId.parseOrNull(status.getDestinationServiceId()), status.getUnidentified());
} else { } else {
Log.w(TAG, "Encountered an invalid UnidentifiedDeliveryStatus in a SentTranscript! Ignoring."); Log.w(TAG, "Encountered an invalid UnidentifiedDeliveryStatus in a SentTranscript! Ignoring.");
} }
@@ -869,7 +869,7 @@ public final class SignalServiceContent {
List<ReadMessage> readMessages = new LinkedList<>(); List<ReadMessage> readMessages = new LinkedList<>();
for (SignalServiceProtos.SyncMessage.Read read : content.getReadList()) { for (SignalServiceProtos.SyncMessage.Read read : content.getReadList()) {
ServiceId serviceId = ServiceId.parseOrNull(read.getSenderUuid()); ServiceId serviceId = ServiceId.parseOrNull(read.getSenderAci());
if (serviceId != null) { if (serviceId != null) {
readMessages.add(new ReadMessage(serviceId, read.getTimestamp())); readMessages.add(new ReadMessage(serviceId, read.getTimestamp()));
} else { } else {
@@ -884,7 +884,7 @@ public final class SignalServiceContent {
List<ViewedMessage> viewedMessages = new LinkedList<>(); List<ViewedMessage> viewedMessages = new LinkedList<>();
for (SignalServiceProtos.SyncMessage.Viewed viewed : content.getViewedList()) { for (SignalServiceProtos.SyncMessage.Viewed viewed : content.getViewedList()) {
ServiceId serviceId = ServiceId.parseOrNull(viewed.getSenderUuid()); ServiceId serviceId = ServiceId.parseOrNull(viewed.getSenderAci());
if (serviceId != null) { if (serviceId != null) {
viewedMessages.add(new ViewedMessage(serviceId, viewed.getTimestamp())); viewedMessages.add(new ViewedMessage(serviceId, viewed.getTimestamp()));
} else { } else {
@@ -896,7 +896,7 @@ public final class SignalServiceContent {
} }
if (content.hasViewOnceOpen()) { if (content.hasViewOnceOpen()) {
ServiceId serviceId = ServiceId.parseOrNull(content.getViewOnceOpen().getSenderUuid()); ServiceId serviceId = ServiceId.parseOrNull(content.getViewOnceOpen().getSenderAci());
if (serviceId != null) { if (serviceId != null) {
ViewOnceOpenMessage timerRead = new ViewOnceOpenMessage(serviceId, content.getViewOnceOpen().getTimestamp()); ViewOnceOpenMessage timerRead = new ViewOnceOpenMessage(serviceId, content.getViewOnceOpen().getTimestamp());
return SignalServiceSyncMessage.forViewOnceOpen(timerRead); return SignalServiceSyncMessage.forViewOnceOpen(timerRead);
@@ -906,10 +906,10 @@ public final class SignalServiceContent {
} }
if (content.hasVerified()) { if (content.hasVerified()) {
if (SignalServiceAddress.isValidAddress(content.getVerified().getDestinationUuid())) { if (SignalServiceAddress.isValidAddress(content.getVerified().getDestinationAci())) {
try { try {
SignalServiceProtos.Verified verified = content.getVerified(); 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); IdentityKey identityKey = new IdentityKey(verified.getIdentityKey().toByteArray(), 0);
VerifiedMessage.VerifiedState verifiedState; VerifiedMessage.VerifiedState verifiedState;
@@ -957,7 +957,7 @@ public final class SignalServiceContent {
if (content.hasBlocked()) { if (content.hasBlocked()) {
List<String> numbers = content.getBlocked().getNumbersList(); 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<SignalServiceAddress> addresses = new ArrayList<>(numbers.size() + uuids.size());
List<byte[]> groupIds = new ArrayList<>(content.getBlocked().getGroupIdsList().size()); List<byte[]> groupIds = new ArrayList<>(content.getBlocked().getGroupIdsList().size());
@@ -1021,7 +1021,7 @@ public final class SignalServiceContent {
if (content.getMessageRequestResponse().hasGroupId()) { if (content.getMessageRequestResponse().hasGroupId()) {
responseMessage = MessageRequestResponseMessage.forGroup(content.getMessageRequestResponse().getGroupId().toByteArray(), type); responseMessage = MessageRequestResponseMessage.forGroup(content.getMessageRequestResponse().getGroupId().toByteArray(), type);
} else { } else {
ServiceId serviceId = ServiceId.parseOrNull(content.getMessageRequestResponse().getThreadUuid()); ServiceId serviceId = ServiceId.parseOrNull(content.getMessageRequestResponse().getThreadAci());
if (serviceId != null) { if (serviceId != null) {
responseMessage = MessageRequestResponseMessage.forIndividual(serviceId, type); responseMessage = MessageRequestResponseMessage.forIndividual(serviceId, type);
} else { } else {
@@ -1040,7 +1040,7 @@ public final class SignalServiceContent {
Money.MobileCoin amount = Money.picoMobileCoin(mobileCoin.getAmountPicoMob()); Money.MobileCoin amount = Money.picoMobileCoin(mobileCoin.getAmountPicoMob());
Money.MobileCoin fee = Money.picoMobileCoin(mobileCoin.getFeePicoMob()); Money.MobileCoin fee = Money.picoMobileCoin(mobileCoin.getFeePicoMob());
ByteString address = mobileCoin.getRecipientAddress(); 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, return SignalServiceSyncMessage.forOutgoingPayment(new OutgoingPaymentMessage(recipient,
amount, amount,
@@ -1077,7 +1077,7 @@ public final class SignalServiceContent {
private static SignalServiceStoryMessageRecipient createSignalServiceStoryMessageRecipient(SignalServiceProtos.SyncMessage.Sent.StoryMessageRecipient storyMessageRecipient) { private static SignalServiceStoryMessageRecipient createSignalServiceStoryMessageRecipient(SignalServiceProtos.SyncMessage.Sent.StoryMessageRecipient storyMessageRecipient) {
return new SignalServiceStoryMessageRecipient( return new SignalServiceStoryMessageRecipient(
new SignalServiceAddress(ServiceId.parseOrThrow(storyMessageRecipient.getDestinationUuid())), new SignalServiceAddress(ServiceId.parseOrThrow(storyMessageRecipient.getDestinationServiceId())),
storyMessageRecipient.getDistributionListIdsList(), storyMessageRecipient.getDistributionListIdsList(),
storyMessageRecipient.getIsAllowedToReply() storyMessageRecipient.getIsAllowedToReply()
); );
@@ -1194,7 +1194,7 @@ public final class SignalServiceContent {
attachment.hasThumbnail() ? createAttachmentPointer(attachment.getThumbnail()) : null)); attachment.hasThumbnail() ? createAttachmentPointer(attachment.getThumbnail()) : null));
} }
ServiceId author = ServiceId.parseOrNull(content.getQuote().getAuthorUuid()); ServiceId author = ServiceId.parseOrNull(content.getQuote().getAuthorAci());
if (author != null) { if (author != null) {
return new SignalServiceDataMessage.Quote(content.getQuote().getId(), return new SignalServiceDataMessage.Quote(content.getQuote().getId(),
author, author,
@@ -1245,9 +1245,9 @@ public final class SignalServiceContent {
List<SignalServiceDataMessage.Mention> mentions = new LinkedList<>(); List<SignalServiceDataMessage.Mention> mentions = new LinkedList<>();
for (SignalServiceProtos.BodyRange bodyRange : bodyRanges) { for (SignalServiceProtos.BodyRange bodyRange : bodyRanges) {
if (bodyRange.hasMentionUuid()) { if (bodyRange.hasMentionAci()) {
try { 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) { } catch (IllegalArgumentException e) {
throw new InvalidMessageStructureException("Invalid body range!"); throw new InvalidMessageStructureException("Invalid body range!");
} }
@@ -1299,14 +1299,14 @@ public final class SignalServiceContent {
private static @Nullable SignalServiceDataMessage.Reaction createReaction(SignalServiceProtos.DataMessage content) { private static @Nullable SignalServiceDataMessage.Reaction createReaction(SignalServiceProtos.DataMessage content) {
if (!content.hasReaction() || if (!content.hasReaction() ||
!content.getReaction().hasEmoji() || !content.getReaction().hasEmoji() ||
!content.getReaction().hasTargetAuthorUuid() || !content.getReaction().hasTargetAuthorAci() ||
!content.getReaction().hasTargetSentTimestamp()) !content.getReaction().hasTargetSentTimestamp())
{ {
return null; return null;
} }
SignalServiceProtos.DataMessage.Reaction reaction = content.getReaction(); SignalServiceProtos.DataMessage.Reaction reaction = content.getReaction();
ServiceId serviceId = ServiceId.parseOrNull(reaction.getTargetAuthorUuid()); ServiceId serviceId = ServiceId.parseOrNull(reaction.getTargetAuthorAci());
if (serviceId == null) { if (serviceId == null) {
Log.w(TAG, "Cannot parse author UUID on reaction"); Log.w(TAG, "Cannot parse author UUID on reaction");
@@ -1361,7 +1361,7 @@ public final class SignalServiceContent {
return null; return null;
} }
ServiceId serviceId = ServiceId.parseOrNull(content.getStoryContext().getAuthorUuid()); ServiceId serviceId = ServiceId.parseOrNull(content.getStoryContext().getAuthorAci());
if (serviceId == null) { if (serviceId == null) {
throw new InvalidMessageStructureException("Invalid author ACI!"); throw new InvalidMessageStructureException("Invalid author ACI!");

View File

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

View File

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

View File

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

View File

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

View File

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