mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Bump SDK bindings to 26.10.12-nightly (#7909)
* Bump SDK bindings to `26.10.12-nightly` * Fix API breaks in SDK bindings * Fix doc comment
This commit is contained in:
committed by
GitHub
parent
5104e044ff
commit
213ed22cad
@@ -186,7 +186,7 @@ test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version
|
||||
# it as a plain `require`: without this, a library built against a newer SDK would silently drag this app
|
||||
# onto it. With it, this pin always wins, and a library that needs something newer fails at configuration
|
||||
# time naming both versions instead of at runtime with NoSuchMethodError.
|
||||
matrix_sdk = { module = "org.matrix.rustcomponents:sdk-android", version = { strictly = "26.10.07-nightly" } }
|
||||
matrix_sdk = { module = "org.matrix.rustcomponents:sdk-android", version = { strictly = "26.10.12-nightly" } }
|
||||
rustls_platform_verifier = "org.rustls:rustls-platform-verifier:0.2.0"
|
||||
|
||||
# Others
|
||||
|
||||
+1
-1
@@ -410,7 +410,7 @@ interface MatrixClient : ClientUrlContentFetcher {
|
||||
|
||||
/**
|
||||
* Deactivates the account on the homeserver, then destroys this client and deletes every local trace of the session.
|
||||
* The password is only sent if the homeserver asks for re-authentication, and on failure the session is left untouched.
|
||||
* On failure the session is left untouched.
|
||||
*
|
||||
* @param password the account password, required to confirm the deactivation.
|
||||
* @param eraseData whether the homeserver should also erase the messages the user sent.
|
||||
|
||||
+5
@@ -123,6 +123,11 @@ interface EncryptionService {
|
||||
* A handle to reset the user's identity.
|
||||
*/
|
||||
sealed interface IdentityResetHandle {
|
||||
/**
|
||||
* The value of the session key given by the homeserver.
|
||||
*/
|
||||
val session: String
|
||||
|
||||
/**
|
||||
* Cancel the reset process and drops the existing handle in the SDK.
|
||||
*/
|
||||
|
||||
+4
-29
@@ -127,8 +127,6 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeout
|
||||
import org.matrix.rustcomponents.sdk.AuthData
|
||||
import org.matrix.rustcomponents.sdk.AuthDataPasswordDetails
|
||||
import org.matrix.rustcomponents.sdk.BeaconInfoListener
|
||||
import org.matrix.rustcomponents.sdk.BeaconInfoUpdate
|
||||
import org.matrix.rustcomponents.sdk.Client
|
||||
@@ -794,33 +792,10 @@ class RustMatrixClient(
|
||||
clientDelegateTaskHandle?.cancelAndDestroy()
|
||||
clientDelegateTaskHandle = null
|
||||
runCatchingExceptions {
|
||||
// First call without AuthData, should fail
|
||||
val firstAttempt = runCatchingExceptions {
|
||||
innerClient.deactivateAccount(
|
||||
authData = null,
|
||||
eraseData = eraseData,
|
||||
)
|
||||
}
|
||||
if (firstAttempt.isFailure) {
|
||||
Timber.w(firstAttempt.exceptionOrNull(), "Expected failure, try again")
|
||||
// This is expected, try again with the password
|
||||
runCatchingExceptions {
|
||||
innerClient.deactivateAccount(
|
||||
authData = AuthData.Password(
|
||||
passwordDetails = AuthDataPasswordDetails(
|
||||
identifier = sessionId.value,
|
||||
password = password,
|
||||
),
|
||||
),
|
||||
eraseData = eraseData,
|
||||
)
|
||||
}.onFailure {
|
||||
Timber.e(it, "Failed to deactivate account")
|
||||
// If the deactivation failed we need to restore the delegate
|
||||
clientDelegateTaskHandle = innerClient.setDelegate(sessionDelegate)
|
||||
throw it
|
||||
}
|
||||
}
|
||||
innerClient.deactivateAccount(
|
||||
password = password,
|
||||
eraseData = eraseData,
|
||||
)
|
||||
destroy()
|
||||
deleteSessionDirectory()
|
||||
sessionStore.removeSession(sessionId.value)
|
||||
|
||||
+9
-5
@@ -20,14 +20,14 @@ import org.matrix.rustcomponents.sdk.CrossSigningResetAuthType
|
||||
object RustIdentityResetHandleFactory {
|
||||
fun create(
|
||||
userId: UserId,
|
||||
identityResetHandle: org.matrix.rustcomponents.sdk.IdentityResetHandle?
|
||||
identityResetHandle: org.matrix.rustcomponents.sdk.IdentityResetHandle?,
|
||||
): Result<IdentityResetHandle?> {
|
||||
return runCatchingExceptions {
|
||||
identityResetHandle?.let {
|
||||
when (val authType = identityResetHandle.authType()) {
|
||||
is CrossSigningResetAuthType.OAuth -> RustIdentityOAuthResetHandle(identityResetHandle, authType.info.approvalUrl)
|
||||
is CrossSigningResetAuthType.OAuth -> RustIdentityOAuthResetHandle(identityResetHandle, authType.info.approvalUrl, authType.info.session)
|
||||
// User interactive authentication (user + password)
|
||||
CrossSigningResetAuthType.Uiaa -> RustPasswordIdentityResetHandle(userId, identityResetHandle)
|
||||
is CrossSigningResetAuthType.Uiaa -> RustPasswordIdentityResetHandle(userId, identityResetHandle, authType.info.session)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,9 +37,12 @@ object RustIdentityResetHandleFactory {
|
||||
class RustPasswordIdentityResetHandle(
|
||||
private val userId: UserId,
|
||||
private val identityResetHandle: org.matrix.rustcomponents.sdk.IdentityResetHandle,
|
||||
override val session: String,
|
||||
) : IdentityPasswordResetHandle {
|
||||
override suspend fun resetPassword(password: String): Result<Unit> {
|
||||
return runCatchingExceptions { identityResetHandle.reset(AuthData.Password(AuthDataPasswordDetails(userId.value, password))) }
|
||||
return runCatchingExceptions {
|
||||
identityResetHandle.reset(AuthData.Password(AuthDataPasswordDetails(userId.value, password, session)))
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun cancel() {
|
||||
@@ -50,9 +53,10 @@ class RustPasswordIdentityResetHandle(
|
||||
class RustIdentityOAuthResetHandle(
|
||||
private val identityResetHandle: org.matrix.rustcomponents.sdk.IdentityResetHandle,
|
||||
override val url: String,
|
||||
override val session: String,
|
||||
) : IdentityOAuthResetHandle {
|
||||
override suspend fun resetOAuth(): Result<Unit> {
|
||||
return runCatchingExceptions { identityResetHandle.reset(null) }
|
||||
return runCatchingExceptions { identityResetHandle.reset(AuthData.OAuth(session)) }
|
||||
}
|
||||
|
||||
override suspend fun cancel() {
|
||||
|
||||
+2
@@ -13,6 +13,7 @@ import io.element.android.libraries.matrix.api.encryption.IdentityPasswordResetH
|
||||
|
||||
class FakeIdentityOAuthResetHandle(
|
||||
override val url: String = "",
|
||||
override val session: String = "",
|
||||
var resetOAuthLambda: () -> Result<Unit> = { error("Not implemented") },
|
||||
var cancelLambda: () -> Unit = { error("Not implemented") },
|
||||
) : IdentityOAuthResetHandle {
|
||||
@@ -26,6 +27,7 @@ class FakeIdentityOAuthResetHandle(
|
||||
}
|
||||
|
||||
class FakeIdentityPasswordResetHandle(
|
||||
override val session: String = "",
|
||||
var resetPasswordLambda: (String) -> Result<Unit> = { _ -> error("Not implemented") },
|
||||
var cancelLambda: () -> Unit = { error("Not implemented") },
|
||||
) : IdentityPasswordResetHandle {
|
||||
|
||||
Reference in New Issue
Block a user