Bump to libsignal v0.88.0.

This commit is contained in:
andrew-signal
2026-03-03 11:02:30 -05:00
committed by Greyson Parrelli
parent da966753a1
commit 3af8b6050c
5 changed files with 37 additions and 105 deletions

View File

@@ -1,18 +1,8 @@
package org.thoughtcrime.securesms.dependencies package org.thoughtcrime.securesms.dependencies
import org.signal.libsignal.internal.mapWithCancellation
import org.signal.libsignal.keytrans.KeyTransparencyException import org.signal.libsignal.keytrans.KeyTransparencyException
import org.signal.libsignal.keytrans.VerificationFailedException
import org.signal.libsignal.net.AppExpiredException
import org.signal.libsignal.net.BadRequestError
import org.signal.libsignal.net.ChatServiceException
import org.signal.libsignal.net.KeyTransparency import org.signal.libsignal.net.KeyTransparency
import org.signal.libsignal.net.NetworkException
import org.signal.libsignal.net.NetworkProtocolException
import org.signal.libsignal.net.RequestResult import org.signal.libsignal.net.RequestResult
import org.signal.libsignal.net.RetryLaterException
import org.signal.libsignal.net.ServerSideErrorException
import org.signal.libsignal.net.TimeoutException
import org.signal.libsignal.net.getOrError import org.signal.libsignal.net.getOrError
import org.signal.libsignal.protocol.IdentityKey import org.signal.libsignal.protocol.IdentityKey
import org.signal.libsignal.protocol.ServiceId import org.signal.libsignal.protocol.ServiceId
@@ -27,69 +17,18 @@ class KeyTransparencyApi(private val unauthWebSocket: SignalWebSocket.Unauthenti
/** /**
* Uses KT to verify recipient. This is an unauthenticated and should only be called the first time KT is being requested for this recipient. * Uses KT to verify recipient. This is an unauthenticated and should only be called the first time KT is being requested for this recipient.
*/ */
suspend fun search(aci: ServiceId.Aci, aciIdentityKey: IdentityKey, e164: String?, unidentifiedAccessKey: ByteArray?, usernameHash: ByteArray?, keyTransparencyStore: KeyTransparencyStore): RequestResult<Unit, KeyTransparencyError> { suspend fun search(aci: ServiceId.Aci, aciIdentityKey: IdentityKey, e164: String?, unidentifiedAccessKey: ByteArray?, usernameHash: ByteArray?, keyTransparencyStore: KeyTransparencyStore): RequestResult<Unit, KeyTransparencyException> {
return unauthWebSocket.runCatchingWithUnauthChatConnection { chatConnection -> return unauthWebSocket.runCatchingWithUnauthChatConnection { chatConnection ->
chatConnection.keyTransparencyClient().search(aci, aciIdentityKey, e164, unidentifiedAccessKey, usernameHash, keyTransparencyStore) chatConnection.keyTransparencyClient().search(aci, aciIdentityKey, e164, unidentifiedAccessKey, usernameHash, keyTransparencyStore)
.mapWithCancellation(
onSuccess = { RequestResult.Success(Unit) },
onError = { throwable ->
when (throwable) {
is VerificationFailedException,
is KeyTransparencyException,
is AppExpiredException,
is IllegalArgumentException -> {
RequestResult.NonSuccess(KeyTransparencyError(throwable))
}
is ChatServiceException,
is NetworkException,
is NetworkProtocolException -> {
RequestResult.RetryableNetworkError(throwable, null)
}
is RetryLaterException -> {
RequestResult.RetryableNetworkError(throwable, throwable.duration)
}
else -> {
RequestResult.ApplicationError(throwable)
}
}
}
)
}.getOrError() }.getOrError()
} }
/** /**
* Monitors KT to verify recipient. This is an unauthenticated and should only be called following a successful [search]. * Monitors KT to verify recipient. This is an unauthenticated and should only be called following a successful [search].
*/ */
suspend fun monitor(monitorMode: KeyTransparency.MonitorMode, aci: ServiceId.Aci, aciIdentityKey: IdentityKey, e164: String?, unidentifiedAccessKey: ByteArray?, usernameHash: ByteArray?, keyTransparencyStore: KeyTransparencyStore): RequestResult<Unit, KeyTransparencyError> { suspend fun monitor(monitorMode: KeyTransparency.MonitorMode, aci: ServiceId.Aci, aciIdentityKey: IdentityKey, e164: String?, unidentifiedAccessKey: ByteArray?, usernameHash: ByteArray?, keyTransparencyStore: KeyTransparencyStore): RequestResult<Unit, KeyTransparencyException> {
return unauthWebSocket.runCatchingWithUnauthChatConnection { chatConnection -> return unauthWebSocket.runCatchingWithUnauthChatConnection { chatConnection ->
chatConnection.keyTransparencyClient().monitor(monitorMode, aci, aciIdentityKey, e164, unidentifiedAccessKey, usernameHash, keyTransparencyStore) chatConnection.keyTransparencyClient().monitor(monitorMode, aci, aciIdentityKey, e164, unidentifiedAccessKey, usernameHash, keyTransparencyStore)
.mapWithCancellation(
onSuccess = { RequestResult.Success(Unit) },
onError = { throwable ->
when (throwable) {
is TimeoutException,
is ServerSideErrorException,
is NetworkException,
is NetworkProtocolException -> {
RequestResult.RetryableNetworkError(throwable, null)
}
is RetryLaterException -> {
RequestResult.RetryableNetworkError(throwable, throwable.duration)
}
is VerificationFailedException,
is KeyTransparencyException,
is AppExpiredException,
is IllegalArgumentException -> {
RequestResult.NonSuccess(KeyTransparencyError(throwable))
}
else -> {
RequestResult.ApplicationError(throwable)
}
}
}
)
}.getOrError() }.getOrError()
} }
} }
data class KeyTransparencyError(val exception: Throwable) : BadRequestError

View File

@@ -1,9 +1,6 @@
package org.thoughtcrime.securesms.jobs package org.thoughtcrime.securesms.jobs
import org.signal.core.util.logging.Log import org.signal.core.util.logging.Log
import org.signal.libsignal.keytrans.KeyTransparencyException
import org.signal.libsignal.keytrans.VerificationFailedException
import org.signal.libsignal.net.AppExpiredException
import org.signal.libsignal.net.KeyTransparency import org.signal.libsignal.net.KeyTransparency
import org.signal.libsignal.net.RequestResult import org.signal.libsignal.net.RequestResult
import org.signal.libsignal.usernames.Username import org.signal.libsignal.usernames.Username
@@ -142,28 +139,15 @@ class CheckKeyTransparencyJob private constructor(
} }
is RequestResult.NonSuccess -> { is RequestResult.NonSuccess -> {
if (result.error.exception is IllegalArgumentException) { if (!showFailure) {
Log.w(TAG, "KT store was corrupted. Restarting and then retrying.") Log.w(TAG, "Verification failure. Enqueuing this job again to run again a day.")
SignalStore.account.distinguishedHead = null StorageSyncJob.forRemoteChange()
SignalDatabase.recipients.clearSelfKeyTransparencyData() enqueueFollowingFailure()
Result.retry(defaultBackoff())
} else if (result.error.exception is VerificationFailedException || result.error.exception is KeyTransparencyException) {
if (!showFailure) {
Log.w(TAG, "Verification failure. Enqueuing this job again to run again a day.")
StorageSyncJob.forRemoteChange()
enqueueFollowingFailure()
} else {
Log.w(TAG, "Second verification failure. Showing failure sheet.")
markFailure()
}
Result.failure()
} else if (result.error.exception is AppExpiredException) {
Result.failure()
} else { } else {
Log.w(TAG, "Unknown nonsuccess failure. Showing failure sheet.") Log.w(TAG, "Second verification failure. Showing failure sheet.")
markFailure() markFailure()
Result.failure()
} }
Result.failure()
} }
is RequestResult.RetryableNetworkError -> { is RequestResult.RetryableNetworkError -> {
if (result.retryAfter != null) { if (result.retryAfter != null) {
@@ -173,9 +157,16 @@ class CheckKeyTransparencyJob private constructor(
} }
} }
is RequestResult.ApplicationError -> { is RequestResult.ApplicationError -> {
Log.w(TAG, "Unknown application failure. Showing failure sheet.") if (result.cause is IllegalArgumentException) {
markFailure() Log.w(TAG, "KT store was corrupted. Restarting and then retrying.")
Result.failure() SignalStore.account.distinguishedHead = null
SignalDatabase.recipients.clearSelfKeyTransparencyData()
Result.retry(defaultBackoff())
} else {
Log.w(TAG, "Unknown application failure. Showing failure sheet.")
markFailure()
Result.failure()
}
} }
} }
} }

