Compare commits

...

5 Commits

Author SHA1 Message Date
Greyson Parrelli
e97a5dc182 Bump version to 6.26.5 2023-07-27 17:53:08 -04:00
Greyson Parrelli
6bcced3721 Fix a RRP recovery path. 2023-07-27 17:52:14 -04:00
Cody Henthorne
859efab038 Bump version to v6.26.4 2023-07-24 19:18:40 -04:00
Greyson Parrelli
c09ae9a234 Ensure we use SVR2 endpoint for checking RRP. 2023-07-24 17:48:34 -04:00
Nicholas Tinsley
0d57005606 Clear click listener after view is recycled.
Fixes #13070
2023-07-24 16:38:11 -04:00
5 changed files with 56 additions and 14 deletions

View File

@@ -46,14 +46,14 @@ ktlint {
}
def canonicalVersionCode = 1293
def canonicalVersionName = "6.26.3"
def canonicalVersionName = "6.26.5"
def postFixSize = 100
def abiPostFix = ['universal' : 0,
'armeabi-v7a' : 1,
'arm64-v8a' : 2,
'x86' : 3,
'x86_64' : 4]
def abiPostFix = ['universal' : 10,
'armeabi-v7a' : 11,
'arm64-v8a' : 12,
'x86' : 13,
'x86_64' : 14]
def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties') ]

View File

@@ -492,6 +492,8 @@ open class ContactSearchAdapter(
if (isEnabled(model)) {
itemView.setOnClickListener { onClick.onClicked(avatar, getData(model), isSelected(model)) }
bindLongPress(model)
} else {
itemView.setOnClickListener(null)
}
bindCheckbox(model)

View File

@@ -31,7 +31,6 @@ import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.signalservice.api.SvrNoDataException;
import org.whispersystems.signalservice.api.kbs.MasterKey;
import org.whispersystems.signalservice.api.kbs.PinHashUtil;
import org.whispersystems.signalservice.api.push.ServiceIdType;
import org.whispersystems.signalservice.api.push.exceptions.IncorrectCodeException;
import org.whispersystems.signalservice.api.push.exceptions.IncorrectRegistrationRecoveryPasswordException;
import org.whispersystems.signalservice.internal.ServiceResponse;
@@ -346,12 +345,12 @@ public final class RegistrationViewModel extends BaseRegistrationViewModel {
if (hasRecoveryPassword) {
return Single.just(true);
} else {
return checkForValidKbsAuthCredentials();
return checkForValidSvrAuthCredentials();
}
});
}
private Single<Boolean> checkForValidKbsAuthCredentials() {
private Single<Boolean> checkForValidSvrAuthCredentials() {
final List<String> svrAuthTokenList = SignalStore.svr().getAuthTokenList();
List<String> usernamePasswords = svrAuthTokenList
.stream()
@@ -370,7 +369,14 @@ public final class RegistrationViewModel extends BaseRegistrationViewModel {
}
return registrationRepository.getSvrAuthCredential(getRegistrationData(), usernamePasswords)
.flatMap(p -> Single.just(p.getValid() != null))
.flatMap(p -> {
if (p.hasValidSvr2AuthCredential()) {
setSvrAuthCredentials(new SvrAuthCredentialSet(null, p.requireSvr2AuthCredential()));
return Single.just(true);
} else {
return Single.just(false);
}
})
.onErrorReturnItem(false)
.observeOn(AndroidSchedulers.mainThread());
}

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonCreator
import okio.ByteString.Companion.encode
import org.whispersystems.signalservice.internal.ServiceResponse
import org.whispersystems.signalservice.internal.ServiceResponseProcessor
import java.io.IOException
import java.nio.charset.StandardCharsets
/**
@@ -23,13 +24,30 @@ data class BackupAuthCheckResponse @JsonCreator constructor(
) {
private val actualMatches = matches["matches"] ?: emptyMap()
val match: String? = actualMatches.entries.firstOrNull { it.value.toString() == "match" }?.key?.toBasic()
val match: AuthCredentials? = actualMatches.entries.firstOrNull { it.value.toString() == "match" }?.key?.toAuthCredential()
val invalid: List<String> = actualMatches.filterValues { it.toString() == "invalid" }.keys.map { it.toBasic() }
/** Server expects and returns values as <username>:<password> but we prefer the full encoded Basic auth header format */
private fun String.toBasic(): String {
return "Basic ${encode(StandardCharsets.ISO_8859_1).base64()}"
}
private fun String.toAuthCredential(): AuthCredentials {
val firstColonIndex = this.indexOf(":")
if (firstColonIndex < 0) {
throw IOException("Invalid credential returned!")
}
val username = this.substring(0, firstColonIndex)
val password = this.substring(firstColonIndex + 1)
return AuthCredentials.create(username, password)
}
fun merge(other: BackupAuthCheckResponse): BackupAuthCheckResponse {
return BackupAuthCheckResponse(this.matches + other.matches)
}
}
/**
@@ -40,7 +58,11 @@ class BackupAuthCheckProcessor(response: ServiceResponse<BackupAuthCheckResponse
return response.result.map { it.invalid }.orElse(emptyList())
}
fun getValid(): String? {
return response.result.map { it.match }.orElse(null)
fun hasValidSvr2AuthCredential(): Boolean {
return response.result.map { it.match }.orElse(null) != null
}
fun requireSvr2AuthCredential(): AuthCredentials {
return response.result.get().match!!
}
}

View File

@@ -297,7 +297,7 @@ public class PushServiceSocket {
private static final String REPORT_SPAM = "/v1/messages/report/%s/%s";
private static final String BACKUP_AUTH_CHECK = "/v1/backup/auth/check";
private static final String BACKUP_AUTH_CHECK = "/v2/backup/auth/check";
private static final String CALL_LINK_CREATION_AUTH = "/v1/call-link/create-auth";
private static final String SERVER_DELIVERED_TIMESTAMP_HEADER = "X-Signal-Timestamp";
@@ -986,6 +986,18 @@ public class PushServiceSocket {
.onErrorReturn(ServiceResponse::forUnknownError);
}
private Single<ServiceResponse<BackupAuthCheckResponse>> createBackupAuthCheckSingle(@Nonnull String path,
@Nonnull BackupAuthCheckRequest request,
@Nonnull ResponseMapper<BackupAuthCheckResponse> responseMapper)
{
return Single.fromCallable(() -> {
try (Response response = getServiceConnection(path, "POST", jsonRequestBody(JsonUtil.toJson(request)), Collections.emptyMap(), Optional.empty(), false)) {
String body = response.body() != null ? readBodyString(response.body()): "";
return responseMapper.map(response.code(), body, response::header, false);
}
});
}
/**
* GET /v1/accounts/username_hash/{usernameHash}
*