mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-14 12:10:36 +01:00
Support for verification tokens
// FREEBIE
This commit is contained in:
@@ -235,6 +235,10 @@ public class TextSecureAccountManager {
|
||||
return activeTokens;
|
||||
}
|
||||
|
||||
public String getAccountVerificationToken() throws IOException {
|
||||
return this.pushServiceSocket.getAccountVerificationToken();
|
||||
}
|
||||
|
||||
public String getNewDeviceVerificationCode() throws IOException {
|
||||
return this.pushServiceSocket.getNewDeviceVerificationCode();
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package org.whispersystems.textsecure.internal.push;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class AuthorizationToken {
|
||||
|
||||
@JsonProperty
|
||||
private String token;
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ public class PushServiceSocket {
|
||||
private static final String VERIFY_ACCOUNT_CODE_PATH = "/v1/accounts/code/%s";
|
||||
private static final String VERIFY_ACCOUNT_TOKEN_PATH = "/v1/accounts/token/%s";
|
||||
private static final String REGISTER_GCM_PATH = "/v1/accounts/gcm/";
|
||||
private static final String REQUEST_TOKEN_PATH = "/v1/accounts/token";
|
||||
|
||||
private static final String PREKEY_METADATA_PATH = "/v2/keys/";
|
||||
private static final String PREKEY_PATH = "/v2/keys/%s";
|
||||
@@ -135,6 +136,11 @@ public class PushServiceSocket {
|
||||
"PUT", JsonUtil.toJson(signalingKeyEntity));
|
||||
}
|
||||
|
||||
public String getAccountVerificationToken() throws IOException {
|
||||
String responseText = makeRequest(REQUEST_TOKEN_PATH, "GET", null);
|
||||
return JsonUtil.fromJson(responseText, AuthorizationToken.class).getToken();
|
||||
}
|
||||
|
||||
public String getNewDeviceVerificationCode() throws IOException {
|
||||
String responseText = makeRequest(PROVISIONING_CODE_PATH, "GET", null);
|
||||
return JsonUtil.fromJson(responseText, DeviceCode.class).getVerificationCode();
|
||||
|
||||
Reference in New Issue
Block a user