Remove previous prekeys when importing legacy prekeys

This commit is contained in:
AsamK 2025-03-16 12:18:59 +01:00
parent b92cbc6a7c
commit 7aede7c17f

View file

@ -829,6 +829,7 @@ public class SignalAccount implements Closeable {
logger.debug("Migrating legacy pre key store.");
for (var entry : legacySignalProtocolStore.getLegacyPreKeyStore().getPreKeys().entrySet()) {
try {
aciAccountData.getPreKeyStore().removeAllPreKeys();
aciAccountData.getPreKeyStore().storePreKey(entry.getKey(), new PreKeyRecord(entry.getValue()));
} catch (InvalidMessageException e) {
logger.warn("Failed to migrate pre key, ignoring", e);
@ -840,6 +841,7 @@ public class SignalAccount implements Closeable {
logger.debug("Migrating legacy signed pre key store.");
for (var entry : legacySignalProtocolStore.getLegacySignedPreKeyStore().getSignedPreKeys().entrySet()) {
try {
aciAccountData.getSignedPreKeyStore().removeAllSignedPreKeys();
aciAccountData.getSignedPreKeyStore()
.storeSignedPreKey(entry.getKey(), new SignedPreKeyRecord(entry.getValue()));
} catch (InvalidMessageException e) {