Generate "prekeys" at push registration time.

This generates a large number of key exchange messages and
registers them with the server during signup.
This commit is contained in:
Moxie Marlinspike
2013-08-15 08:25:30 -07:00
parent cfb7b8fcba
commit 2042ca6cb7
25 changed files with 1015 additions and 109 deletions

View File

@@ -0,0 +1,16 @@
package org.whispersystems.textsecure.push;
import java.util.List;
public class PreKeyList {
private List<String> keys;
public PreKeyList(List<String> keys) {
this.keys = keys;
}
public List<String> getKeys() {
return keys;
}
}

View File

@@ -39,6 +39,7 @@ public class PushServiceSocket {
private static final String CREATE_ACCOUNT_VOICE_PATH = "/v1/accounts/voice/%s";
private static final String VERIFY_ACCOUNT_PATH = "/v1/accounts/code/%s";
private static final String REGISTER_GCM_PATH = "/v1/accounts/gcm/";
private static final String PREKEY_PATH = "/v1/keys/";
private static final String DIRECTORY_PATH = "/v1/directory/";
private static final String MESSAGE_PATH = "/v1/messages/";
@@ -105,6 +106,11 @@ public class PushServiceSocket {
throw new IOException("Got send failure: " + response.getFailure().get(0));
}
public void registerPreKeys(PreKeyList keys) throws IOException {
makeRequest(PREKEY_PATH, "PUT", new Gson().toJson(keys));
}
private List<PushAttachmentPointer> sendAttachments(List<PushAttachmentData> attachments)
throws IOException
{