Update libsignal-service-java

This commit is contained in:
AsamK 2023-02-19 14:06:20 +01:00
parent 426b59d13e
commit 3606fb67bb
9 changed files with 34 additions and 70 deletions

View file

@ -1,4 +1,7 @@
[ [
{
"name":"[Z"
},
{ {
"name":"com.sun.security.auth.module.UnixSystem", "name":"com.sun.security.auth.module.UnixSystem",
"fields":[ "fields":[
@ -189,6 +192,10 @@
"name":"org.signal.libsignal.zkgroup.InvalidInputException", "name":"org.signal.libsignal.zkgroup.InvalidInputException",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }] "methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
}, },
{
"name":"org.sqlite.BusyHandler",
"methods":[{"name":"callback","parameterTypes":["int"] }]
},
{ {
"name":"org.sqlite.Collation", "name":"org.sqlite.Collation",
"methods":[{"name":"xCompare","parameterTypes":["java.lang.String","java.lang.String"] }] "methods":[{"name":"xCompare","parameterTypes":["java.lang.String","java.lang.String"] }]
@ -218,11 +225,14 @@
] ]
}, },
{ {
"name":"org.sqlite.ProgressHandler" "name":"org.sqlite.ProgressHandler",
"methods":[{"name":"progress","parameterTypes":[] }]
}, },
{ {
"name":"org.sqlite.core.DB", "name":"org.sqlite.core.DB",
"methods":[ "methods":[
{"name":"onCommit","parameterTypes":["boolean"] },
{"name":"onUpdate","parameterTypes":["int","java.lang.String","java.lang.String","long"] },
{"name":"throwex","parameterTypes":[] }, {"name":"throwex","parameterTypes":[] },
{"name":"throwex","parameterTypes":["int"] } {"name":"throwex","parameterTypes":["int"] }
] ]

View file

@ -3064,6 +3064,7 @@
{"name":"bitField0_"}, {"name":"bitField0_"},
{"name":"content_"}, {"name":"content_"},
{"name":"destinationUuid_"}, {"name":"destinationUuid_"},
{"name":"reportingToken_"},
{"name":"serverGuid_"}, {"name":"serverGuid_"},
{"name":"serverTimestamp_"}, {"name":"serverTimestamp_"},
{"name":"sourceDevice_"}, {"name":"sourceDevice_"},
@ -3228,6 +3229,18 @@
{"name":"uuids_"} {"name":"uuids_"}
] ]
}, },
{
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$CallEvent",
"fields":[
{"name":"bitField0_"},
{"name":"direction_"},
{"name":"event_"},
{"name":"id_"},
{"name":"peerUuid_"},
{"name":"timestamp_"},
{"name":"type_"}
]
},
{ {
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Configuration", "name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$SyncMessage$Configuration",
"fields":[ "fields":[

View file

@ -7,7 +7,6 @@ import org.signal.libsignal.protocol.ecc.ECPublicKey;
import org.whispersystems.signalservice.api.push.TrustStore; import org.whispersystems.signalservice.api.push.TrustStore;
import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl; import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl;
import org.whispersystems.signalservice.internal.configuration.SignalCdsiUrl; import org.whispersystems.signalservice.internal.configuration.SignalCdsiUrl;
import org.whispersystems.signalservice.internal.configuration.SignalContactDiscoveryUrl;
import org.whispersystems.signalservice.internal.configuration.SignalKeyBackupServiceUrl; import org.whispersystems.signalservice.internal.configuration.SignalKeyBackupServiceUrl;
import org.whispersystems.signalservice.internal.configuration.SignalProxy; import org.whispersystems.signalservice.internal.configuration.SignalProxy;
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration; import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration;
@ -27,8 +26,7 @@ class LiveConfig {
private final static byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder() private final static byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
.decode("BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF"); .decode("BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF");
private final static String CDS_MRENCLAVE = "74778bb0f93ae1f78c26e67152bab0bbeb693cd56d1bb9b4e9244157acc58081"; private final static String CDSI_MRENCLAVE = "0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57";
private final static String CDSI_MRENCLAVE = "ef4787a56a154ac6d009138cac17155acd23cfe4329281252365dd7c252e7fbf";
private final static String KEY_BACKUP_ENCLAVE_NAME = "e18376436159cda3ad7a45d9320e382e4a497f26b0dca34d8eab0bd0139483b5"; private final static String KEY_BACKUP_ENCLAVE_NAME = "e18376436159cda3ad7a45d9320e382e4a497f26b0dca34d8eab0bd0139483b5";
private final static byte[] KEY_BACKUP_SERVICE_ID = Hex.decode( private final static byte[] KEY_BACKUP_SERVICE_ID = Hex.decode(
@ -42,7 +40,6 @@ class LiveConfig {
private final static String URL = "https://chat.signal.org"; private final static String URL = "https://chat.signal.org";
private final static String CDN_URL = "https://cdn.signal.org"; private final static String CDN_URL = "https://cdn.signal.org";
private final static String CDN2_URL = "https://cdn2.signal.org"; private final static String CDN2_URL = "https://cdn2.signal.org";
private final static String SIGNAL_CONTACT_DISCOVERY_URL = "https://api.directory.signal.org";
private final static String SIGNAL_KEY_BACKUP_URL = "https://api.backup.signal.org"; private final static String SIGNAL_KEY_BACKUP_URL = "https://api.backup.signal.org";
private final static String STORAGE_URL = "https://storage.signal.org"; private final static String STORAGE_URL = "https://storage.signal.org";
private final static String SIGNAL_CDSI_URL = "https://cdsi.signal.org"; private final static String SIGNAL_CDSI_URL = "https://cdsi.signal.org";
@ -62,17 +59,13 @@ class LiveConfig {
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)}, new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
2, 2,
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}), new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
new SignalContactDiscoveryUrl[]{
new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL, TRUST_STORE)
},
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)}, new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)}, new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)}, new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
interceptors, interceptors,
dns, dns,
proxy, proxy,
zkGroupServerPublicParams, zkGroupServerPublicParams);
true);
} }
static ECPublicKey getUnidentifiedSenderTrustRoot() { static ECPublicKey getUnidentifiedSenderTrustRoot() {
@ -93,10 +86,6 @@ class LiveConfig {
FALLBACK_KEY_BACKUP_MRENCLAVE)); FALLBACK_KEY_BACKUP_MRENCLAVE));
} }
static String getCdsMrenclave() {
return CDS_MRENCLAVE;
}
static String getCdsiMrenclave() { static String getCdsiMrenclave() {
return CDSI_MRENCLAVE; return CDSI_MRENCLAVE;
} }

View file

@ -90,14 +90,12 @@ public class ServiceConfig {
LiveConfig.getUnidentifiedSenderTrustRoot(), LiveConfig.getUnidentifiedSenderTrustRoot(),
LiveConfig.createKeyBackupConfig(), LiveConfig.createKeyBackupConfig(),
LiveConfig.createFallbackKeyBackupConfigs(), LiveConfig.createFallbackKeyBackupConfigs(),
LiveConfig.getCdsMrenclave(),
LiveConfig.getCdsiMrenclave()); LiveConfig.getCdsiMrenclave());
case STAGING -> new ServiceEnvironmentConfig(serviceEnvironment, case STAGING -> new ServiceEnvironmentConfig(serviceEnvironment,
StagingConfig.createDefaultServiceConfiguration(interceptors), StagingConfig.createDefaultServiceConfiguration(interceptors),
StagingConfig.getUnidentifiedSenderTrustRoot(), StagingConfig.getUnidentifiedSenderTrustRoot(),
StagingConfig.createKeyBackupConfig(), StagingConfig.createKeyBackupConfig(),
StagingConfig.createFallbackKeyBackupConfigs(), StagingConfig.createFallbackKeyBackupConfigs(),
StagingConfig.getCdsMrenclave(),
StagingConfig.getCdsiMrenclave()); StagingConfig.getCdsiMrenclave());
}; };
} }

View file

@ -15,7 +15,6 @@ public class ServiceEnvironmentConfig {
private final KeyBackupConfig keyBackupConfig; private final KeyBackupConfig keyBackupConfig;
private final Collection<KeyBackupConfig> fallbackKeyBackupConfigs; private final Collection<KeyBackupConfig> fallbackKeyBackupConfigs;
private final String cdsMrenclave;
private final String cdsiMrenclave; private final String cdsiMrenclave;
public ServiceEnvironmentConfig( public ServiceEnvironmentConfig(
@ -24,7 +23,6 @@ public class ServiceEnvironmentConfig {
final ECPublicKey unidentifiedSenderTrustRoot, final ECPublicKey unidentifiedSenderTrustRoot,
final KeyBackupConfig keyBackupConfig, final KeyBackupConfig keyBackupConfig,
final Collection<KeyBackupConfig> fallbackKeyBackupConfigs, final Collection<KeyBackupConfig> fallbackKeyBackupConfigs,
final String cdsMrenclave,
final String cdsiMrenclave final String cdsiMrenclave
) { ) {
this.type = type; this.type = type;
@ -32,7 +30,6 @@ public class ServiceEnvironmentConfig {
this.unidentifiedSenderTrustRoot = unidentifiedSenderTrustRoot; this.unidentifiedSenderTrustRoot = unidentifiedSenderTrustRoot;
this.keyBackupConfig = keyBackupConfig; this.keyBackupConfig = keyBackupConfig;
this.fallbackKeyBackupConfigs = fallbackKeyBackupConfigs; this.fallbackKeyBackupConfigs = fallbackKeyBackupConfigs;
this.cdsMrenclave = cdsMrenclave;
this.cdsiMrenclave = cdsiMrenclave; this.cdsiMrenclave = cdsiMrenclave;
} }
@ -56,10 +53,6 @@ public class ServiceEnvironmentConfig {
return fallbackKeyBackupConfigs; return fallbackKeyBackupConfigs;
} }
public String getCdsMrenclave() {
return cdsMrenclave;
}
public String getCdsiMrenclave() { public String getCdsiMrenclave() {
return cdsiMrenclave; return cdsiMrenclave;
} }

View file

@ -7,7 +7,6 @@ import org.signal.libsignal.protocol.ecc.ECPublicKey;
import org.whispersystems.signalservice.api.push.TrustStore; import org.whispersystems.signalservice.api.push.TrustStore;
import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl; import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl;
import org.whispersystems.signalservice.internal.configuration.SignalCdsiUrl; import org.whispersystems.signalservice.internal.configuration.SignalCdsiUrl;
import org.whispersystems.signalservice.internal.configuration.SignalContactDiscoveryUrl;
import org.whispersystems.signalservice.internal.configuration.SignalKeyBackupServiceUrl; import org.whispersystems.signalservice.internal.configuration.SignalKeyBackupServiceUrl;
import org.whispersystems.signalservice.internal.configuration.SignalProxy; import org.whispersystems.signalservice.internal.configuration.SignalProxy;
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration; import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration;
@ -27,8 +26,7 @@ class StagingConfig {
private final static byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder() private final static byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
.decode("BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx"); .decode("BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx");
private final static String CDS_MRENCLAVE = "74778bb0f93ae1f78c26e67152bab0bbeb693cd56d1bb9b4e9244157acc58081"; private final static String CDSI_MRENCLAVE = "0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57";
private final static String CDSI_MRENCLAVE = "ef4787a56a154ac6d009138cac17155acd23cfe4329281252365dd7c252e7fbf";
private final static String KEY_BACKUP_ENCLAVE_NAME = "39963b736823d5780be96ab174869a9499d56d66497aa8f9b2244f777ebc366b"; private final static String KEY_BACKUP_ENCLAVE_NAME = "39963b736823d5780be96ab174869a9499d56d66497aa8f9b2244f777ebc366b";
private final static byte[] KEY_BACKUP_SERVICE_ID = Hex.decode( private final static byte[] KEY_BACKUP_SERVICE_ID = Hex.decode(
@ -42,7 +40,6 @@ class StagingConfig {
private final static String URL = "https://chat.staging.signal.org"; private final static String URL = "https://chat.staging.signal.org";
private final static String CDN_URL = "https://cdn-staging.signal.org"; private final static String CDN_URL = "https://cdn-staging.signal.org";
private final static String CDN2_URL = "https://cdn2-staging.signal.org"; private final static String CDN2_URL = "https://cdn2-staging.signal.org";
private final static String SIGNAL_CONTACT_DISCOVERY_URL = "https://api-staging.directory.signal.org";
private final static String SIGNAL_KEY_BACKUP_URL = "https://api-staging.backup.signal.org"; private final static String SIGNAL_KEY_BACKUP_URL = "https://api-staging.backup.signal.org";
private final static String STORAGE_URL = "https://storage-staging.signal.org"; private final static String STORAGE_URL = "https://storage-staging.signal.org";
private final static String SIGNAL_CDSI_URL = "https://cdsi.staging.signal.org"; private final static String SIGNAL_CDSI_URL = "https://cdsi.staging.signal.org";
@ -62,17 +59,13 @@ class StagingConfig {
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)}, new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
2, 2,
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}), new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
new SignalContactDiscoveryUrl[]{
new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL, TRUST_STORE)
},
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)}, new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)}, new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)}, new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
interceptors, interceptors,
dns, dns,
proxy, proxy,
zkGroupServerPublicParams, zkGroupServerPublicParams);
true);
} }
static ECPublicKey getUnidentifiedSenderTrustRoot() { static ECPublicKey getUnidentifiedSenderTrustRoot() {
@ -93,10 +86,6 @@ class StagingConfig {
FALLBACK_KEY_BACKUP_MRENCLAVE)); FALLBACK_KEY_BACKUP_MRENCLAVE));
} }
static String getCdsMrenclave() {
return CDS_MRENCLAVE;
}
static String getCdsiMrenclave() { static String getCdsiMrenclave() {
return CDSI_MRENCLAVE; return CDSI_MRENCLAVE;
} }

