Move prekey jsonifcation into the push code, add identity key.

This commit is contained in:
Moxie Marlinspike
2013-08-17 19:06:04 -07:00
parent b8f663b69c
commit 499de2d2bf
11 changed files with 134 additions and 65 deletions

View File

@@ -13,6 +13,8 @@ import android.util.Pair;
import com.google.android.gcm.GCMRegistrar;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
import org.whispersystems.textsecure.crypto.IdentityKey;
import org.whispersystems.textsecure.crypto.MasterSecret;
import org.whispersystems.textsecure.crypto.PreKeyUtil;
import org.whispersystems.textsecure.storage.PreKeyRecord;
@@ -268,8 +270,9 @@ public class RegistrationService extends Service {
throws GcmRegistrationTimeoutException, IOException
{
setState(new RegistrationState(RegistrationState.STATE_GENERATING_KEYS, number));
List<PreKeyRecord> records = waitForPreKeys(masterSecret);
socket.registerPreKeys(PreKeyUtil.toJson(records));
IdentityKey identityKey = IdentityKeyUtil.getIdentityKey(this);
List<PreKeyRecord> records = waitForPreKeys(masterSecret);
socket.registerPreKeys(identityKey, records);
setState(new RegistrationState(RegistrationState.STATE_GCM_REGISTERING, number));
GCMRegistrar.register(this, GcmIntentService.GCM_SENDER_ID);