View File

@@ -50,11 +50,7 @@ object VerifySafetyNumberRepository {
VerifyResult.Success VerifyResult.Success
} }
is RequestResult.NonSuccess -> { is RequestResult.NonSuccess -> {
if (result.error.exception is IllegalArgumentException) { VerifyResult.UnretryableFailure
VerifyResult.CorruptedFailure
} else {
VerifyResult.UnretryableFailure
}
} }
is RequestResult.RetryableNetworkError -> { is RequestResult.RetryableNetworkError -> {
if (result.retryAfter != null) { if (result.retryAfter != null) {
@@ -63,7 +59,13 @@ object VerifySafetyNumberRepository {
VerifyResult.UnretryableFailure VerifyResult.UnretryableFailure
} }
} }
is RequestResult.ApplicationError -> VerifyResult.UnretryableFailure is RequestResult.ApplicationError -> {
if (result.cause is IllegalArgumentException) {
VerifyResult.CorruptedFailure
} else {
VerifyResult.UnretryableFailure
}
}
} }
} }

View File

@@ -26,7 +26,7 @@ androidx-navigation = "2.8.5"
androidx-navigation3-core = "1.0.0" androidx-navigation3-core = "1.0.0"
androidx-window = "1.3.0" androidx-window = "1.3.0"
glide = "4.15.1" glide = "4.15.1"
libsignal-client = "0.87.5" libsignal-client = "0.88.0"
mp4parser = "1.9.39" mp4parser = "1.9.39"
accompanist = "0.28.0" accompanist = "0.28.0"
nanohttpd = "2.3.1" nanohttpd = "2.3.1"

View File

@@ -16740,20 +16740,20 @@ https://docs.gradle.org/current/userguide/dependency_verification.html
<sha256 value="57b3cf8f247f1990211110734a7d1af413db145c8f17eb1b2cdc9b9321188c2b" origin="Generated by Gradle"/> <sha256 value="57b3cf8f247f1990211110734a7d1af413db145c8f17eb1b2cdc9b9321188c2b" origin="Generated by Gradle"/>
</artifact> </artifact>
</component> </component>
<component group="org.signal" name="libsignal-android" version="0.87.5"> <component group="org.signal" name="libsignal-android" version="0.88.0">
<artifact name="libsignal-android-0.87.5.aar"> <artifact name="libsignal-android-0.88.0.aar">
<sha256 value="714f8e8a14180d826ae46be84ea55264cd1d2a10612bd22e59b061891afcbf16" origin="Generated by Gradle"/> <sha256 value="6c7e59c024e8803ce3883579defa50802928f9ae9fb8665c7cd413bb76f9acb6" origin="Generated by Gradle"/>
</artifact> </artifact>
<artifact name="libsignal-android-0.87.5.module"> <artifact name="libsignal-android-0.88.0.module">
<sha256 value="cfffa97026659d0a598390dadc5ac53e7eaa6e07e3a532dd3ebe7c16d4e025a5" origin="Generated by Gradle"/> <sha256 value="99e9aa1080b203927549076d58f7b7a164aceaf79bf106f2e39f8b2e5837e661" origin="Generated by Gradle"/>
</artifact> </artifact>
</component> </component>
<component group="org.signal" name="libsignal-client" version="0.87.5"> <component group="org.signal" name="libsignal-client" version="0.88.0">
<artifact name="libsignal-client-0.87.5.jar"> <artifact name="libsignal-client-0.88.0.jar">
<sha256 value="2223a56d247a3d3353676b995d11ce820dd366bd73145c4396f6090813beb05d" origin="Generated by Gradle"/> <sha256 value="a2e0e29f6e2ee1fadf8ad370e6fe6cf8e0827ff1047fa740f62e39a62ebd1a86" origin="Generated by Gradle"/>
</artifact> </artifact>
<artifact name="libsignal-client-0.87.5.module"> <artifact name="libsignal-client-0.88.0.module">
<sha256 value="3d1a333c3d4917377dd2a511b35f9ac06e2addf0b902c51ab4b5e23e515b343b" origin="Generated by Gradle"/> <sha256 value="9d54da38499901b2c0b641583710af9a5d74bc719b0e906722903f0b9db14e96" origin="Generated by Gradle"/>
</artifact> </artifact>
</component> </component>
<component group="org.signal" name="ringrtc-android" version="2.65.3"> <component group="org.signal" name="ringrtc-android" version="2.65.3">