mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Bump to libsignal v0.71.0.
This commit is contained in:
committed by
Michelle Tang
parent
a2a3dd28ee
commit
9b9888565b
@@ -63,8 +63,12 @@ public class SignalBaseIdentityKeyStore {
|
||||
return SignalStore.account().getRegistrationId();
|
||||
}
|
||||
|
||||
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
return saveIdentity(address, identityKey, false) == SaveResult.UPDATE;
|
||||
public IdentityKeyStore.IdentityChange saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
switch (saveIdentity(address, identityKey, false)) {
|
||||
case NEW, NO_CHANGE, NON_BLOCKING_APPROVAL_REQUIRED -> { return IdentityKeyStore.IdentityChange.NEW_OR_UNCHANGED; }
|
||||
case UPDATE -> { return IdentityKeyStore.IdentityChange.REPLACED_EXISTING; }
|
||||
}
|
||||
throw new AssertionError("unhandled save result");
|
||||
}
|
||||
|
||||
public @NonNull SaveResult saveIdentity(SignalProtocolAddress address, IdentityKey identityKey, boolean nonBlockingApproval) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SignalIdentityKeyStore implements IdentityKeyStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
public IdentityChange saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
return baseStore.saveIdentity(address, identityKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class SignalServiceAccountDataStoreImpl implements SignalServiceAccountDa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
public IdentityChange saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
|
||||
return identityKeyStore.saveIdentity(address, identityKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.signal.libsignal.protocol.IdentityKey
|
||||
import org.signal.libsignal.protocol.IdentityKeyPair
|
||||
import org.signal.libsignal.protocol.SignalProtocolAddress
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore.IdentityChange
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountDataStore
|
||||
import org.whispersystems.signalservice.api.push.ServiceId
|
||||
@@ -30,16 +31,16 @@ class BufferedIdentityKeyStore(
|
||||
return selfRegistrationId
|
||||
}
|
||||
|
||||
override fun saveIdentity(address: SignalProtocolAddress, identityKey: IdentityKey): Boolean {
|
||||
override fun saveIdentity(address: SignalProtocolAddress, identityKey: IdentityKey): IdentityChange {
|
||||
val existing: IdentityKey? = getIdentity(address)
|
||||
|
||||
store[address] = identityKey
|
||||
|
||||
return if (identityKey != existing) {
|
||||
updatedKeys[address] = identityKey
|
||||
true
|
||||
IdentityChange.REPLACED_EXISTING
|
||||
} else {
|
||||
false
|
||||
IdentityChange.NEW_OR_UNCHANGED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.signal.libsignal.protocol.IdentityKeyPair
|
||||
import org.signal.libsignal.protocol.SignalProtocolAddress
|
||||
import org.signal.libsignal.protocol.groups.state.SenderKeyRecord
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore.IdentityChange
|
||||
import org.signal.libsignal.protocol.state.KyberPreKeyRecord
|
||||
import org.signal.libsignal.protocol.state.PreKeyRecord
|
||||
import org.signal.libsignal.protocol.state.SessionRecord
|
||||
@@ -41,7 +42,7 @@ class BufferedSignalServiceAccountDataStore(selfServiceId: ServiceId) : SignalSe
|
||||
return identityStore.localRegistrationId
|
||||
}
|
||||
|
||||
override fun saveIdentity(address: SignalProtocolAddress, identityKey: IdentityKey): Boolean {
|
||||
override fun saveIdentity(address: SignalProtocolAddress, identityKey: IdentityKey): IdentityChange {
|
||||
return identityStore.saveIdentity(address, identityKey)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.signal.core.util.logging.Log;
|
||||
import org.signal.libsignal.protocol.IdentityKey;
|
||||
import org.signal.libsignal.protocol.InvalidKeyException;
|
||||
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore;
|
||||
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||
import org.signal.libsignal.protocol.state.SessionStore;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
@@ -172,7 +173,7 @@ public final class IdentityUtil {
|
||||
SessionStore sessionStore = AppDependencies.getProtocolStore().aci();
|
||||
SignalProtocolAddress address = new SignalProtocolAddress(user, SignalServiceAddress.DEFAULT_DEVICE_ID);
|
||||
|
||||
if (AppDependencies.getProtocolStore().aci().identities().saveIdentity(address, identityKey)) {
|
||||
if (AppDependencies.getProtocolStore().aci().identities().saveIdentity(address, identityKey) == IdentityKeyStore.IdentityChange.REPLACED_EXISTING) {
|
||||
if (sessionStore.containsSession(address)) {
|
||||
SessionRecord sessionRecord = sessionStore.loadSession(address);
|
||||
sessionRecord.archiveCurrentState();
|
||||
|
||||
Reference in New Issue
Block a user