mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 22:43:52 +00:00
Clear all sender key knowledge for a device after a 409/410.
This commit is contained in:
@@ -12,8 +12,6 @@ import org.whispersystems.libsignal.state.IdentityKeyStore;
|
||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.PreKeyStore;
|
||||
import org.whispersystems.libsignal.state.SessionRecord;
|
||||
import org.whispersystems.libsignal.state.SessionStore;
|
||||
import org.whispersystems.libsignal.state.SignalProtocolStore;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||
import org.whispersystems.signalservice.api.SignalServiceProtocolStore;
|
||||
@@ -172,7 +170,7 @@ public class SignalProtocolStoreImpl implements SignalServiceProtocolStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSenderKeySharedWith(DistributionId distributionId, Collection<SignalProtocolAddress> addresses) {
|
||||
senderKeyStore.clearSenderKeySharedWith(distributionId, addresses);
|
||||
public void clearSenderKeySharedWith(Collection<SignalProtocolAddress> addresses) {
|
||||
senderKeyStore.clearSenderKeySharedWith(addresses);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ public final class SignalSenderKeyStore implements SignalServiceSenderKeyStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSenderKeySharedWith(DistributionId distributionId, Collection<SignalProtocolAddress> addresses) {
|
||||
public void clearSenderKeySharedWith(Collection<SignalProtocolAddress> addresses) {
|
||||
synchronized (LOCK) {
|
||||
DatabaseFactory.getSenderKeySharedDatabase(context).delete(distributionId, addresses);
|
||||
DatabaseFactory.getSenderKeySharedDatabase(context).deleteAllFor(addresses);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,26 @@ public class SenderKeySharedDatabase extends Database {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all shared statuses for a given recipientId.
|
||||
* Clear the shared status for all distributionIds for a set of addresses.
|
||||
*/
|
||||
public void deleteAllFor(@NonNull Collection<SignalProtocolAddress> addresses) {
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
String query = ADDRESS + " = ? AND " + DEVICE + " = ?";
|
||||
|
||||
db.beginTransaction();
|
||||
try {
|
||||
for (SignalProtocolAddress address : addresses) {
|
||||
db.delete(TABLE_NAME, query, SqlUtil.buildArgs(address.getName(), address.getDeviceId()));
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the shared status for all distributionIds for a given recipientId.
|
||||
*/
|
||||
public void deleteAllFor(@NonNull RecipientId recipientId) {
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
|
||||
@@ -252,7 +252,7 @@ public final class GroupSendUtil {
|
||||
allResults.addAll(results);
|
||||
|
||||
int successCount = (int) results.stream().filter(SendMessageResult::isSuccess).count();
|
||||
Log.d(TAG, "Successfully using 1:1 to " + successCount + "/" + targets.size() + " legacy targets.");
|
||||
Log.d(TAG, "Successfully sent using 1:1 to " + successCount + "/" + targets.size() + " legacy targets.");
|
||||
}
|
||||
|
||||
return allResults;
|
||||
|
||||
Reference in New Issue
Block a user