From 68c9d84d1989f2ea162dae909a0a5b985b0b0832 Mon Sep 17 00:00:00 2001 From: AsamK Date: Sun, 24 Nov 2024 12:37:42 +0100 Subject: [PATCH] Update libsignal-service Fixes #1633 --- graalvm-config-dir/jni-config.json | 4 ++++ graalvm-config-dir/reflect-config.json | 10 ++++++++++ gradle/libs.versions.toml | 2 +- .../asamk/signal/manager/helper/AccountHelper.java | 1 + .../manager/internal/ProvisioningManagerImpl.java | 4 +++- .../signal/manager/storage/SignalAccount.java | 14 +++++++++++--- run_tests.sh | 1 + src/main/java/org/asamk/signal/BaseConfig.java | 2 +- 8 files changed, 32 insertions(+), 6 deletions(-) diff --git a/graalvm-config-dir/jni-config.json b/graalvm-config-dir/jni-config.json index 381dca9ee..fc76b7f95 100644 --- a/graalvm-config-dir/jni-config.json +++ b/graalvm-config-dir/jni-config.json @@ -228,6 +228,10 @@ "name":"org.signal.libsignal.usernames.CannotBeEmptyException", "methods":[{"name":"","parameterTypes":["java.lang.String"] }] }, +{ + "name":"org.signal.libsignal.usernames.DiscriminatorCannotBeZeroException", + "methods":[{"name":"","parameterTypes":["java.lang.String"] }] +}, { "name":"org.signal.libsignal.usernames.MissingSeparatorException", "methods":[{"name":"","parameterTypes":["java.lang.String"] }] diff --git a/graalvm-config-dir/reflect-config.json b/graalvm-config-dir/reflect-config.json index cdbf58175..13b9194aa 100644 --- a/graalvm-config-dir/reflect-config.json +++ b/graalvm-config-dir/reflect-config.json @@ -450,6 +450,12 @@ "allDeclaredFields":true, "queryAllDeclaredMethods":true }, +{ + "name":"java.util.ImmutableCollections$List12", + "allDeclaredFields":true, + "queryAllDeclaredMethods":true, + "queryAllDeclaredConstructors":true +}, { "name":"java.util.ImmutableCollections$ListN", "allDeclaredFields":true, @@ -2929,6 +2935,7 @@ { "name":"org.whispersystems.signalservice.internal.storage.protos.AccountRecord", "allDeclaredFields":true, + "fields":[{"name":"avatarUrlPath"}, {"name":"backupsSubscriberCurrencyCode"}, {"name":"backupsSubscriberId"}, {"name":"displayBadgesOnProfile"}, {"name":"e164"}, {"name":"familyName"}, {"name":"givenName"}, {"name":"hasCompletedUsernameOnboarding"}, {"name":"hasSeenGroupStoryEducationSheet"}, {"name":"hasSetMyStoriesPrivacy"}, {"name":"hasViewedOnboardingStory"}, {"name":"keepMutedChatsArchived"}, {"name":"linkPreviews"}, {"name":"noteToSelfArchived"}, {"name":"noteToSelfMarkedUnread"}, {"name":"payments"}, {"name":"phoneNumberSharingMode"}, {"name":"pinnedConversations"}, {"name":"preferContactAvatars"}, {"name":"preferredReactionEmoji"}, {"name":"primarySendsSms"}, {"name":"profileKey"}, {"name":"readReceipts"}, {"name":"sealedSenderIndicators"}, {"name":"storiesDisabled"}, {"name":"storyViewReceiptsEnabled"}, {"name":"subscriberCurrencyCode"}, {"name":"subscriberId"}, {"name":"subscriptionManuallyCancelled"}, {"name":"typingIndicators"}, {"name":"universalExpireTimer"}, {"name":"unlistedPhoneNumber"}, {"name":"username"}, {"name":"usernameLink"}], "methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }] }, { @@ -2955,6 +2962,7 @@ { "name":"org.whispersystems.signalservice.internal.storage.protos.ContactRecord", "allDeclaredFields":true, + "fields":[{"name":"aci"}, {"name":"archived"}, {"name":"blocked"}, {"name":"e164"}, {"name":"familyName"}, {"name":"givenName"}, {"name":"hidden"}, {"name":"hideStory"}, {"name":"identityKey"}, {"name":"identityState"}, {"name":"markedUnread"}, {"name":"mutedUntilTimestamp"}, {"name":"nickname"}, {"name":"note"}, {"name":"pni"}, {"name":"pniSignatureVerified"}, {"name":"profileKey"}, {"name":"systemFamilyName"}, {"name":"systemGivenName"}, {"name":"systemNickname"}, {"name":"unregisteredAtTimestamp"}, {"name":"username"}, {"name":"whitelisted"}], "methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }] }, { @@ -2973,6 +2981,7 @@ { "name":"org.whispersystems.signalservice.internal.storage.protos.GroupV1Record", "allDeclaredFields":true, + "fields":[{"name":"archived"}, {"name":"blocked"}, {"name":"id"}, {"name":"markedUnread"}, {"name":"mutedUntilTimestamp"}, {"name":"whitelisted"}], "methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }] }, { @@ -2984,6 +2993,7 @@ { "name":"org.whispersystems.signalservice.internal.storage.protos.GroupV2Record", "allDeclaredFields":true, + "fields":[{"name":"archived"}, {"name":"blocked"}, {"name":"dontNotifyForMentionsIfMuted"}, {"name":"hideStory"}, {"name":"markedUnread"}, {"name":"masterKey"}, {"name":"mutedUntilTimestamp"}, {"name":"storySendMode"}, {"name":"whitelisted"}], "methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }] }, { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e52a4ae7a..483ea2440 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" } logback = "ch.qos.logback:logback-classic:1.5.12" -signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_111" +signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_112" sqlite = "org.xerial:sqlite-jdbc:3.47.0.0" hikari = "com.zaxxer:HikariCP:6.2.1" junit-jupiter = "org.junit.jupiter:junit-jupiter:5.11.3" diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java index 3eb2051d4..209ca7117 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java @@ -502,6 +502,7 @@ public void addDevice(DeviceLinkUrl deviceLinkInfo) throws IOException, org.asam account.getProfileKey(), account.getOrCreatePinMasterKey(), account.getOrCreateMediaRootBackupKey(), + account.getOrCreateAccountEntropyPool(), verificationCode.getVerificationCode(), null)); account.setMultiDevice(true); diff --git a/lib/src/main/java/org/asamk/signal/manager/internal/ProvisioningManagerImpl.java b/lib/src/main/java/org/asamk/signal/manager/internal/ProvisioningManagerImpl.java index 2204b7438..fcef536a6 100644 --- a/lib/src/main/java/org/asamk/signal/manager/internal/ProvisioningManagerImpl.java +++ b/lib/src/main/java/org/asamk/signal/manager/internal/ProvisioningManagerImpl.java @@ -150,7 +150,9 @@ public String finishDeviceLink(String deviceName) throws IOException, TimeoutExc ret.getAciIdentity(), ret.getPniIdentity(), profileKey, - ret.getMasterKey()); + ret.getMasterKey(), + ret.getAccountEntropyPool(), + ret.getMediaRootBackupKey()); account.getConfigurationStore().setReadReceipts(ret.isReadReceipts()); diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java b/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java index 2529ad4ac..c4cf14840 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java @@ -292,7 +292,9 @@ public void setProvisioningData( final IdentityKeyPair aciIdentity, final IdentityKeyPair pniIdentity, final ProfileKey profileKey, - final MasterKey masterKey + final MasterKey masterKey, + final AccountEntropyPool accountEntropyPool, + final MediaRootBackupKey mediaRootBackupKey ) { this.deviceId = 0; this.number = number; @@ -308,8 +310,14 @@ public void setProvisioningData( this.registered = false; this.isMultiDevice = true; setLastReceiveTimestamp(0L); - this.pinMasterKey = masterKey; - this.accountEntropyPool = null; + if (accountEntropyPool != null) { + this.pinMasterKey = null; + this.accountEntropyPool = accountEntropyPool; + } else { + this.pinMasterKey = masterKey; + this.accountEntropyPool = null; + } + this.mediaRootBackupKey = mediaRootBackupKey; getKeyValueStore().storeEntry(storageManifestVersion, -1L); this.setStorageManifest(null); this.storageKey = null; diff --git a/run_tests.sh b/run_tests.sh index 0e5ff4be0..036ba3702 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -149,6 +149,7 @@ exec 3<> "$FIFO_FILE" echo '{"jsonrpc":"2.0","id":7,"method":"sendTyping","params":{"recipient":"'"$NUMBER_1"'"}}' >&3 echo '{"jsonrpc":"2.0","id":7,"method":"send","params":{"recipient":"'"$NUMBER_1"'","message":"some text"}}' >&3 echo '{"jsonrpc":"2.0","id":7,"method":"send","params":{"recipients":["'"$NUMBER_1"'","'"$NUMBER_2"'"],"message":"some other text"}}' >&3 + echo '{"jsonrpc":"2.0","id":7,"method":"sendReaction","params":{"recipients":["'"$NUMBER_2"'"],"targetAuthor":"'"$NUMBER_1"'","emoji":"👍","targetTimestamp":4756473756}}' >&3 echo '{"jsonrpc":"2.0","id":7,"method":"updateProfile","params":{"givenName":"n1","familyName":"n2","about":"ABA","aboutEmoji":"EMO","avatar":"LICENSE"}}' >&3 echo '{"jsonrpc":"2.0","id":7,"method":"getUserStatus","params":{"recipient":"'"$NUMBER_1"'"}}' >&3 diff --git a/src/main/java/org/asamk/signal/BaseConfig.java b/src/main/java/org/asamk/signal/BaseConfig.java index 7b182351d..e25bfa14a 100644 --- a/src/main/java/org/asamk/signal/BaseConfig.java +++ b/src/main/java/org/asamk/signal/BaseConfig.java @@ -8,7 +8,7 @@ public class BaseConfig { public static final String PROJECT_VERSION = BaseConfig.class.getPackage().getImplementationVersion(); static final String USER_AGENT_SIGNAL_ANDROID = Optional.ofNullable(System.getenv("SIGNAL_CLI_USER_AGENT")) - .orElse("Signal-Android/7.21.4"); + .orElse("Signal-Android/7.26.1"); static final String USER_AGENT_SIGNAL_CLI = PROJECT_NAME == null ? "signal-cli" : PROJECT_NAME + "/" + PROJECT_VERSION;