Implement user verification (#4294)
* Add support for starting verification of a user * Add support for replying to incoming user verification requests * Add reset recovery key button and previews to `ChooseSelfVerificationModeView` * Add 'Profile' item in room details screen * Update screenshots * Remove `showDeviceVerifiedScreen` parameter from `NavTarget.UseAnotherDevice` * Allow exiting the FTUE flow, which will close the app. The previous state will be restored when the app is reopened. * When outgoing verification fails, move to the `Canceled` state. Then, when resetting the state machine state also reset the verification service. --------- Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
2ce1b17dae
commit
f73c0e42a4
145 changed files with 1662 additions and 830 deletions
|
|
@ -15,9 +15,15 @@ import kotlinx.parcelize.Parcelize
|
|||
|
||||
@Parcelize
|
||||
data class SessionVerificationRequestDetails(
|
||||
val senderId: UserId,
|
||||
val senderProfile: SenderProfile,
|
||||
val flowId: FlowId,
|
||||
val deviceId: DeviceId,
|
||||
val displayName: String?,
|
||||
val firstSeenTimestamp: Long,
|
||||
) : Parcelable
|
||||
) : Parcelable {
|
||||
@Parcelize
|
||||
data class SenderProfile(
|
||||
val userId: UserId,
|
||||
val displayName: String?,
|
||||
val avatarUrl: String?,
|
||||
) : Parcelable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
package io.element.android.libraries.matrix.api.verification
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
|
|
@ -31,7 +32,12 @@ interface SessionVerificationService {
|
|||
/**
|
||||
* Request verification of the current session.
|
||||
*/
|
||||
suspend fun requestVerification()
|
||||
suspend fun requestCurrentSessionVerification()
|
||||
|
||||
/**
|
||||
* Request verification of the user with the given [userId].
|
||||
*/
|
||||
suspend fun requestUserVerification(userId: UserId)
|
||||
|
||||
/**
|
||||
* Cancels the current verification attempt.
|
||||
|
|
@ -67,7 +73,7 @@ interface SessionVerificationService {
|
|||
* Set this particular request as the currently active one and register for
|
||||
* events pertaining it.
|
||||
*/
|
||||
suspend fun acknowledgeVerificationRequest(details: SessionVerificationRequestDetails)
|
||||
suspend fun acknowledgeVerificationRequest(verificationRequest: VerificationRequest.Incoming)
|
||||
|
||||
/**
|
||||
* Accept the previously acknowledged verification request.
|
||||
|
|
@ -76,7 +82,7 @@ interface SessionVerificationService {
|
|||
}
|
||||
|
||||
interface SessionVerificationServiceListener {
|
||||
fun onIncomingSessionRequest(sessionVerificationRequestDetails: SessionVerificationRequestDetails)
|
||||
fun onIncomingSessionRequest(verificationRequest: VerificationRequest.Incoming)
|
||||
}
|
||||
|
||||
/** Verification status of the current session. */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.verification
|
||||
|
||||
import android.os.Parcelable
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
sealed interface VerificationRequest : Parcelable {
|
||||
sealed interface Outgoing : VerificationRequest {
|
||||
@Parcelize
|
||||
data object CurrentSession : Outgoing
|
||||
|
||||
@Parcelize
|
||||
data class User(val userId: UserId) : Outgoing
|
||||
}
|
||||
|
||||
sealed class Incoming(open val details: SessionVerificationRequestDetails) : VerificationRequest {
|
||||
@Parcelize
|
||||
data class OtherSession(override val details: SessionVerificationRequestDetails) : Incoming(details)
|
||||
|
||||
@Parcelize
|
||||
data class User(override val details: SessionVerificationRequestDetails) : Incoming(details)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue