mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
Update libsignal-service
This commit is contained in:
parent
a9bb8d9aae
commit
e89803464b
11 changed files with 39 additions and 23 deletions
|
@ -29,7 +29,8 @@ class LiveConfig {
|
|||
private static final byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
|
||||
.decode("BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF");
|
||||
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 CDN_URL = "https://cdn.signal.org";
|
||||
|
@ -91,7 +92,7 @@ class LiveConfig {
|
|||
createDefaultServiceConfiguration(interceptors),
|
||||
getUnidentifiedSenderTrustRoot(),
|
||||
CDSI_MRENCLAVE,
|
||||
List.of(SVR2_MRENCLAVE));
|
||||
List.of(SVR2_MRENCLAVE, SVR2_MRENCLAVE_LEGACY));
|
||||
}
|
||||
|
||||
private LiveConfig() {
|
||||
|
|
|
@ -29,7 +29,8 @@ class StagingConfig {
|
|||
private static final byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
|
||||
.decode("BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx");
|
||||
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 CDN_URL = "https://cdn-staging.signal.org";
|
||||
|
@ -91,7 +92,7 @@ class StagingConfig {
|
|||
createDefaultServiceConfiguration(interceptors),
|
||||
getUnidentifiedSenderTrustRoot(),
|
||||
CDSI_MRENCLAVE,
|
||||
List.of(SVR2_MRENCLAVE));
|
||||
List.of(SVR2_MRENCLAVE, SVR2_MRENCLAVE_LEGACY));
|
||||
}
|
||||
|
||||
private StagingConfig() {
|
||||
|
|
|
@ -105,7 +105,7 @@ public class AccountHelper {
|
|||
if (!account.isPrimaryDevice() && account.getPniIdentityKeyPair() == null) {
|
||||
throw new IOException("Missing PNI identity key, relinking required");
|
||||
}
|
||||
if (account.getPreviousStorageVersion() < 4
|
||||
if (account.getPreviousStorageVersion() < 10
|
||||
&& account.isPrimaryDevice()
|
||||
&& account.getRegistrationLockPin() != null) {
|
||||
migrateRegistrationPin();
|
||||
|
|
|
@ -325,7 +325,8 @@ public class SignalDependencies {
|
|||
getKeysApi(),
|
||||
Optional.empty(),
|
||||
executor,
|
||||
ServiceConfig.MAX_ENVELOPE_SIZE));
|
||||
ServiceConfig.MAX_ENVELOPE_SIZE,
|
||||
() -> true));
|
||||
}
|
||||
|
||||
public List<SecureValueRecovery> getSecureValueRecovery() {
|
||||
|
|
|
@ -116,7 +116,7 @@ public class SignalAccount implements Closeable {
|
|||
private static final Logger logger = LoggerFactory.getLogger(SignalAccount.class);
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.asamk.signal.manager.storage.recipients.RecipientStore;
|
|||
import org.signal.libsignal.protocol.IdentityKey;
|
||||
import org.signal.libsignal.protocol.InvalidKeyException;
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore.Direction;
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore.IdentityChange;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
|
@ -62,11 +63,11 @@ public class IdentityKeyStore {
|
|||
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);
|
||||
}
|
||||
|
||||
public boolean saveIdentity(
|
||||
public IdentityChange saveIdentity(
|
||||
final Connection connection,
|
||||
final ServiceId serviceId,
|
||||
final IdentityKey identityKey
|
||||
|
@ -74,9 +75,9 @@ public class IdentityKeyStore {
|
|||
return saveIdentity(connection, serviceId.toString(), identityKey);
|
||||
}
|
||||
|
||||
boolean saveIdentity(final String address, final IdentityKey identityKey) {
|
||||
IdentityChange saveIdentity(final String address, final IdentityKey identityKey) {
|
||||
if (isRetryingDecryption) {
|
||||
return false;
|
||||
return IdentityChange.NEW_OR_UNCHANGED;
|
||||
}
|
||||
try (final var connection = database.getConnection()) {
|
||||
return saveIdentity(connection, address, identityKey);
|
||||
|
@ -85,20 +86,24 @@ public class IdentityKeyStore {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean saveIdentity(
|
||||
private IdentityChange saveIdentity(
|
||||
final Connection connection,
|
||||
final String address,
|
||||
final IdentityKey identityKey
|
||||
) throws SQLException {
|
||||
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
|
||||
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);
|
||||
return true;
|
||||
saveNewIdentity(connection, address, identityKey, false);
|
||||
return IdentityChange.REPLACED_EXISTING;
|
||||
}
|
||||
|
||||
public void setRetryingDecryption(final boolean retryingDecryption) {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SignalIdentityKeyStore implements org.signal.libsignal.protocol.sta
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
public IdentityChange saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
return identityKeyStore.saveIdentity(address.getName(), identityKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SignalProtocolStore implements SignalServiceAccountDataStore {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
public IdentityChange saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
return identityKeyStore.saveIdentity(address, identityKey);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue