From: AsamK Date: Sun, 20 Feb 2022 09:03:19 +0000 (+0100) Subject: Prevent preKeyIds from starting at zero X-Git-Tag: v0.10.4~3 X-Git-Url: https://git.nmode.ca/signal-cli/commitdiff_plain/2c44b65e9fcbc91652a0c8de614698545f5c2722?hp=1ffb6d69075ea4b02047d65b2b9637da70e7cfcc Prevent preKeyIds from starting at zero --- 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 87be95b4..bbd9944c 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 @@ -103,8 +103,8 @@ public class SignalAccount implements Closeable { private StorageKey storageKey; private long storageManifestVersion = -1; private ProfileKey profileKey; - private int preKeyIdOffset; - private int nextSignedPreKeyId; + private int preKeyIdOffset = 1; + private int nextSignedPreKeyId = 1; private IdentityKeyPair identityKeyPair; private int localRegistrationId; private TrustNewIdentity trustNewIdentity; @@ -479,14 +479,14 @@ public class SignalAccount implements Closeable { storageManifestVersion = rootNode.get("storageManifestVersion").asLong(); } if (rootNode.hasNonNull("preKeyIdOffset")) { - preKeyIdOffset = rootNode.get("preKeyIdOffset").asInt(0); + preKeyIdOffset = rootNode.get("preKeyIdOffset").asInt(1); } else { - preKeyIdOffset = 0; + preKeyIdOffset = 1; } if (rootNode.hasNonNull("nextSignedPreKeyId")) { - nextSignedPreKeyId = rootNode.get("nextSignedPreKeyId").asInt(); + nextSignedPreKeyId = rootNode.get("nextSignedPreKeyId").asInt(1); } else { - nextSignedPreKeyId = 0; + nextSignedPreKeyId = 1; } if (rootNode.hasNonNull("profileKey")) { try {