Initialize pre key offsets when creating new account

This commit is contained in:
AsamK 2023-11-03 20:00:26 +01:00
parent b41ebfe6b8
commit 0014a69528

View file

@ -228,6 +228,7 @@ public class SignalAccount implements Closeable {
signalAccount.pniAccountData.setIdentityKeyPair(pniIdentityKey);
signalAccount.aciAccountData.setLocalRegistrationId(KeyHelper.generateRegistrationId(false));
signalAccount.pniAccountData.setLocalRegistrationId(KeyHelper.generateRegistrationId(false));
signalAccount.initAllPreKeyIds();
signalAccount.settings = settings;
signalAccount.registered = false;
@ -974,6 +975,13 @@ public class SignalAccount implements Closeable {
clearAllPreKeys(ServiceIdType.PNI);
}
private void initAllPreKeyIds() {
resetPreKeyOffsets(ServiceIdType.ACI);
resetPreKeyOffsets(ServiceIdType.PNI);
resetKyberPreKeyOffsets(ServiceIdType.ACI);
resetKyberPreKeyOffsets(ServiceIdType.PNI);
}
private void clearAllPreKeys(ServiceIdType serviceIdType) {
final var accountData = getAccountData(serviceIdType);
resetPreKeyOffsets(serviceIdType);