View file

@ -3,11 +3,9 @@ package org.asamk.signal.manager.helper;
import org.asamk.signal.manager.SignalDependencies; import org.asamk.signal.manager.SignalDependencies;
import org.asamk.signal.manager.api.RecipientIdentifier; import org.asamk.signal.manager.api.RecipientIdentifier;
import org.asamk.signal.manager.api.UnregisteredRecipientException; import org.asamk.signal.manager.api.UnregisteredRecipientException;
import org.asamk.signal.manager.config.ServiceConfig;
import org.asamk.signal.manager.config.ServiceEnvironmentConfig; import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
import org.asamk.signal.manager.storage.SignalAccount; import org.asamk.signal.manager.storage.SignalAccount;
import org.asamk.signal.manager.storage.recipients.RecipientId; import org.asamk.signal.manager.storage.recipients.RecipientId;
import org.signal.libsignal.protocol.InvalidKeyException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.push.ACI; import org.whispersystems.signalservice.api.push.ACI;
@ -15,12 +13,8 @@ import org.whispersystems.signalservice.api.push.PNI;
import org.whispersystems.signalservice.api.push.ServiceId; import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.services.CdsiV2Service; import org.whispersystems.signalservice.api.services.CdsiV2Service;
import org.whispersystems.signalservice.internal.contacts.crypto.Quote;
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedQuoteException;
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.IOException; import java.io.IOException;
import java.security.SignatureException;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -108,13 +102,7 @@ public class RecipientHelper {
} }
public Map<String, RegisteredUser> getRegisteredUsers(final Set<String> numbers) throws IOException { public Map<String, RegisteredUser> getRegisteredUsers(final Set<String> numbers) throws IOException {
Map<String, RegisteredUser> registeredUsers; Map<String, RegisteredUser> registeredUsers = getRegisteredUsersV2(numbers, true);
try {
registeredUsers = getRegisteredUsersV2(numbers, true);
} catch (IOException e) {
logger.warn("CDSI request failed, trying fallback to CDS", e);
registeredUsers = getRegisteredUsersV1(numbers);
}
// Store numbers as recipients, so we have the number/uuid association // Store numbers as recipients, so we have the number/uuid association
registeredUsers.forEach((number, u) -> account.getRecipientTrustedResolver() registeredUsers.forEach((number, u) -> account.getRecipientTrustedResolver()
@ -137,23 +125,6 @@ public class RecipientHelper {
return user.getServiceId(); return user.getServiceId();
} }
private Map<String, RegisteredUser> getRegisteredUsersV1(final Set<String> numbers) throws IOException {
final Map<String, ACI> response;
try {
response = dependencies.getAccountManager()
.getRegisteredUsers(ServiceConfig.getIasKeyStore(),
numbers,
serviceEnvironmentConfig.getCdsMrenclave());
} catch (Quote.InvalidQuoteFormatException | UnauthenticatedQuoteException | SignatureException |
UnauthenticatedResponseException | InvalidKeyException | NumberFormatException e) {
throw new IOException(e);
}
final var registeredUsers = new HashMap<String, RegisteredUser>();
response.forEach((key, value) -> registeredUsers.put(key,
new RegisteredUser(Optional.of(value), Optional.empty())));
return registeredUsers;
}
private Map<String, RegisteredUser> getRegisteredUsersV2( private Map<String, RegisteredUser> getRegisteredUsersV2(
final Set<String> numbers, boolean useCompat final Set<String> numbers, boolean useCompat
) throws IOException { ) throws IOException {
@ -183,7 +154,7 @@ public class RecipientHelper {
} }
private ACI getRegisteredUserByUsername(String username) throws IOException { private ACI getRegisteredUserByUsername(String username) throws IOException {
return dependencies.getAccountManager().getAciByUsername(username); return dependencies.getAccountManager().getAciByUsernameHash(username);
} }
public record RegisteredUser(Optional<ACI> aci, Optional<PNI> pni) { public record RegisteredUser(Optional<ACI> aci, Optional<PNI> pni) {

View file

@ -96,8 +96,9 @@ public class MessageCacheUtils {
uuid, uuid,
destinationUuid == null ? UuidUtil.UNKNOWN_UUID.toString() : destinationUuid, destinationUuid == null ? UuidUtil.UNKNOWN_UUID.toString() : destinationUuid,
isUrgent, isUrgent,
updatedPni == null ? "" : updatedPni, isStory,
isStory); null,
updatedPni == null ? "" : updatedPni);
} }
} }

View file

@ -16,7 +16,7 @@ dependencyResolutionManagement {
library("logback", "ch.qos.logback", "logback-classic").version("1.4.5") library("logback", "ch.qos.logback", "logback-classic").version("1.4.5")
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_66") library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_67")
library("protobuf", "com.google.protobuf", "protobuf-javalite").version("3.22.0") library("protobuf", "com.google.protobuf", "protobuf-javalite").version("3.22.0")
library("sqlite", "org.xerial", "sqlite-jdbc").version("3.40.1.0") library("sqlite", "org.xerial", "sqlite-jdbc").version("3.40.1.0")
library("hikari", "com.zaxxer", "HikariCP").version("5.0.1") library("hikari", "com.zaxxer", "HikariCP").version("5.0.1")