mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 19:03:39 +00:00
Catch bad prekeys
This commit is contained in:
parent
327ee4ff62
commit
72be77b47e
@ -5,6 +5,7 @@ import android.util.Log;
|
|||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
|
||||||
import com.google.thoughtcrimegson.Gson;
|
import com.google.thoughtcrimegson.Gson;
|
||||||
|
import com.google.thoughtcrimegson.JsonParseException;
|
||||||
|
|
||||||
import org.apache.http.conn.ssl.StrictHostnameVerifier;
|
import org.apache.http.conn.ssl.StrictHostnameVerifier;
|
||||||
import org.whispersystems.textsecure.crypto.IdentityKey;
|
import org.whispersystems.textsecure.crypto.IdentityKey;
|
||||||
@ -149,15 +150,20 @@ public class PushServiceSocket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PreKeyEntity getPreKey(PushDestination destination) throws IOException {
|
public PreKeyEntity getPreKey(PushDestination destination) throws IOException {
|
||||||
String path = String.format(PREKEY_PATH, destination.getNumber());
|
try {
|
||||||
|
String path = String.format(PREKEY_PATH, destination.getNumber());
|
||||||
|
|
||||||
if (!Util.isEmpty(destination.getRelay())) {
|
if (!Util.isEmpty(destination.getRelay())) {
|
||||||
path = path + "?relay=" + destination.getRelay();
|
path = path + "?relay=" + destination.getRelay();
|
||||||
|
}
|
||||||
|
|
||||||
|
String responseText = makeRequest(path, "GET", null);
|
||||||
|
Log.w("PushServiceSocket", "Got prekey: " + responseText);
|
||||||
|
return PreKeyEntity.fromJson(responseText);
|
||||||
|
} catch (JsonParseException e) {
|
||||||
|
Log.w("PushServiceSocket", e);
|
||||||
|
throw new IOException("Bad prekey");
|
||||||
}
|
}
|
||||||
|
|
||||||
String responseText = makeRequest(path, "GET", null);
|
|
||||||
Log.w("PushServiceSocket", "Got prekey: " + responseText);
|
|
||||||
return PreKeyEntity.fromJson(responseText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long sendAttachment(PushAttachmentData attachment) throws IOException {
|
public long sendAttachment(PushAttachmentData attachment) throws IOException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user