Update libsignal-service

This commit is contained in:
AsamK 2025-06-01 21:51:03 +02:00
parent a9bb8d9aae
commit e89803464b
11 changed files with 39 additions and 23 deletions

View file

@ -27,6 +27,10 @@
{ {
"name":"java.lang.ClassNotFoundException" "name":"java.lang.ClassNotFoundException"
}, },
{
"name":"java.lang.Enum",
"methods":[{"name":"ordinal","parameterTypes":[] }]
},
{ {
"name":"java.lang.IllegalArgumentException", "name":"java.lang.IllegalArgumentException",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }] "methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
@ -48,6 +52,10 @@
{ {
"name":"java.lang.String" "name":"java.lang.String"
}, },
{
"name":"java.lang.Thread",
"methods":[{"name":"currentThread","parameterTypes":[] }, {"name":"getStackTrace","parameterTypes":[] }]
},
{ {
"name":"java.lang.Throwable", "name":"java.lang.Throwable",
"methods":[{"name":"getMessage","parameterTypes":[] }, {"name":"toString","parameterTypes":[] }] "methods":[{"name":"getMessage","parameterTypes":[] }, {"name":"toString","parameterTypes":[] }]
@ -88,7 +96,7 @@
}, },
{ {
"name":"org.signal.libsignal.internal.CompletableFuture", "name":"org.signal.libsignal.internal.CompletableFuture",
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"complete","parameterTypes":["java.lang.Object"] }, {"name":"completeExceptionally","parameterTypes":["java.lang.Throwable"] }] "methods":[{"name":"<init>","parameterTypes":[] }, {"name":"complete","parameterTypes":["java.lang.Object"] }, {"name":"completeExceptionally","parameterTypes":["java.lang.Throwable"] }, {"name":"setCancellationId","parameterTypes":["long"] }]
}, },
{ {
"name":"org.signal.libsignal.internal.NativeHandleGuard$SimpleOwner", "name":"org.signal.libsignal.internal.NativeHandleGuard$SimpleOwner",
@ -195,6 +203,9 @@
"name":"org.signal.libsignal.protocol.state.IdentityKeyStore$Direction", "name":"org.signal.libsignal.protocol.state.IdentityKeyStore$Direction",
"fields":[{"name":"RECEIVING"}, {"name":"SENDING"}] "fields":[{"name":"RECEIVING"}, {"name":"SENDING"}]
}, },
{
"name":"org.signal.libsignal.protocol.state.IdentityKeyStore$IdentityChange"
},
{ {
"name":"org.signal.libsignal.protocol.state.KyberPreKeyRecord", "name":"org.signal.libsignal.protocol.state.KyberPreKeyRecord",
"fields":[{"name":"unsafeHandle"}] "fields":[{"name":"unsafeHandle"}]

View file

@ -2994,7 +2994,6 @@
{ {
"name":"org.whispersystems.signalservice.internal.storage.protos.AccountRecord", "name":"org.whispersystems.signalservice.internal.storage.protos.AccountRecord",
"allDeclaredFields":true, "allDeclaredFields":true,
"fields":[{"name":"avatarColor"}, {"name":"avatarUrlPath"}, {"name":"backupSubscriberData"}, {"name":"backupTier"}, {"name":"displayBadgesOnProfile"}, {"name":"e164"}, {"name":"familyName"}, {"name":"givenName"}, {"name":"hasBackup"}, {"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":[] }] "methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }]
}, },
{ {
@ -3027,7 +3026,6 @@
{ {
"name":"org.whispersystems.signalservice.internal.storage.protos.ContactRecord", "name":"org.whispersystems.signalservice.internal.storage.protos.ContactRecord",
"allDeclaredFields":true, "allDeclaredFields":true,
"fields":[{"name":"aci"}, {"name":"archived"}, {"name":"avatarColor"}, {"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":[] }] "methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }]
}, },
{ {
@ -3058,7 +3056,6 @@
{ {
"name":"org.whispersystems.signalservice.internal.storage.protos.GroupV2Record", "name":"org.whispersystems.signalservice.internal.storage.protos.GroupV2Record",
"allDeclaredFields":true, "allDeclaredFields":true,
"fields":[{"name":"archived"}, {"name":"avatarColor"}, {"name":"blocked"}, {"name":"dontNotifyForMentionsIfMuted"}, {"name":"hideStory"}, {"name":"markedUnread"}, {"name":"masterKey"}, {"name":"mutedUntilTimestamp"}, {"name":"storySendMode"}, {"name":"whitelisted"}],
"methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }] "methods":[{"name":"adapter","parameterTypes":[] }, {"name":"unknownFields","parameterTypes":[] }]
}, },
{ {

View file

@ -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" } slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
logback = "ch.qos.logback:logback-classic:1.5.18" logback = "ch.qos.logback:logback-classic:1.5.18"
signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_122" signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_123"
sqlite = "org.xerial:sqlite-jdbc:3.49.1.0" sqlite = "org.xerial:sqlite-jdbc:3.49.1.0"
hikari = "com.zaxxer:HikariCP:6.3.0" hikari = "com.zaxxer:HikariCP:6.3.0"
junit-jupiter = "org.junit.jupiter:junit-jupiter:5.12.0" junit-jupiter = "org.junit.jupiter:junit-jupiter:5.12.0"

View file

@ -29,7 +29,8 @@ class LiveConfig {
private static final byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder() private static final byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
.decode("BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF"); .decode("BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF");
private static final String CDSI_MRENCLAVE = "0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57"; private static final String CDSI_MRENCLAVE = "0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57";
private static final String SVR2_MRENCLAVE = "9314436a9a144992bb3680770ea5fd7934a7ffd29257844a33763a238903d570"; private static final String SVR2_MRENCLAVE_LEGACY = "9314436a9a144992bb3680770ea5fd7934a7ffd29257844a33763a238903d570";
private static final String SVR2_MRENCLAVE = "093be9ea32405e85ae28dbb48eb668aebeb7dbe29517b9b86ad4bec4dfe0e6a6";
private static final String URL = "https://chat.signal.org"; private static final String URL = "https://chat.signal.org";
private static final String CDN_URL = "https://cdn.signal.org"; private static final String CDN_URL = "https://cdn.signal.org";
@ -91,7 +92,7 @@ class LiveConfig {
createDefaultServiceConfiguration(interceptors), createDefaultServiceConfiguration(interceptors),
getUnidentifiedSenderTrustRoot(), getUnidentifiedSenderTrustRoot(),
CDSI_MRENCLAVE, CDSI_MRENCLAVE,
List.of(SVR2_MRENCLAVE)); List.of(SVR2_MRENCLAVE, SVR2_MRENCLAVE_LEGACY));
} }
private LiveConfig() { private LiveConfig() {

View file

@ -29,7 +29,8 @@ class StagingConfig {
private static final byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder() private static final byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
.decode("BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx"); .decode("BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx");
private static final String CDSI_MRENCLAVE = "0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57"; private static final String CDSI_MRENCLAVE = "0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57";
private static final String SVR2_MRENCLAVE = "38e01eff4fe357dc0b0e8ef7a44b4abc5489fbccba3a78780f3872c277f62bf3"; private static final String SVR2_MRENCLAVE_LEGACY = "38e01eff4fe357dc0b0e8ef7a44b4abc5489fbccba3a78780f3872c277f62bf3";
private static final String SVR2_MRENCLAVE = "2e8cefe6e3f389d8426adb24e9b7fb7adf10902c96f06f7bbcee36277711ed91";
private static final String URL = "https://chat.staging.signal.org"; private static final String URL = "https://chat.staging.signal.org";
private static final String CDN_URL = "https://cdn-staging.signal.org"; private static final String CDN_URL = "https://cdn-staging.signal.org";
@ -91,7 +92,7 @@ class StagingConfig {
createDefaultServiceConfiguration(interceptors), createDefaultServiceConfiguration(interceptors),
getUnidentifiedSenderTrustRoot(), getUnidentifiedSenderTrustRoot(),
CDSI_MRENCLAVE, CDSI_MRENCLAVE,
List.of(SVR2_MRENCLAVE)); List.of(SVR2_MRENCLAVE, SVR2_MRENCLAVE_LEGACY));
} }
private StagingConfig() { private StagingConfig() {

View file

@ -105,7 +105,7 @@ public class AccountHelper {
if (!account.isPrimaryDevice() && account.getPniIdentityKeyPair() == null) { if (!account.isPrimaryDevice() && account.getPniIdentityKeyPair() == null) {
throw new IOException("Missing PNI identity key, relinking required"); throw new IOException("Missing PNI identity key, relinking required");
} }
if (account.getPreviousStorageVersion() < 4 if (account.getPreviousStorageVersion() < 10
&& account.isPrimaryDevice() && account.isPrimaryDevice()
&& account.getRegistrationLockPin() != null) { && account.getRegistrationLockPin() != null) {
migrateRegistrationPin(); migrateRegistrationPin();

View file

@ -325,7 +325,8 @@ public class SignalDependencies {
getKeysApi(), getKeysApi(),
Optional.empty(), Optional.empty(),
executor, executor,
ServiceConfig.MAX_ENVELOPE_SIZE)); ServiceConfig.MAX_ENVELOPE_SIZE,
() -> true));
} }
public List<SecureValueRecovery> getSecureValueRecovery() { public List<SecureValueRecovery> getSecureValueRecovery() {

View file

@ -116,7 +116,7 @@ public class SignalAccount implements Closeable {
private static final Logger logger = LoggerFactory.getLogger(SignalAccount.class); private static final Logger logger = LoggerFactory.getLogger(SignalAccount.class);
private static final int MINIMUM_STORAGE_VERSION = 1; private static final int MINIMUM_STORAGE_VERSION = 1;
private static final int CURRENT_STORAGE_VERSION = 9; private static final int CURRENT_STORAGE_VERSION = 10;
private final Object LOCK = new Object(); private final Object LOCK = new Object();

View file

@ -8,6 +8,7 @@ import org.asamk.signal.manager.storage.recipients.RecipientStore;
import org.signal.libsignal.protocol.IdentityKey; import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.InvalidKeyException; import org.signal.libsignal.protocol.InvalidKeyException;
import org.signal.libsignal.protocol.state.IdentityKeyStore.Direction; import org.signal.libsignal.protocol.state.IdentityKeyStore.Direction;
import org.signal.libsignal.protocol.state.IdentityKeyStore.IdentityChange;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.push.ServiceId; import org.whispersystems.signalservice.api.push.ServiceId;
@ -62,11 +63,11 @@ public class IdentityKeyStore {
return identityChanges; return identityChanges;
} }
public boolean saveIdentity(final ServiceId serviceId, final IdentityKey identityKey) { public IdentityChange saveIdentity(final ServiceId serviceId, final IdentityKey identityKey) {
return saveIdentity(serviceId.toString(), identityKey); return saveIdentity(serviceId.toString(), identityKey);
} }
public boolean saveIdentity( public IdentityChange saveIdentity(
final Connection connection, final Connection connection,
final ServiceId serviceId, final ServiceId serviceId,
final IdentityKey identityKey final IdentityKey identityKey
@ -74,9 +75,9 @@ public class IdentityKeyStore {
return saveIdentity(connection, serviceId.toString(), identityKey); return saveIdentity(connection, serviceId.toString(), identityKey);
} }
boolean saveIdentity(final String address, final IdentityKey identityKey) { IdentityChange saveIdentity(final String address, final IdentityKey identityKey) {
if (isRetryingDecryption) { if (isRetryingDecryption) {
return false; return IdentityChange.NEW_OR_UNCHANGED;
} }
try (final var connection = database.getConnection()) { try (final var connection = database.getConnection()) {
return saveIdentity(connection, address, identityKey); return saveIdentity(connection, address, identityKey);
@ -85,20 +86,24 @@ public class IdentityKeyStore {
} }
} }
private boolean saveIdentity( private IdentityChange saveIdentity(
final Connection connection, final Connection connection,
final String address, final String address,
final IdentityKey identityKey final IdentityKey identityKey
) throws SQLException { ) throws SQLException {
final var identityInfo = loadIdentity(connection, address); final var identityInfo = loadIdentity(connection, address);
if (identityInfo != null && identityInfo.getIdentityKey().equals(identityKey)) { if (identityInfo == null) {
saveNewIdentity(connection, address, identityKey, true);
return IdentityChange.NEW_OR_UNCHANGED;
}
if (identityInfo.getIdentityKey().equals(identityKey)) {
// Identity already exists, not updating the trust level // Identity already exists, not updating the trust level
logger.trace("Not storing new identity for recipient {}, identity already stored", address); logger.trace("Not storing new identity for recipient {}, identity already stored", address);
return false; return IdentityChange.NEW_OR_UNCHANGED;
} }
saveNewIdentity(connection, address, identityKey, identityInfo == null); saveNewIdentity(connection, address, identityKey, false);
return true; return IdentityChange.REPLACED_EXISTING;
} }
public void setRetryingDecryption(final boolean retryingDecryption) { public void setRetryingDecryption(final boolean retryingDecryption) {

View file

@ -33,7 +33,7 @@ public class SignalIdentityKeyStore implements org.signal.libsignal.protocol.sta
} }
@Override @Override
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) { public IdentityChange saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
return identityKeyStore.saveIdentity(address.getName(), identityKey); return identityKeyStore.saveIdentity(address.getName(), identityKey);
} }

View file

@ -65,7 +65,7 @@ public class SignalProtocolStore implements SignalServiceAccountDataStore {
} }
@Override @Override
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) { public IdentityChange saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
return identityKeyStore.saveIdentity(address, identityKey); return identityKeyStore.saveIdentity(address, identityKey);
} }