Make signed prekey generation happen through the job queue.

This commit is contained in:
Moxie Marlinspike
2014-10-21 10:39:25 -07:00
parent b568ce70b2
commit 4cdc0a3e61
3 changed files with 76 additions and 16 deletions

View File

@@ -29,6 +29,7 @@ import android.widget.ProgressBar;
import org.thoughtcrime.securesms.crypto.DecryptingQueue;
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob;
import org.thoughtcrime.securesms.notifications.MessageNotifier;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.textsecure.crypto.MasterSecret;
@@ -47,12 +48,15 @@ public class DatabaseUpgradeActivity extends Activity {
public static final int CURVE25519_VERSION = 63;
public static final int ASYMMETRIC_MASTER_SECRET_FIX_VERSION = 73;
public static final int NO_V1_VERSION = 83;
public static final int SIGNED_PREKEY_VERSION = 83;
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
add(TOFU_IDENTITIES_VERSION);
add(CURVE25519_VERSION);
add(ASYMMETRIC_MASTER_SECRET_FIX_VERSION);
add(NO_V1_VERSION);
add(SIGNED_PREKEY_VERSION);
}};
private MasterSecret masterSecret;
@@ -155,6 +159,12 @@ public class DatabaseUpgradeActivity extends Activity {
}
}
if (params[0] < SIGNED_PREKEY_VERSION) {
ApplicationContext.getInstance(getApplicationContext())
.getJobManager()
.add(new CreateSignedPreKeyJob(context, masterSecret));
}
return null;
}