diff --git a/graalvm-config-dir/reflect-config.json b/graalvm-config-dir/reflect-config.json index a1465c188e..442ad3c276 100644 --- a/graalvm-config-dir/reflect-config.json +++ b/graalvm-config-dir/reflect-config.json @@ -101,55 +101,10 @@ "methods":[{"name":"","parameterTypes":[] }] }, { - "name":"com.google.protobuf.AbstractProtobufList", + "name":"com.squareup.wire.internal.ImmutableList", "allDeclaredFields":true, - "allDeclaredMethods":true -}, -{ - "name":"com.google.protobuf.ByteString" -}, -{ - "name":"com.google.protobuf.DescriptorMessageInfoFactory" -}, -{ - "name":"com.google.protobuf.ExtensionRegistry" -}, -{ - "name":"com.google.protobuf.ExtensionSchemaFull" -}, -{ - "name":"com.google.protobuf.GeneratedMessageLite", - "fields":[{"name":"unknownFields"}] -}, -{ - "name":"com.google.protobuf.GeneratedMessageV3" -}, -{ - "name":"com.google.protobuf.Internal$LongList", - "allDeclaredMethods":true -}, -{ - "name":"com.google.protobuf.Internal$ProtobufList", - "allDeclaredMethods":true -}, -{ - "name":"com.google.protobuf.LongArrayList", - "allDeclaredFields":true, - "allDeclaredMethods":true, - "allDeclaredConstructors":true -}, -{ - "name":"com.google.protobuf.MapFieldSchemaFull" -}, -{ - "name":"com.google.protobuf.NewInstanceSchemaFull" -}, -{ - "name":"com.google.protobuf.PrimitiveNonBoxingCollection", - "allDeclaredMethods":true -}, -{ - "name":"com.google.protobuf.UnknownFieldSetSchema" + "queryAllDeclaredMethods":true, + "queryAllDeclaredConstructors":true }, { "name":"com.sun.crypto.provider.AESCipher$General", @@ -534,6 +489,16 @@ { "name":"kotlin.String" }, +{ + "name":"kotlin.collections.AbstractCollection", + "allDeclaredFields":true, + "queryAllDeclaredMethods":true +}, +{ + "name":"kotlin.collections.AbstractList", + "allDeclaredFields":true, + "queryAllDeclaredMethods":true +}, { "name":"kotlin.collections.List" }, @@ -547,6 +512,10 @@ { "name":"kotlin.jvm.internal.DefaultConstructorMarker" }, +{ + "name":"kotlin.jvm.internal.markers.KMappedMarker", + "queryAllDeclaredMethods":true +}, { "name":"kotlin.reflect.jvm.internal.ReflectionFactoryImpl", "methods":[{"name":"","parameterTypes":[] }] @@ -844,31 +813,36 @@ "name":"org.asamk.signal.json.JsonContactAddress", "allDeclaredFields":true, "allDeclaredMethods":true, - "allDeclaredConstructors":true + "allDeclaredConstructors":true, + "methods":[{"name":"city","parameterTypes":[] }, {"name":"country","parameterTypes":[] }, {"name":"label","parameterTypes":[] }, {"name":"neighborhood","parameterTypes":[] }, {"name":"pobox","parameterTypes":[] }, {"name":"postcode","parameterTypes":[] }, {"name":"region","parameterTypes":[] }, {"name":"street","parameterTypes":[] }, {"name":"type","parameterTypes":[] }] }, { "name":"org.asamk.signal.json.JsonContactAvatar", "allDeclaredFields":true, "allDeclaredMethods":true, - "allDeclaredConstructors":true + "allDeclaredConstructors":true, + "methods":[{"name":"attachment","parameterTypes":[] }, {"name":"isProfile","parameterTypes":[] }] }, { "name":"org.asamk.signal.json.JsonContactEmail", "allDeclaredFields":true, "allDeclaredMethods":true, - "allDeclaredConstructors":true + "allDeclaredConstructors":true, + "methods":[{"name":"label","parameterTypes":[] }, {"name":"type","parameterTypes":[] }, {"name":"value","parameterTypes":[] }] }, { "name":"org.asamk.signal.json.JsonContactName", "allDeclaredFields":true, "allDeclaredMethods":true, - "allDeclaredConstructors":true + "allDeclaredConstructors":true, + "methods":[{"name":"display","parameterTypes":[] }, {"name":"family","parameterTypes":[] }, {"name":"given","parameterTypes":[] }, {"name":"middle","parameterTypes":[] }, {"name":"prefix","parameterTypes":[] }, {"name":"suffix","parameterTypes":[] }] }, { "name":"org.asamk.signal.json.JsonContactPhone", "allDeclaredFields":true, "allDeclaredMethods":true, - "allDeclaredConstructors":true + "allDeclaredConstructors":true, + "methods":[{"name":"label","parameterTypes":[] }, {"name":"type","parameterTypes":[] }, {"name":"value","parameterTypes":[] }] }, { "name":"org.asamk.signal.json.JsonDataMessage", @@ -984,7 +958,8 @@ "name":"org.asamk.signal.json.JsonSharedContact", "allDeclaredFields":true, "allDeclaredMethods":true, - "allDeclaredConstructors":true + "allDeclaredConstructors":true, + "methods":[{"name":"address","parameterTypes":[] }, {"name":"avatar","parameterTypes":[] }, {"name":"email","parameterTypes":[] }, {"name":"name","parameterTypes":[] }, {"name":"organization","parameterTypes":[] }, {"name":"phone","parameterTypes":[] }] }, { "name":"org.asamk.signal.json.JsonSticker", @@ -2130,13 +2105,6 @@ { "name":"org.whispersystems.signalservice.api.push.ServiceId$ACI" }, -{ - "name":"org.whispersystems.signalservice.api.push.ServiceId$Companion", - "allDeclaredFields":true, - "queryAllDeclaredMethods":true, - "queryAllDeclaredConstructors":true, - "methods":[{"name":"fromLibSignal","parameterTypes":["org.signal.libsignal.protocol.ServiceId"] }, {"name":"parseOrNull","parameterTypes":["com.google.protobuf.ByteString"] }, {"name":"parseOrNull","parameterTypes":["java.lang.String"] }, {"name":"parseOrNull","parameterTypes":["byte[]"] }, {"name":"parseOrThrow","parameterTypes":["com.google.protobuf.ByteString"] }, {"name":"parseOrThrow","parameterTypes":["java.lang.String"] }, {"name":"parseOrThrow","parameterTypes":["byte[]"] }] -}, { "name":"org.whispersystems.signalservice.api.push.ServiceId$PNI" }, @@ -2534,270 +2502,6 @@ "name":"org.whispersystems.signalservice.internal.push.SenderCertificate$ByteArrayDesieralizer", "methods":[{"name":"","parameterTypes":[] }] }, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$AttachmentPointer", - "fields":[{"name":"attachmentIdentifierCase_"}, {"name":"attachmentIdentifier_"}, {"name":"bitField0_"}, {"name":"blurHash_"}, {"name":"caption_"}, {"name":"cdnNumber_"}, {"name":"contentType_"}, {"name":"digest_"}, {"name":"fileName_"}, {"name":"flags_"}, {"name":"height_"}, {"name":"incrementalDigest_"}, {"name":"key_"}, {"name":"size_"}, {"name":"thumbnail_"}, {"name":"uploadTimestamp_"}, {"name":"width_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$BodyRange", - "fields":[{"name":"associatedValueCase_"}, {"name":"associatedValue_"}, {"name":"bitField0_"}, {"name":"length_"}, {"name":"start_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$CallMessage", - "fields":[{"name":"answer_"}, {"name":"bitField0_"}, {"name":"busy_"}, {"name":"destinationDeviceId_"}, {"name":"hangup_"}, {"name":"iceUpdate_"}, {"name":"legacyHangup_"}, {"name":"multiRing_"}, {"name":"offer_"}, {"name":"opaque_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$CallMessage$Answer", - "fields":[{"name":"bitField0_"}, {"name":"id_"}, {"name":"opaque_"}, {"name":"sdp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$CallMessage$Hangup", - "fields":[{"name":"bitField0_"}, {"name":"deviceId_"}, {"name":"id_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$CallMessage$IceUpdate", - "fields":[{"name":"bitField0_"}, {"name":"id_"}, {"name":"line_"}, {"name":"mid_"}, {"name":"opaque_"}, {"name":"sdp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$CallMessage$Offer", - "fields":[{"name":"bitField0_"}, {"name":"id_"}, {"name":"opaque_"}, {"name":"sdp_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$CallMessage$Opaque", - "fields":[{"name":"bitField0_"}, {"name":"data_"}, {"name":"urgency_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$ContactDetails", - "fields":[{"name":"aci_"}, {"name":"archived_"}, {"name":"avatar_"}, {"name":"bitField0_"}, {"name":"blocked_"}, {"name":"color_"}, {"name":"expireTimer_"}, {"name":"inboxPosition_"}, {"name":"name_"}, {"name":"number_"}, {"name":"profileKey_"}, {"name":"verified_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$ContactDetails$Avatar", - "fields":[{"name":"bitField0_"}, {"name":"contentType_"}, {"name":"length_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$Content", - "fields":[{"name":"bitField0_"}, {"name":"callMessage_"}, {"name":"dataMessage_"}, {"name":"decryptionErrorMessage_"}, {"name":"editMessage_"}, {"name":"nullMessage_"}, {"name":"pniSignatureMessage_"}, {"name":"receiptMessage_"}, {"name":"senderKeyDistributionMessage_"}, {"name":"storyMessage_"}, {"name":"syncMessage_"}, {"name":"typingMessage_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage", - "fields":[{"name":"attachments_"}, {"name":"bitField0_"}, {"name":"bodyRanges_"}, {"name":"body_"}, {"name":"contact_"}, {"name":"delete_"}, {"name":"expireTimer_"}, {"name":"flags_"}, {"name":"giftBadge_"}, {"name":"groupCallUpdate_"}, {"name":"groupV2_"}, {"name":"group_"}, {"name":"isViewOnce_"}, {"name":"payment_"}, {"name":"preview_"}, {"name":"profileKey_"}, {"name":"quote_"}, {"name":"reaction_"}, {"name":"requiredProtocolVersion_"}, {"name":"sticker_"}, {"name":"storyContext_"}, {"name":"timestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Contact", - "fields":[{"name":"address_"}, {"name":"avatar_"}, {"name":"bitField0_"}, {"name":"email_"}, {"name":"name_"}, {"name":"number_"}, {"name":"organization_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Contact$Avatar", - "fields":[{"name":"avatar_"}, {"name":"bitField0_"}, {"name":"isProfile_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Contact$Email", - "fields":[{"name":"bitField0_"}, {"name":"label_"}, {"name":"type_"}, {"name":"value_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Contact$Name", - "fields":[{"name":"bitField0_"}, {"name":"displayName_"}, {"name":"familyName_"}, {"name":"givenName_"}, {"name":"middleName_"}, {"name":"prefix_"}, {"name":"suffix_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Contact$Phone", - "fields":[{"name":"bitField0_"}, {"name":"label_"}, {"name":"type_"}, {"name":"value_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Contact$PostalAddress", - "fields":[{"name":"bitField0_"}, {"name":"city_"}, {"name":"country_"}, {"name":"label_"}, {"name":"neighborhood_"}, {"name":"pobox_"}, {"name":"postcode_"}, {"name":"region_"}, {"name":"street_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Delete", - "fields":[{"name":"bitField0_"}, {"name":"targetSentTimestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$GroupCallUpdate", - "fields":[{"name":"bitField0_"}, {"name":"eraId_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Payment", - "fields":[{"name":"itemCase_"}, {"name":"item_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Payment$Notification", - "fields":[{"name":"bitField0_"}, {"name":"note_"}, {"name":"transactionCase_"}, {"name":"transaction_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Payment$Notification$MobileCoin", - "fields":[{"name":"bitField0_"}, {"name":"receipt_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Quote", - "fields":[{"name":"attachments_"}, {"name":"authorAci_"}, {"name":"bitField0_"}, {"name":"bodyRanges_"}, {"name":"id_"}, {"name":"text_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Quote$QuotedAttachment", - "fields":[{"name":"bitField0_"}, {"name":"contentType_"}, {"name":"fileName_"}, {"name":"thumbnail_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Reaction", - "fields":[{"name":"bitField0_"}, {"name":"emoji_"}, {"name":"remove_"}, {"name":"targetAuthorAci_"}, {"name":"targetSentTimestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$Sticker", - "fields":[{"name":"bitField0_"}, {"name":"data_"}, {"name":"emoji_"}, {"name":"packId_"}, {"name":"packKey_"}, {"name":"stickerId_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$DataMessage$StoryContext", - "fields":[{"name":"authorAci_"}, {"name":"bitField0_"}, {"name":"sentTimestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$EditMessage", - "fields":[{"name":"bitField0_"}, {"name":"dataMessage_"}, {"name":"targetSentTimestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$Envelope", - "fields":[{"name":"bitField0_"}, {"name":"content_"}, {"name":"destinationServiceId_"}, {"name":"reportingToken_"}, {"name":"serverGuid_"}, {"name":"serverTimestamp_"}, {"name":"sourceDevice_"}, {"name":"sourceServiceId_"}, {"name":"story_"}, {"name":"timestamp_"}, {"name":"type_"}, {"name":"updatedPni_"}, {"name":"urgent_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$GroupContext", - "fields":[{"name":"avatar_"}, {"name":"bitField0_"}, {"name":"id_"}, {"name":"membersE164_"}, {"name":"members_"}, {"name":"name_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$GroupContext$Member", - "fields":[{"name":"bitField0_"}, {"name":"e164_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$GroupContextV2", - "fields":[{"name":"bitField0_"}, {"name":"groupChange_"}, {"name":"masterKey_"}, {"name":"revision_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$GroupDetails", - "fields":[{"name":"active_"}, {"name":"archived_"}, {"name":"avatar_"}, {"name":"bitField0_"}, {"name":"blocked_"}, {"name":"color_"}, {"name":"expireTimer_"}, {"name":"id_"}, {"name":"inboxPosition_"}, {"name":"membersE164_"}, {"name":"members_"}, {"name":"name_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$GroupDetails$Avatar", - "fields":[{"name":"bitField0_"}, {"name":"contentType_"}, {"name":"length_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$GroupDetails$Member", - "fields":[{"name":"bitField0_"}, {"name":"e164_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$NullMessage", - "fields":[{"name":"bitField0_"}, {"name":"padding_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$PaymentAddress", - "fields":[{"name":"addressCase_"}, {"name":"address_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$PaymentAddress$MobileCoinAddress", - "fields":[{"name":"address_"}, {"name":"bitField0_"}, {"name":"signature_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$PniSignatureMessage", - "fields":[{"name":"bitField0_"}, {"name":"pni_"}, {"name":"signature_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$Preview", - "fields":[{"name":"bitField0_"}, {"name":"date_"}, {"name":"description_"}, {"name":"image_"}, {"name":"title_"}, {"name":"url_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$ReceiptMessage", - "fields":[{"name":"bitField0_"}, {"name":"timestamp_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$StoryMessage", - "fields":[{"name":"allowsReplies_"}, {"name":"attachmentCase_"}, {"name":"attachment_"}, {"name":"bitField0_"}, {"name":"bodyRanges_"}, {"name":"group_"}, {"name":"profileKey_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage", - "fields":[{"name":"bitField0_"}, {"name":"blocked_"}, {"name":"callEvent_"}, {"name":"callLinkUpdate_"}, {"name":"callLogEvent_"}, {"name":"configuration_"}, {"name":"contacts_"}, {"name":"fetchLatest_"}, {"name":"groups_"}, {"name":"keys_"}, {"name":"messageRequestResponse_"}, {"name":"outgoingPayment_"}, {"name":"padding_"}, {"name":"pniChangeNumber_"}, {"name":"read_"}, {"name":"request_"}, {"name":"sent_"}, {"name":"stickerPackOperation_"}, {"name":"verified_"}, {"name":"viewOnceOpen_"}, {"name":"viewed_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Blocked", - "fields":[{"name":"acis_"}, {"name":"groupIds_"}, {"name":"numbers_"}, {"name":"uuids_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$CallEvent", - "fields":[{"name":"bitField0_"}, {"name":"conversationId_"}, {"name":"direction_"}, {"name":"event_"}, {"name":"id_"}, {"name":"timestamp_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Configuration", - "fields":[{"name":"bitField0_"}, {"name":"linkPreviews_"}, {"name":"provisioningVersion_"}, {"name":"readReceipts_"}, {"name":"typingIndicators_"}, {"name":"unidentifiedDeliveryIndicators_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Contacts", - "fields":[{"name":"bitField0_"}, {"name":"blob_"}, {"name":"complete_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$FetchLatest", - "fields":[{"name":"bitField0_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Groups", - "fields":[{"name":"bitField0_"}, {"name":"blob_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Keys", - "fields":[{"name":"bitField0_"}, {"name":"storageService_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$MessageRequestResponse", - "fields":[{"name":"bitField0_"}, {"name":"groupId_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$OutgoingPayment", - "fields":[{"name":"bitField0_"}, {"name":"note_"}, {"name":"paymentDetailCase_"}, {"name":"paymentDetail_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$OutgoingPayment$MobileCoin", - "fields":[{"name":"amountPicoMob_"}, {"name":"bitField0_"}, {"name":"feePicoMob_"}, {"name":"ledgerBlockIndex_"}, {"name":"ledgerBlockTimestamp_"}, {"name":"outputPublicKeys_"}, {"name":"receipt_"}, {"name":"recipientAddress_"}, {"name":"spentKeyImages_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Read", - "fields":[{"name":"bitField0_"}, {"name":"senderAci_"}, {"name":"timestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Request", - "fields":[{"name":"bitField0_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Sent", - "fields":[{"name":"bitField0_"}, {"name":"destinationE164_"}, {"name":"destinationServiceId_"}, {"name":"editMessage_"}, {"name":"expirationStartTimestamp_"}, {"name":"isRecipientUpdate_"}, {"name":"message_"}, {"name":"storyMessageRecipients_"}, {"name":"storyMessage_"}, {"name":"timestamp_"}, {"name":"unidentifiedStatus_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Sent$StoryMessageRecipient", - "fields":[{"name":"bitField0_"}, {"name":"destinationServiceId_"}, {"name":"distributionListIds_"}, {"name":"isAllowedToReply_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Sent$UnidentifiedDeliveryStatus", - "fields":[{"name":"bitField0_"}, {"name":"destinationServiceId_"}, {"name":"unidentified_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$StickerPackOperation", - "fields":[{"name":"bitField0_"}, {"name":"packId_"}, {"name":"packKey_"}, {"name":"type_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$ViewOnceOpen", - "fields":[{"name":"bitField0_"}, {"name":"timestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Viewed", - "fields":[{"name":"bitField0_"}, {"name":"senderAci_"}, {"name":"timestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$TextAttachment", - "fields":[{"name":"backgroundCase_"}, {"name":"background_"}, {"name":"bitField0_"}, {"name":"preview_"}, {"name":"textBackgroundColor_"}, {"name":"textForegroundColor_"}, {"name":"textStyle_"}, {"name":"text_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$TextAttachment$Gradient", - "fields":[{"name":"angle_"}, {"name":"bitField0_"}, {"name":"colors_"}, {"name":"endColor_"}, {"name":"positions_"}, {"name":"startColor_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$TypingMessage", - "fields":[{"name":"action_"}, {"name":"bitField0_"}, {"name":"groupId_"}, {"name":"timestamp_"}] -}, -{ - "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$Verified", - "fields":[{"name":"bitField0_"}, {"name":"destinationAci_"}, {"name":"identityKey_"}, {"name":"nullMessage_"}, {"name":"state_"}] -}, { "name":"org.whispersystems.signalservice.internal.push.StaleDevices", "allDeclaredFields":true, diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 8c766a8198..dd765cbacc 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -20,7 +20,6 @@ dependencies { implementation(files(libsignalClientPath)) } implementation(libs.jackson.databind) - implementation(libs.protobuf) implementation(libs.bouncycastle) implementation(libs.slf4j.api) implementation(libs.sqlite) diff --git a/lib/src/main/java/org/asamk/signal/manager/actions/SendRetryMessageRequestAction.java b/lib/src/main/java/org/asamk/signal/manager/actions/SendRetryMessageRequestAction.java index add09e72ef..1975fd1794 100644 --- a/lib/src/main/java/org/asamk/signal/manager/actions/SendRetryMessageRequestAction.java +++ b/lib/src/main/java/org/asamk/signal/manager/actions/SendRetryMessageRequestAction.java @@ -8,7 +8,7 @@ import org.signal.libsignal.protocol.message.DecryptionErrorMessage; import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import org.whispersystems.signalservice.api.push.ServiceId; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.Envelope; import java.util.Optional; @@ -62,10 +62,14 @@ public void execute(Context context) throws Throwable { } private static int envelopeTypeToCiphertextMessageType(int envelopeType) { - return switch (envelopeType) { - case SignalServiceProtos.Envelope.Type.PREKEY_BUNDLE_VALUE -> CiphertextMessage.PREKEY_TYPE; - case SignalServiceProtos.Envelope.Type.UNIDENTIFIED_SENDER_VALUE -> CiphertextMessage.SENDERKEY_TYPE; - case SignalServiceProtos.Envelope.Type.PLAINTEXT_CONTENT_VALUE -> CiphertextMessage.PLAINTEXT_CONTENT_TYPE; + final var type = Envelope.Type.fromValue(envelopeType); + if (type == null) { + return CiphertextMessage.WHISPER_TYPE; + } + return switch (type) { + case PREKEY_BUNDLE -> CiphertextMessage.PREKEY_TYPE; + case UNIDENTIFIED_SENDER -> CiphertextMessage.SENDERKEY_TYPE; + case PLAINTEXT_CONTENT -> CiphertextMessage.PLAINTEXT_CONTENT_TYPE; default -> CiphertextMessage.WHISPER_TYPE; }; } diff --git a/lib/src/main/java/org/asamk/signal/manager/api/GroupInviteLinkUrl.java b/lib/src/main/java/org/asamk/signal/manager/api/GroupInviteLinkUrl.java index b21aeb97c2..d44fc98221 100644 --- a/lib/src/main/java/org/asamk/signal/manager/api/GroupInviteLinkUrl.java +++ b/lib/src/main/java/org/asamk/signal/manager/api/GroupInviteLinkUrl.java @@ -1,7 +1,5 @@ package org.asamk.signal.manager.api; -import com.google.protobuf.ByteString; - import org.asamk.signal.manager.groups.GroupLinkPassword; import org.signal.libsignal.zkgroup.InvalidInputException; import org.signal.libsignal.zkgroup.groups.GroupMasterKey; @@ -13,6 +11,8 @@ import java.net.URI; import java.net.URISyntaxException; +import okio.ByteString; + public final class GroupInviteLinkUrl { private static final String GROUP_URL_HOST = "signal.group"; @@ -24,7 +24,7 @@ public final class GroupInviteLinkUrl { public static GroupInviteLinkUrl forGroup(GroupMasterKey groupMasterKey, DecryptedGroup group) { return new GroupInviteLinkUrl(groupMasterKey, - GroupLinkPassword.fromBytes(group.getInviteLinkPassword().toByteArray())); + GroupLinkPassword.fromBytes(group.inviteLinkPassword.toByteArray())); } /** @@ -50,19 +50,16 @@ public static GroupInviteLinkUrl fromUri(String urlString) throws InvalidGroupLi } var bytes = Base64UrlSafe.decodePaddingAgnostic(encoding); - var groupInviteLink = GroupInviteLink.parseFrom(bytes); - - switch (groupInviteLink.getContentsCase()) { - case V1CONTENTS -> { - var groupInviteLinkContentsV1 = groupInviteLink.getV1Contents(); - var groupMasterKey = new GroupMasterKey(groupInviteLinkContentsV1.getGroupMasterKey() - .toByteArray()); - var password = GroupLinkPassword.fromBytes(groupInviteLinkContentsV1.getInviteLinkPassword() - .toByteArray()); - - return new GroupInviteLinkUrl(groupMasterKey, password); - } - default -> throw new UnknownGroupLinkVersionException("Url contains no known group link content"); + GroupInviteLink groupInviteLink = GroupInviteLink.ADAPTER.decode(bytes); + + if (groupInviteLink.v1Contents != null) { + var groupInviteLinkContentsV1 = groupInviteLink.v1Contents; + var groupMasterKey = new GroupMasterKey(groupInviteLinkContentsV1.groupMasterKey.toByteArray()); + var password = GroupLinkPassword.fromBytes(groupInviteLinkContentsV1.inviteLinkPassword.toByteArray()); + + return new GroupInviteLinkUrl(groupMasterKey, password); + } else { + throw new UnknownGroupLinkVersionException("Url contains no known group link content"); } } catch (InvalidInputException | IOException e) { throw new InvalidGroupLinkException(e); @@ -93,13 +90,12 @@ private GroupInviteLinkUrl(GroupMasterKey groupMasterKey, GroupLinkPassword pass } private static String createUrl(GroupMasterKey groupMasterKey, GroupLinkPassword password) { - var groupInviteLink = GroupInviteLink.newBuilder() - .setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder() - .setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize())) - .setInviteLinkPassword(ByteString.copyFrom(password.serialize()))) - .build(); + var groupInviteLink = new GroupInviteLink.Builder().v1Contents(new GroupInviteLink.GroupInviteLinkContentsV1.Builder().groupMasterKey( + ByteString.of(groupMasterKey.serialize())) + .inviteLinkPassword(ByteString.of(password.serialize())) + .build()).build(); - var encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.toByteArray()); + var encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.encode()); return GROUP_URL_PREFIX + encoding; } diff --git a/lib/src/main/java/org/asamk/signal/manager/api/MessageEnvelope.java b/lib/src/main/java/org/asamk/signal/manager/api/MessageEnvelope.java index 1ba25af62c..00abd93e74 100644 --- a/lib/src/main/java/org/asamk/signal/manager/api/MessageEnvelope.java +++ b/lib/src/main/java/org/asamk/signal/manager/api/MessageEnvelope.java @@ -39,8 +39,6 @@ import java.util.Set; import java.util.stream.Collectors; -import static org.whispersystems.signalservice.internal.push.SignalServiceProtos.BodyRange; - public record MessageEnvelope( Optional sourceAddress, int sourceDevice, @@ -160,7 +158,7 @@ static Data from( .map(a -> a.stream().map(preview -> Preview.from(preview, fileProvider)).toList()) .orElse(List.of()), dataMessage.getBodyRanges() - .map(a -> a.stream().filter(BodyRange::hasStyle).map(TextStyle::from).toList()) + .map(a -> a.stream().filter(r -> r.style != null).map(TextStyle::from).toList()) .orElse(List.of())); } @@ -250,7 +248,7 @@ static Quote from( ? List.of() : quote.getBodyRanges() .stream() - .filter(BodyRange::hasStyle) + .filter(r -> r.style != null) .map(TextStyle::from) .toList()); } @@ -765,13 +763,12 @@ static Busy from(BusyMessage busyMessage) { } } - public record Hangup(long id, Type type, int deviceId, boolean isLegacy) { + public record Hangup(long id, Type type, int deviceId) { static Hangup from(HangupMessage hangupMessage) { return new Hangup(hangupMessage.getId(), Type.from(hangupMessage.getType()), - hangupMessage.getDeviceId(), - hangupMessage.isLegacy()); + hangupMessage.getDeviceId()); } public enum Type { diff --git a/lib/src/main/java/org/asamk/signal/manager/api/TextStyle.java b/lib/src/main/java/org/asamk/signal/manager/api/TextStyle.java index 4831630887..bec504f0f3 100644 --- a/lib/src/main/java/org/asamk/signal/manager/api/TextStyle.java +++ b/lib/src/main/java/org/asamk/signal/manager/api/TextStyle.java @@ -1,8 +1,8 @@ package org.asamk.signal.manager.api; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.BodyRange; -public record TextStyle(Style style, int start, int length) { +public record TextStyle(Style style, Integer start, Integer length) { public enum Style { NONE, @@ -12,7 +12,10 @@ public enum Style { STRIKETHROUGH, MONOSPACE; - static Style fromInternal(SignalServiceProtos.BodyRange.Style style) { + static Style fromInternal(BodyRange.Style style) { + if (style == null) { + return NONE; + } return switch (style) { case NONE -> NONE; case BOLD -> BOLD; @@ -35,27 +38,26 @@ public static Style from(String style) { }; } - SignalServiceProtos.BodyRange.Style toBodyRangeStyle() { + BodyRange.Style toBodyRangeStyle() { return switch (this) { - case NONE -> SignalServiceProtos.BodyRange.Style.NONE; - case BOLD -> SignalServiceProtos.BodyRange.Style.BOLD; - case ITALIC -> SignalServiceProtos.BodyRange.Style.ITALIC; - case SPOILER -> SignalServiceProtos.BodyRange.Style.SPOILER; - case STRIKETHROUGH -> SignalServiceProtos.BodyRange.Style.STRIKETHROUGH; - case MONOSPACE -> SignalServiceProtos.BodyRange.Style.MONOSPACE; + case NONE -> BodyRange.Style.NONE; + case BOLD -> BodyRange.Style.BOLD; + case ITALIC -> BodyRange.Style.ITALIC; + case SPOILER -> BodyRange.Style.SPOILER; + case STRIKETHROUGH -> BodyRange.Style.STRIKETHROUGH; + case MONOSPACE -> BodyRange.Style.MONOSPACE; }; } } - static TextStyle from(SignalServiceProtos.BodyRange bodyRange) { - return new TextStyle(Style.fromInternal(bodyRange.getStyle()), bodyRange.getStart(), bodyRange.getLength()); + static TextStyle from(BodyRange bodyRange) { + return new TextStyle(Style.fromInternal(bodyRange.style), bodyRange.start, bodyRange.length); } - public SignalServiceProtos.BodyRange toBodyRange() { - return SignalServiceProtos.BodyRange.newBuilder() - .setStart(this.start()) - .setLength(this.length()) - .setStyle(this.style().toBodyRangeStyle()) + public BodyRange toBodyRange() { + return new BodyRange.Builder().start(this.start()) + .length(this.length()) + .style(this.style().toBodyRangeStyle()) .build(); } } diff --git a/lib/src/main/java/org/asamk/signal/manager/groups/GroupUtils.java b/lib/src/main/java/org/asamk/signal/manager/groups/GroupUtils.java index b73be0ab0a..76352d1ad9 100644 --- a/lib/src/main/java/org/asamk/signal/manager/groups/GroupUtils.java +++ b/lib/src/main/java/org/asamk/signal/manager/groups/GroupUtils.java @@ -28,7 +28,7 @@ public static void setGroupContext( } else { final var groupInfoV2 = (GroupInfoV2) groupInfo; var group = SignalServiceGroupV2.newBuilder(groupInfoV2.getMasterKey()) - .withRevision(groupInfoV2.getGroup() == null ? 0 : groupInfoV2.getGroup().getRevision()) + .withRevision(groupInfoV2.getGroup() == null ? 0 : groupInfoV2.getGroup().revision) .build(); messageBuilder.asGroupMessage(group); } diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/GroupHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/GroupHelper.java index d30c79e420..ef104fa2fc 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/GroupHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/GroupHelper.java @@ -125,11 +125,11 @@ public GroupInfoV2 getOrMigrateGroup( groupInfoV2 = new GroupInfoV2(groupId, groupMasterKey, account.getRecipientResolver()); } - if (groupInfoV2.getGroup() == null || groupInfoV2.getGroup().getRevision() < revision) { + if (groupInfoV2.getGroup() == null || groupInfoV2.getGroup().revision < revision) { DecryptedGroup group = null; if (signedGroupChange != null && groupInfoV2.getGroup() != null - && groupInfoV2.getGroup().getRevision() + 1 == revision) { + && groupInfoV2.getGroup().revision + 1 == revision) { final var decryptedGroupChange = context.getGroupV2Helper() .getDecryptedGroupChange(signedGroupChange, groupMasterKey); @@ -151,8 +151,8 @@ public GroupInfoV2 getOrMigrateGroup( } if (group != null) { storeProfileKeysFromMembers(group); - final var avatar = group.getAvatar(); - if (avatar != null && !avatar.isEmpty()) { + final var avatar = group.avatar; + if (!avatar.isEmpty()) { downloadGroupAvatar(groupId, groupSecretParams, avatar); } } @@ -300,14 +300,14 @@ public Pair joinGroup( } catch (GroupLinkNotActiveException e) { throw new InactiveGroupLinkException("Group link inactive (reason: " + e.getReason() + ")", e); } - if (groupJoinInfo.getPendingAdminApproval()) { + if (groupJoinInfo.pendingAdminApproval) { throw new PendingAdminApprovalException("You have already requested to join the group."); } final var groupChange = context.getGroupV2Helper() .joinGroup(inviteLinkUrl.getGroupMasterKey(), inviteLinkUrl.getPassword(), groupJoinInfo); final var group = getOrMigrateGroup(inviteLinkUrl.getGroupMasterKey(), - groupJoinInfo.getRevision() + 1, - groupChange.toByteArray()); + groupJoinInfo.revision + 1, + groupChange.encode()); if (group.getGroup() == null) { // Only requested member, can't send update to group members @@ -400,8 +400,8 @@ private GroupInfo getGroup(GroupId groupId, boolean forceUpdate) { } catch (NotAGroupMemberException ignored) { } storeProfileKeysFromMembers(decryptedGroup); - final var avatar = decryptedGroup.getAvatar(); - if (avatar != null && !avatar.isEmpty()) { + final var avatar = decryptedGroup.avatar; + if (!avatar.isEmpty()) { downloadGroupAvatar(groupInfoV2.getGroupId(), groupSecretParams, avatar); } } @@ -446,8 +446,8 @@ private void retrieveGroupV2Avatar( } private void storeProfileKeysFromMembers(final DecryptedGroup group) { - for (var member : group.getMembersList()) { - final var serviceId = ServiceId.parseOrThrow(member.getAciBytes()); + for (var member : group.members) { + final var serviceId = ServiceId.parseOrThrow(member.aciBytes); final var recipientId = account.getRecipientResolver().resolveRecipient(serviceId); final var profileStore = account.getProfileStore(); if (profileStore.getProfileKey(recipientId) != null) { @@ -455,7 +455,7 @@ private void storeProfileKeysFromMembers(final DecryptedGroup group) { continue; } try { - profileStore.storeProfileKey(recipientId, new ProfileKey(member.getProfileKey().toByteArray())); + profileStore.storeProfileKey(recipientId, new ProfileKey(member.profileKey.toByteArray())); } catch (InvalidInputException ignored) { } } @@ -479,7 +479,7 @@ private void storeProfileKeysFromHistory( final DecryptedGroup newDecryptedGroup ) throws NotAGroupMemberException { final var revisionWeWereAdded = context.getGroupV2Helper().findRevisionWeWereAdded(newDecryptedGroup); - final var localRevision = localGroup.getGroup() == null ? 0 : localGroup.getGroup().getRevision(); + final var localRevision = localGroup.getGroup() == null ? 0 : localGroup.getGroup().revision; var fromRevision = Math.max(revisionWeWereAdded, localRevision); final var newProfileKeys = new HashMap(); while (true) { @@ -753,7 +753,7 @@ private SendGroupMessageResults quitGroupV2( groupInfoV2.setGroup(groupGroupChangePair.first()); account.getGroupStore().updateGroup(groupInfoV2); - var messageBuilder = getGroupUpdateMessageBuilder(groupInfoV2, groupGroupChangePair.second().toByteArray()); + var messageBuilder = getGroupUpdateMessageBuilder(groupInfoV2, groupGroupChangePair.second().encode()); return sendGroupMessage(messageBuilder, groupInfoV2.getMembersIncludingPendingWithout(account.getSelfRecipientId()), groupInfoV2.getDistributionId()); @@ -782,7 +782,7 @@ private SignalServiceDataMessage.Builder getGroupUpdateMessageBuilder(GroupInfoV private SignalServiceDataMessage.Builder getGroupUpdateMessageBuilder(GroupInfoV2 g, byte[] signedGroupChange) { var group = SignalServiceGroupV2.newBuilder(g.getMasterKey()) - .withRevision(g.getGroup().getRevision()) + .withRevision(g.getGroup().revision) .withSignedGroupChange(signedGroupChange); return SignalServiceDataMessage.newBuilder() .asGroupMessage(group.build()) @@ -798,7 +798,7 @@ private SendGroupMessageResults sendUpdateGroupV2Message( members.addAll(group.getMembersIncludingPendingWithout(selfRecipientId)); account.getGroupStore().updateGroup(group); - final var messageBuilder = getGroupUpdateMessageBuilder(group, groupChange.toByteArray()); + final var messageBuilder = getGroupUpdateMessageBuilder(group, groupChange.encode()); return sendGroupMessage(messageBuilder, members, group.getDistributionId()); } diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/GroupV2Helper.java b/lib/src/main/java/org/asamk/signal/manager/helper/GroupV2Helper.java index 30de7b19a6..96ecf2c076 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/GroupV2Helper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/GroupV2Helper.java @@ -1,8 +1,5 @@ package org.asamk.signal.manager.helper; -import com.google.protobuf.ByteString; -import com.google.protobuf.InvalidProtocolBufferException; - import org.asamk.signal.manager.api.GroupLinkState; import org.asamk.signal.manager.api.GroupPermission; import org.asamk.signal.manager.api.NotAGroupMemberException; @@ -28,7 +25,6 @@ import org.signal.storageservice.protos.groups.local.DecryptedGroupJoinInfo; import org.signal.storageservice.protos.groups.local.DecryptedMember; import org.signal.storageservice.protos.groups.local.DecryptedPendingMember; -import org.signal.storageservice.protos.groups.local.DecryptedRequestingMember; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.whispersystems.signalservice.api.groupsv2.DecryptedGroupUtil; @@ -59,6 +55,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import okio.ByteString; + class GroupV2Helper { private final static Logger logger = LoggerFactory.getLogger(GroupV2Helper.class); @@ -126,12 +124,12 @@ GroupHistoryPage getDecryptedGroupHistoryPage( int findRevisionWeWereAdded(DecryptedGroup partialDecryptedGroup) { ByteString aciBytes = getSelfAci().toByteString(); ByteString pniBytes = getSelfPni().toByteString(); - for (DecryptedMember decryptedMember : partialDecryptedGroup.getMembersList()) { - if (decryptedMember.getAciBytes().equals(aciBytes) || decryptedMember.getPniBytes().equals(pniBytes)) { - return decryptedMember.getJoinedAtRevision(); + for (DecryptedMember decryptedMember : partialDecryptedGroup.members) { + if (decryptedMember.aciBytes.equals(aciBytes) || decryptedMember.pniBytes.equals(pniBytes)) { + return decryptedMember.joinedAtRevision; } } - return partialDecryptedGroup.getRevision(); + return partialDecryptedGroup.revision; } Pair createGroup( @@ -203,19 +201,19 @@ Pair updateGroup( final var groupSecretParams = GroupSecretParams.deriveFromMasterKey(groupInfoV2.getMasterKey()); var groupOperations = dependencies.getGroupsV2Operations().forGroup(groupSecretParams); - var change = name != null ? groupOperations.createModifyGroupTitle(name) : GroupChange.Actions.newBuilder(); + var change = name != null ? groupOperations.createModifyGroupTitle(name) : new GroupChange.Actions.Builder(); if (description != null) { - change.setModifyDescription(groupOperations.createModifyGroupDescriptionAction(description)); + change.modifyDescription(groupOperations.createModifyGroupDescriptionAction(description).build()); } if (avatarFile != null) { var avatarCdnKey = dependencies.getGroupsV2Api() .uploadAvatar(avatarFile, groupSecretParams, getGroupAuthForToday(groupSecretParams)); - change.setModifyAvatar(GroupChange.Actions.ModifyAvatarAction.newBuilder().setAvatar(avatarCdnKey)); + change.modifyAvatar(new GroupChange.Actions.ModifyAvatarAction.Builder().avatar(avatarCdnKey).build()); } - change.setSourceServiceId(getSelfAci().toByteString()); + change.sourceServiceId(getSelfAci().toByteString()); return commitChange(groupInfoV2, change); } @@ -241,7 +239,7 @@ Pair addMembers( final var aci = getSelfAci(); final var change = groupOperations.createModifyGroupMembershipChange(candidates, bannedUuids, aci); - change.setSourceServiceId(getSelfAci().toByteString()); + change.sourceServiceId(getSelfAci().toByteString()); return commitChange(groupInfoV2, change); } @@ -249,7 +247,7 @@ Pair addMembers( Pair leaveGroup( GroupInfoV2 groupInfoV2, Set membersToMakeAdmin ) throws IOException { - var pendingMembersList = groupInfoV2.getGroup().getPendingMembersList(); + var pendingMembersList = groupInfoV2.getGroup().pendingMembers; final var selfAci = getSelfAci(); var selfPendingMember = DecryptedGroupUtil.findPendingByServiceId(pendingMembersList, selfAci); @@ -302,7 +300,7 @@ Pair refuseJoinRequestMembers( Pair revokeInvitedMembers( GroupInfoV2 groupInfoV2, Set members ) throws IOException { - var pendingMembersList = groupInfoV2.getGroup().getPendingMembersList(); + var pendingMembersList = groupInfoV2.getGroup().pendingMembers; final var memberUuids = members.stream() .map(context.getRecipientHelper()::resolveSignalServiceAddress) .map(SignalServiceAddress::getServiceId) @@ -324,9 +322,9 @@ Pair banMembers( final var change = groupOperations.createBanServiceIdsChange(serviceIds, false, - groupInfoV2.getGroup().getBannedMembersList()); + groupInfoV2.getGroup().bannedMembers); - change.setSourceServiceId(getSelfAci().toByteString()); + change.sourceServiceId(getSelfAci().toByteString()); return commitChange(groupInfoV2, change); } @@ -342,7 +340,7 @@ Pair unbanMembers( final var change = groupOperations.createUnbanServiceIdsChange(serviceIds); - change.setSourceServiceId(getSelfAci().toByteString()); + change.sourceServiceId(getSelfAci().toByteString()); return commitChange(groupInfoV2, change); } @@ -360,9 +358,8 @@ Pair setGroupLinkState( final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2); final var accessRequired = toAccessControl(state); - final var requiresNewPassword = state != GroupLinkState.DISABLED && groupInfoV2.getGroup() - .getInviteLinkPassword() - .isEmpty(); + final var requiresNewPassword = state != GroupLinkState.DISABLED + && groupInfoV2.getGroup().inviteLinkPassword.toByteArray().length == 0; final var change = requiresNewPassword ? groupOperations.createModifyGroupLinkPasswordAndRightsChange( GroupLinkPassword.createNew().serialize(), @@ -393,14 +390,14 @@ Pair setAddMemberPermission( Pair updateSelfProfileKey(GroupInfoV2 groupInfoV2) throws IOException { Optional selfInGroup = groupInfoV2.getGroup() == null ? Optional.empty() - : DecryptedGroupUtil.findMemberByAci(groupInfoV2.getGroup().getMembersList(), getSelfAci()); + : DecryptedGroupUtil.findMemberByAci(groupInfoV2.getGroup().members, getSelfAci()); if (selfInGroup.isEmpty()) { logger.trace("Not updating group, self not in group " + groupInfoV2.getGroupId().toBase64()); return null; } final var profileKey = context.getAccount().getProfileKey(); - if (Arrays.equals(profileKey.serialize(), selfInGroup.get().getProfileKey().toByteArray())) { + if (Arrays.equals(profileKey.serialize(), selfInGroup.get().profileKey.toByteArray())) { logger.trace("Not updating group, own Profile Key is already up to date in group " + groupInfoV2.getGroupId().toBase64()); return null; @@ -416,7 +413,7 @@ Pair updateSelfProfileKey(GroupInfoV2 groupInfoV2) final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2); final var change = groupOperations.createUpdateProfileKeyCredentialChange(profileKeyCredential); - change.setSourceServiceId(getSelfAci().toByteString()); + change.sourceServiceId(getSelfAci().toByteString()); return commitChange(groupInfoV2, change); } @@ -434,17 +431,17 @@ GroupChange joinGroup( throw new IOException("Cannot join a V2 group as self does not have a versioned profile"); } - var requestToJoin = decryptedGroupJoinInfo.getAddFromInviteLink() == AccessControl.AccessRequired.ADMINISTRATOR; + var requestToJoin = decryptedGroupJoinInfo.addFromInviteLink == AccessControl.AccessRequired.ADMINISTRATOR; var change = requestToJoin ? groupOperations.createGroupJoinRequest(profileKeyCredential) : groupOperations.createGroupJoinDirect(profileKeyCredential); - change.setSourceServiceId(context.getRecipientHelper() + change.sourceServiceId(context.getRecipientHelper() .resolveSignalServiceAddress(selfRecipientId) .getServiceId() .toByteString()); - return commitChange(groupSecretParams, decryptedGroupJoinInfo.getRevision(), change, groupLinkPassword); + return commitChange(groupSecretParams, decryptedGroupJoinInfo.revision, change, groupLinkPassword); } Pair acceptInvite(GroupInfoV2 groupInfoV2) throws IOException { @@ -459,7 +456,7 @@ Pair acceptInvite(GroupInfoV2 groupInfoV2) throws I final var change = groupOperations.createAcceptInviteChange(profileKeyCredential); final var aci = context.getRecipientHelper().resolveSignalServiceAddress(selfRecipientId).getServiceId(); - change.setSourceServiceId(aci.toByteString()); + change.sourceServiceId(aci.toByteString()); return commitChange(groupInfoV2, change); } @@ -520,7 +517,7 @@ private Pair revokeInvites( final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2); final var uuidCipherTexts = pendingMembers.stream().map(member -> { try { - return new UuidCiphertext(member.getServiceIdCipherText().toByteArray()); + return new UuidCiphertext(member.serviceIdCipherText.toByteArray()); } catch (InvalidInputException e) { throw new AssertionError(e); } @@ -555,8 +552,8 @@ private Pair commitChange( final var groupSecretParams = GroupSecretParams.deriveFromMasterKey(groupInfoV2.getMasterKey()); final var groupOperations = dependencies.getGroupsV2Operations().forGroup(groupSecretParams); final var previousGroupState = groupInfoV2.getGroup(); - final var nextRevision = previousGroupState.getRevision() + 1; - final var changeActions = change.setRevision(nextRevision).build(); + final var nextRevision = previousGroupState.revision + 1; + final var changeActions = change.revision(nextRevision).build(); final DecryptedGroupChange decryptedChange; final DecryptedGroup decryptedGroupState; @@ -580,7 +577,7 @@ private GroupChange commitChange( GroupLinkPassword password ) throws IOException { final var nextRevision = currentRevision + 1; - final var changeActions = change.setRevision(nextRevision).build(); + final var changeActions = change.revision(nextRevision).build(); return dependencies.getGroupsV2Api() .patchGroup(changeActions, @@ -589,17 +586,16 @@ private GroupChange commitChange( } Pair getAuthoritativeProfileKeyFromChange(final DecryptedGroupChange change) { - UUID editor = UuidUtil.fromByteStringOrNull(change.getEditorServiceIdBytes()); - final var editorProfileKeyBytes = Stream.concat(Stream.of(change.getNewMembersList().stream(), - change.getPromotePendingMembersList().stream(), - change.getModifiedProfileKeysList().stream()) + UUID editor = UuidUtil.fromByteStringOrNull(change.editorServiceIdBytes); + final var editorProfileKeyBytes = Stream.concat(Stream.of(change.newMembers.stream(), + change.promotePendingMembers.stream(), + change.modifiedProfileKeys.stream()) .flatMap(Function.identity()) - .filter(m -> UuidUtil.fromByteString(m.getAciBytes()).equals(editor)) - .map(DecryptedMember::getProfileKey), - change.getNewRequestingMembersList() - .stream() - .filter(m -> UuidUtil.fromByteString(m.getAciBytes()).equals(editor)) - .map(DecryptedRequestingMember::getProfileKey)).findFirst(); + .filter(m -> UuidUtil.fromByteString(m.aciBytes).equals(editor)) + .map(m -> m.profileKey), + change.newRequestingMembers.stream() + .filter(m -> UuidUtil.fromByteString(m.aciBytes).equals(editor)) + .map(m -> m.profileKey)).findFirst(); if (editorProfileKeyBytes.isEmpty()) { return null; @@ -630,8 +626,8 @@ DecryptedGroupChange getDecryptedGroupChange(byte[] signedGroupChange, GroupMast .forGroup(GroupSecretParams.deriveFromMasterKey(groupMasterKey)); try { - return groupOperations.decryptChange(GroupChange.parseFrom(signedGroupChange), true).orElse(null); - } catch (VerificationFailedException | InvalidGroupStateException | InvalidProtocolBufferException e) { + return groupOperations.decryptChange(GroupChange.ADAPTER.decode(signedGroupChange), true).orElse(null); + } catch (VerificationFailedException | InvalidGroupStateException | IOException e) { return null; } } diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/IncomingMessageHandler.java b/lib/src/main/java/org/asamk/signal/manager/helper/IncomingMessageHandler.java index cad112b520..aa4bdba3a4 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/IncomingMessageHandler.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/IncomingMessageHandler.java @@ -70,11 +70,8 @@ import org.whispersystems.signalservice.api.push.ServiceId.ACI; import org.whispersystems.signalservice.api.push.ServiceId.PNI; import org.whispersystems.signalservice.api.push.SignalServiceAddress; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.Envelope; import org.whispersystems.signalservice.internal.push.UnsupportedDataMessageException; -import org.whispersystems.signalservice.internal.serialize.SignalServiceAddressProtobufSerializer; -import org.whispersystems.signalservice.internal.serialize.SignalServiceMetadataProtobufSerializer; -import org.whispersystems.signalservice.internal.serialize.protos.SignalServiceContentProto; import java.util.ArrayList; import java.util.List; @@ -213,7 +210,7 @@ public Pair, Exception> handleEnvelope( } private SignalServiceContent validate( - SignalServiceProtos.Envelope envelope, SignalServiceCipherResult cipherResult, long serverDeliveredTimestamp + Envelope envelope, SignalServiceCipherResult cipherResult, long serverDeliveredTimestamp ) throws ProtocolInvalidKeyException, ProtocolInvalidMessageException, UnsupportedDataMessageException, InvalidMessageStructureException { final var content = cipherResult.getContent(); final var envelopeMetadata = cipherResult.getMetadata(); @@ -236,21 +233,15 @@ private SignalServiceContent validate( final var metadata = new SignalServiceMetadata(new SignalServiceAddress(envelopeMetadata.getSourceServiceId(), Optional.ofNullable(envelopeMetadata.getSourceE164())), envelopeMetadata.getSourceDeviceId(), - envelope.getTimestamp(), - envelope.getServerTimestamp(), + envelope.timestamp, + envelope.serverTimestamp, serverDeliveredTimestamp, envelopeMetadata.getSealedSender(), - envelope.getServerGuid(), + envelope.serverGuid, Optional.ofNullable(envelopeMetadata.getGroupId()), envelopeMetadata.getDestinationServiceId().toString()); - final var contentProto = SignalServiceContentProto.newBuilder() - .setLocalAddress(SignalServiceAddressProtobufSerializer.toProtobuf(localAddress)) - .setMetadata(SignalServiceMetadataProtobufSerializer.toProtobuf(metadata)) - .setContent(content) - .build(); - - return SignalServiceContent.createFromProto(contentProto); + return SignalServiceContent.createFrom(localAddress, metadata, content); } private List checkAndHandleMessage( @@ -635,23 +626,21 @@ private List handleSyncMessage( if (syncMessage.getPniChangeNumber().isPresent()) { final var pniChangeNumber = syncMessage.getPniChangeNumber().get(); logger.debug("Received PNI change number sync message, applying."); - if (pniChangeNumber.hasIdentityKeyPair() - && pniChangeNumber.hasRegistrationId() - && pniChangeNumber.hasSignedPreKey() + if (pniChangeNumber.identityKeyPair != null + && pniChangeNumber.registrationId != null + && pniChangeNumber.signedPreKey != null && !envelope.getUpdatedPni().isEmpty()) { logger.debug("New PNI: {}", envelope.getUpdatedPni()); try { final var updatedPni = PNI.parseOrThrow(envelope.getUpdatedPni()); context.getAccountHelper() .setPni(updatedPni, - new IdentityKeyPair(pniChangeNumber.getIdentityKeyPair().toByteArray()), - pniChangeNumber.hasNewE164() ? pniChangeNumber.getNewE164() : null, - pniChangeNumber.getRegistrationId(), - new SignedPreKeyRecord(pniChangeNumber.getSignedPreKey().toByteArray()), - pniChangeNumber.hasLastResortKyberPreKey() - ? new KyberPreKeyRecord(pniChangeNumber.getLastResortKyberPreKey() - .toByteArray()) - : null); + new IdentityKeyPair(pniChangeNumber.identityKeyPair.toByteArray()), + pniChangeNumber.newE164, + pniChangeNumber.registrationId, + new SignedPreKeyRecord(pniChangeNumber.signedPreKey.toByteArray()), + pniChangeNumber.lastResortKyberPreKey != null ? new KyberPreKeyRecord( + pniChangeNumber.lastResortKyberPreKey.toByteArray()) : null); } catch (Exception e) { logger.warn("Failed to handle change number message", e); } diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java index 8cd37aa9c2..51c1e9ca76 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java @@ -1,7 +1,5 @@ package org.asamk.signal.manager.helper; -import com.google.protobuf.ByteString; - import org.asamk.signal.manager.api.Contact; import org.asamk.signal.manager.api.GroupId; import org.asamk.signal.manager.api.GroupNotFoundException; @@ -54,6 +52,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import okio.ByteString; + public class SendHelper { private final static Logger logger = LoggerFactory.getLogger(SendHelper.class); @@ -267,10 +267,10 @@ public SendMessageResult resendMessage( final var senderKeyDistributionMessage = dependencies.getMessageSender() .getOrCreateNewGroupSession(group.getDistributionId()); - final var distributionBytes = ByteString.copyFrom(senderKeyDistributionMessage.serialize()); + final var distributionBytes = ByteString.of(senderKeyDistributionMessage.serialize()); final var contentToSend = messageSendLogEntry.content() - .toBuilder() - .setSenderKeyDistributionMessage(distributionBytes) + .newBuilder() + .senderKeyDistributionMessage(distributionBytes) .build(); final var result = handleSendMessage(recipientId, diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/SyncHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/SyncHelper.java index 47923051a3..41ae761a57 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/SyncHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/SyncHelper.java @@ -31,7 +31,7 @@ import org.whispersystems.signalservice.api.messages.multidevice.StickerPackOperationMessage; import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage; import org.whispersystems.signalservice.api.push.SignalServiceAddress; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.SyncMessage; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -58,20 +58,20 @@ public SyncHelper(final Context context) { } public void requestAllSyncData() { - requestSyncData(SignalServiceProtos.SyncMessage.Request.Type.GROUPS); - requestSyncData(SignalServiceProtos.SyncMessage.Request.Type.CONTACTS); - requestSyncData(SignalServiceProtos.SyncMessage.Request.Type.BLOCKED); - requestSyncData(SignalServiceProtos.SyncMessage.Request.Type.CONFIGURATION); + requestSyncData(SyncMessage.Request.Type.GROUPS); + requestSyncData(SyncMessage.Request.Type.CONTACTS); + requestSyncData(SyncMessage.Request.Type.BLOCKED); + requestSyncData(SyncMessage.Request.Type.CONFIGURATION); requestSyncKeys(); requestSyncPniIdentity(); } public void requestSyncKeys() { - requestSyncData(SignalServiceProtos.SyncMessage.Request.Type.KEYS); + requestSyncData(SyncMessage.Request.Type.KEYS); } public void requestSyncPniIdentity() { - requestSyncData(SignalServiceProtos.SyncMessage.Request.Type.PNI_IDENTITY); + requestSyncData(SyncMessage.Request.Type.PNI_IDENTITY); } public void sendSyncFetchProfileMessage() { @@ -346,8 +346,8 @@ public void handleSyncDeviceContacts(final InputStream input) throws IOException } } - private void requestSyncData(final SignalServiceProtos.SyncMessage.Request.Type type) { - var r = SignalServiceProtos.SyncMessage.Request.newBuilder().setType(type).build(); + private void requestSyncData(final SyncMessage.Request.Type type) { + var r = new SyncMessage.Request.Builder().type(type).build(); var message = SignalServiceSyncMessage.forRequest(new RequestMessage(r)); context.getSendHelper().sendSyncMessage(message); } diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupInfoV2.java b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupInfoV2.java index 6a8de5924e..c263aa9bcf 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupInfoV2.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupInfoV2.java @@ -21,7 +21,7 @@ public final class GroupInfoV2 extends GroupInfo { private final GroupIdV2 groupId; private final GroupMasterKey masterKey; - private DistributionId distributionId; + private final DistributionId distributionId; private boolean blocked; private DecryptedGroup group; private boolean permissionDenied; @@ -84,7 +84,7 @@ public String getTitle() { if (this.group == null) { return null; } - return this.group.getTitle(); + return this.group.title; } @Override @@ -92,15 +92,15 @@ public String getDescription() { if (this.group == null) { return null; } - return this.group.getDescription(); + return this.group.description; } @Override public GroupInviteLinkUrl getGroupInviteLink() { - if (this.group == null || this.group.getInviteLinkPassword().isEmpty() || ( - this.group.getAccessControl().getAddFromInviteLink() != AccessControl.AccessRequired.ANY - && this.group.getAccessControl().getAddFromInviteLink() - != AccessControl.AccessRequired.ADMINISTRATOR + if (this.group == null || this.group.inviteLinkPassword.toByteArray().length == 0 || ( + this.group.accessControl != null + && this.group.accessControl.addFromInviteLink != AccessControl.AccessRequired.ANY + && this.group.accessControl.addFromInviteLink != AccessControl.AccessRequired.ADMINISTRATOR )) { return null; } @@ -113,9 +113,8 @@ public Set getMembers() { if (this.group == null) { return Set.of(); } - return group.getMembersList() - .stream() - .map(m -> ServiceId.parseOrThrow(m.getAciBytes())) + return group.members.stream() + .map(m -> ServiceId.parseOrThrow(m.aciBytes)) .map(recipientResolver::resolveRecipient) .collect(Collectors.toSet()); } @@ -125,9 +124,8 @@ public Set getBannedMembers() { if (this.group == null) { return Set.of(); } - return group.getBannedMembersList() - .stream() - .map(m -> ServiceId.parseOrThrow(m.getServiceIdBytes())) + return group.bannedMembers.stream() + .map(m -> ServiceId.parseOrThrow(m.serviceIdBytes)) .map(recipientResolver::resolveRecipient) .collect(Collectors.toSet()); } @@ -137,9 +135,8 @@ public Set getPendingMembers() { if (this.group == null) { return Set.of(); } - return group.getPendingMembersList() - .stream() - .map(m -> ServiceId.parseOrThrow(m.getServiceIdBytes())) + return group.pendingMembers.stream() + .map(m -> ServiceId.parseOrThrow(m.serviceIdBytes)) .map(recipientResolver::resolveRecipient) .collect(Collectors.toSet()); } @@ -149,9 +146,8 @@ public Set getRequestingMembers() { if (this.group == null) { return Set.of(); } - return group.getRequestingMembersList() - .stream() - .map(m -> ServiceId.parseOrThrow(m.getAciBytes())) + return group.requestingMembers.stream() + .map(m -> ServiceId.parseOrThrow(m.aciBytes)) .map(recipientResolver::resolveRecipient) .collect(Collectors.toSet()); } @@ -161,11 +157,10 @@ public Set getAdminMembers() { if (this.group == null) { return Set.of(); } - return group.getMembersList() - .stream() - .filter(m -> m.getRole() == Member.Role.ADMINISTRATOR) - .map(m -> new RecipientAddress(ServiceId.ACI.parseOrNull(m.getAciBytes()), - ServiceId.PNI.parseOrNull(m.getPniBytes()), + return group.members.stream() + .filter(m -> m.role == Member.Role.ADMINISTRATOR) + .map(m -> new RecipientAddress(ServiceId.ACI.parseOrNull(m.aciBytes), + ServiceId.PNI.parseOrNull(m.pniBytes), null)) .map(recipientResolver::resolveRecipient) .collect(Collectors.toSet()); @@ -183,26 +178,26 @@ public void setBlocked(final boolean blocked) { @Override public int getMessageExpirationTimer() { - return this.group != null && this.group.hasDisappearingMessagesTimer() - ? this.group.getDisappearingMessagesTimer().getDuration() + return this.group != null && this.group.disappearingMessagesTimer != null + ? this.group.disappearingMessagesTimer.duration : 0; } @Override public boolean isAnnouncementGroup() { - return this.group != null && this.group.getIsAnnouncementGroup() == EnabledState.ENABLED; + return this.group != null && this.group.isAnnouncementGroup == EnabledState.ENABLED; } @Override public GroupPermission getPermissionAddMember() { final var accessControl = getAccessControl(); - return accessControl == null ? GroupPermission.EVERY_MEMBER : toGroupPermission(accessControl.getMembers()); + return accessControl == null ? GroupPermission.EVERY_MEMBER : toGroupPermission(accessControl.members); } @Override public GroupPermission getPermissionEditDetails() { final var accessControl = getAccessControl(); - return accessControl == null ? GroupPermission.EVERY_MEMBER : toGroupPermission(accessControl.getAttributes()); + return accessControl == null ? GroupPermission.EVERY_MEMBER : toGroupPermission(accessControl.attributes); } @Override @@ -219,11 +214,11 @@ public boolean isPermissionDenied() { } private AccessControl getAccessControl() { - if (this.group == null || !this.group.hasAccessControl()) { + if (this.group == null || this.group.accessControl == null) { return null; } - return this.group.getAccessControl(); + return this.group.accessControl; } private static GroupPermission toGroupPermission(final AccessControl.AccessRequired permission) { diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java index af5ada26d8..71fa0f9d44 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java @@ -1,7 +1,5 @@ package org.asamk.signal.manager.storage.groups; -import com.google.protobuf.InvalidProtocolBufferException; - import org.asamk.signal.manager.api.GroupId; import org.asamk.signal.manager.api.GroupIdV1; import org.asamk.signal.manager.api.GroupIdV2; @@ -19,6 +17,7 @@ import org.whispersystems.signalservice.api.push.DistributionId; import org.whispersystems.signalservice.api.util.UuidUtil; +import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; @@ -295,7 +294,7 @@ private void insertOrReplaceGroup( if (groupV2.getGroup() == null) { statement.setNull(4, Types.NUMERIC); } else { - statement.setBytes(4, groupV2.getGroup().toByteArray()); + statement.setBytes(4, groupV2.getGroup().encode()); } statement.setBytes(5, UuidUtil.toByteArray(groupV2.getDistributionId().asUuid())); statement.setBoolean(6, groupV2.isBlocked()); @@ -349,12 +348,12 @@ private GroupInfoV2 getGroupInfoV2FromResultSet(ResultSet resultSet) throws SQLE final var permissionDenied = resultSet.getBoolean("permission_denied"); return new GroupInfoV2(GroupId.v2(groupId), new GroupMasterKey(masterKey), - groupData == null ? null : DecryptedGroup.parseFrom(groupData), + groupData == null ? null : DecryptedGroup.ADAPTER.decode(groupData), DistributionId.from(UuidUtil.parseOrThrow(distributionId)), blocked, permissionDenied, recipientResolver); - } catch (InvalidInputException | InvalidProtocolBufferException e) { + } catch (InvalidInputException | IOException e) { return null; } } diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/groups/LegacyGroupStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/groups/LegacyGroupStore.java index f004ae6988..b53b14c0ae 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/groups/LegacyGroupStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/groups/LegacyGroupStore.java @@ -113,7 +113,7 @@ private static DecryptedGroup loadDecryptedGroupLocked(final GroupIdV2 groupIdV2 return null; } try (var stream = new FileInputStream(groupFile)) { - return DecryptedGroup.parseFrom(stream); + return DecryptedGroup.ADAPTER.decode(stream); } catch (IOException ignored) { return null; } diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogEntry.java b/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogEntry.java index c7f3739649..b8d951c120 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogEntry.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogEntry.java @@ -2,10 +2,10 @@ import org.asamk.signal.manager.api.GroupId; import org.whispersystems.signalservice.api.crypto.ContentHint; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.Content; import java.util.Optional; public record MessageSendLogEntry( - Optional groupId, SignalServiceProtos.Content content, ContentHint contentHint, boolean urgent + Optional groupId, Content content, ContentHint contentHint, boolean urgent ) {} diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogStore.java index 08b2393370..751f345bed 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/sendLog/MessageSendLogStore.java @@ -11,7 +11,7 @@ import org.whispersystems.signalservice.api.crypto.ContentHint; import org.whispersystems.signalservice.api.messages.SendMessageResult; import org.whispersystems.signalservice.api.push.ServiceId; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.Content; import java.io.IOException; import java.sql.Connection; @@ -267,7 +267,7 @@ private RecipientDevices getRecipientDevices(final SendMessageResult sendMessage private long insert( final List recipientDevices, final long sentTimestamp, - final SignalServiceProtos.Content content, + final Content content, final ContentHint contentHint, final boolean urgent ) { @@ -284,7 +284,7 @@ private long insert( try (final var statement = connection.prepareStatement(sql)) { statement.setLong(1, sentTimestamp); statement.setBytes(2, groupId); - statement.setBytes(3, content.toByteArray()); + statement.setBytes(3, content.encode()); statement.setInt(4, contentHint.getType()); statement.setBoolean(5, urgent); final var generatedKey = Utils.executeQueryForOptional(statement, Utils::getIdMapper); @@ -308,17 +308,15 @@ private long insert( } } - private byte[] getGroupId(final SignalServiceProtos.Content content) { + private byte[] getGroupId(final Content content) { try { - return !content.hasDataMessage() + return content.dataMessage == null ? null - : content.getDataMessage().hasGroup() - ? content.getDataMessage().getGroup().getId().toByteArray() - : content.getDataMessage().hasGroupV2() - ? GroupUtils.getGroupIdV2(new GroupMasterKey(content.getDataMessage() - .getGroupV2() - .getMasterKey() - .toByteArray())).serialize() + : content.dataMessage.group != null && content.dataMessage.group.id != null + ? content.dataMessage.group.id.toByteArray() + : content.dataMessage.groupV2 != null && content.dataMessage.groupV2.masterKey != null + ? GroupUtils.getGroupIdV2(new GroupMasterKey(content.dataMessage.groupV2.masterKey.toByteArray())) + .serialize() : null; } catch (InvalidInputException e) { logger.warn("Failed to parse groupId id from content"); @@ -385,9 +383,9 @@ WHERE _id NOT IN (SELECT content_id FROM %s) private MessageSendLogEntry getMessageSendLogEntryFromResultSet(ResultSet resultSet) throws SQLException { final var groupId = Optional.ofNullable(resultSet.getBytes("group_id")).map(GroupId::unknownVersion); - final SignalServiceProtos.Content content; + final Content content; try { - content = SignalServiceProtos.Content.parseFrom(resultSet.getBinaryStream("content")); + content = Content.ADAPTER.decode(resultSet.getBinaryStream("content")); } catch (IOException e) { logger.warn("Failed to parse content from message send log", e); return null; diff --git a/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java b/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java index a7682682bc..b1568bdc21 100644 --- a/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java +++ b/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java @@ -6,7 +6,7 @@ import org.whispersystems.signalservice.api.push.ServiceId; import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.util.UuidUtil; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.Envelope; import java.io.DataInputStream; import java.io.DataOutputStream; @@ -34,7 +34,7 @@ public static SignalServiceEnvelope loadEnvelope(File file) throws IOException { } if (version >= 9) { final var serverReceivedTimestamp = in.readLong(); - final var envelope = SignalServiceProtos.Envelope.parseFrom(in.readAllBytes()); + final var envelope = Envelope.ADAPTER.decode(in.readAllBytes()); return new SignalServiceEnvelope(envelope, serverReceivedTimestamp); } else { var type = in.readInt(); @@ -114,7 +114,7 @@ public static void storeEnvelope(SignalServiceEnvelope envelope, File file) thro try (var out = new DataOutputStream(f)) { out.writeInt(CURRENT_VERSION); // version out.writeLong(envelope.getServerDeliveredTimestamp()); - envelope.getProto().writeTo(out); + envelope.getProto().encode(out); } } } diff --git a/lib/src/main/java/org/asamk/signal/manager/util/PaymentUtils.java b/lib/src/main/java/org/asamk/signal/manager/util/PaymentUtils.java index 1471d8fed0..ca55008c93 100644 --- a/lib/src/main/java/org/asamk/signal/manager/util/PaymentUtils.java +++ b/lib/src/main/java/org/asamk/signal/manager/util/PaymentUtils.java @@ -1,14 +1,14 @@ package org.asamk.signal.manager.util; -import com.google.protobuf.ByteString; - import org.signal.libsignal.protocol.IdentityKey; import org.signal.libsignal.protocol.IdentityKeyPair; import org.signal.libsignal.protocol.ecc.ECPrivateKey; import org.signal.libsignal.protocol.ecc.ECPublicKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.PaymentAddress; + +import okio.ByteString; public class PaymentUtils { @@ -20,16 +20,13 @@ private PaymentUtils() { /** * Signs the supplied address bytes with the {@link IdentityKeyPair}'s private key and returns a proto that includes it, and it's signature. */ - public static SignalServiceProtos.PaymentAddress signPaymentsAddress( + public static PaymentAddress signPaymentsAddress( byte[] publicAddressBytes, ECPrivateKey privateKey ) { byte[] signature = privateKey.calculateSignature(publicAddressBytes); - return SignalServiceProtos.PaymentAddress.newBuilder() - .setMobileCoinAddress(SignalServiceProtos.PaymentAddress.MobileCoinAddress.newBuilder() - .setAddress(ByteString.copyFrom(publicAddressBytes)) - .setSignature(ByteString.copyFrom(signature))) - .build(); + return new PaymentAddress.Builder().mobileCoinAddress(new PaymentAddress.MobileCoinAddress.Builder().address( + ByteString.of(publicAddressBytes)).signature(ByteString.of(signature)).build()).build(); } /** @@ -38,15 +35,16 @@ public static SignalServiceProtos.PaymentAddress signPaymentsAddress( * Returns the validated bytes if so, otherwise returns null. */ public static byte[] verifyPaymentsAddress( - SignalServiceProtos.PaymentAddress paymentAddress, ECPublicKey publicKey + PaymentAddress paymentAddress, ECPublicKey publicKey ) { - if (!paymentAddress.hasMobileCoinAddress()) { + final var mobileCoinAddress = paymentAddress.mobileCoinAddress; + if (mobileCoinAddress == null || mobileCoinAddress.address == null || mobileCoinAddress.signature == null) { logger.debug("Got payment address without mobile coin address, ignoring."); return null; } - byte[] bytes = paymentAddress.getMobileCoinAddress().getAddress().toByteArray(); - byte[] signature = paymentAddress.getMobileCoinAddress().getSignature().toByteArray(); + byte[] bytes = mobileCoinAddress.address.toByteArray(); + byte[] signature = mobileCoinAddress.signature.toByteArray(); if (signature.length != 64 || !publicKey.verifySignature(bytes, signature)) { logger.debug("Got mobile coin address with invalid signature, ignoring."); diff --git a/lib/src/main/java/org/asamk/signal/manager/util/ProfileUtils.java b/lib/src/main/java/org/asamk/signal/manager/util/ProfileUtils.java index cfbfc3ccdc..40fc8f7b2c 100644 --- a/lib/src/main/java/org/asamk/signal/manager/util/ProfileUtils.java +++ b/lib/src/main/java/org/asamk/signal/manager/util/ProfileUtils.java @@ -1,7 +1,5 @@ package org.asamk.signal.manager.util; -import com.google.protobuf.InvalidProtocolBufferException; - import org.asamk.signal.manager.api.Pair; import org.asamk.signal.manager.api.Profile; import org.signal.libsignal.protocol.IdentityKey; @@ -13,7 +11,7 @@ import org.whispersystems.signalservice.api.crypto.InvalidCiphertextException; import org.whispersystems.signalservice.api.crypto.ProfileCipher; import org.whispersystems.signalservice.api.profiles.SignalServiceProfile; -import org.whispersystems.signalservice.internal.push.SignalServiceProtos; +import org.whispersystems.signalservice.internal.push.PaymentAddress; import java.io.IOException; import java.util.Base64; @@ -117,10 +115,10 @@ private static byte[] decryptAndVerifyMobileCoinAddress( return null; } - SignalServiceProtos.PaymentAddress paymentAddress; + PaymentAddress paymentAddress; try { - paymentAddress = SignalServiceProtos.PaymentAddress.parseFrom(decrypted); - } catch (InvalidProtocolBufferException e) { + paymentAddress = PaymentAddress.ADAPTER.decode(decrypted); + } catch (IOException e) { logger.debug("Failed to parse payment address", e); return null; } diff --git a/settings.gradle.kts b/settings.gradle.kts index 2d3cd01a4b..bb2d1974b2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,8 +16,7 @@ dependencyResolutionManagement { library("logback", "ch.qos.logback", "logback-classic").version("1.4.11") - library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_80") - library("protobuf", "com.google.protobuf", "protobuf-javalite").version("3.24.0") + library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_81") library("sqlite", "org.xerial", "sqlite-jdbc").version("3.43.0.0") library("hikari", "com.zaxxer", "HikariCP").version("5.0.1") library("junit", "org.junit.jupiter", "junit-jupiter").version("5.10.0") diff --git a/src/main/java/org/asamk/signal/json/JsonCallMessage.java b/src/main/java/org/asamk/signal/json/JsonCallMessage.java index 70b1951c98..3438cf394b 100644 --- a/src/main/java/org/asamk/signal/json/JsonCallMessage.java +++ b/src/main/java/org/asamk/signal/json/JsonCallMessage.java @@ -47,10 +47,10 @@ public static Busy from(final MessageEnvelope.Call.Busy busy) { } } - public record Hangup(long id, String type, int deviceId, boolean isLegacy) { + public record Hangup(long id, String type, int deviceId) { public static Hangup from(final MessageEnvelope.Call.Hangup hangup) { - return new Hangup(hangup.id(), hangup.type().name(), hangup.deviceId(), hangup.isLegacy()); + return new Hangup(hangup.id(), hangup.type().name(), hangup.deviceId()); } }