From f1ccfc036130a0bdbac0ad77fb85a10db5a30215 Mon Sep 17 00:00:00 2001 From: AsamK Date: Fri, 3 Nov 2023 20:00:26 +0100 Subject: [PATCH] Initialize pre key offsets when creating new account --- .../org/asamk/signal/manager/storage/SignalAccount.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java b/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java index 2d33555d..1b501331 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java @@ -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);