Propose to verify the current session if the 4S contains secret, even if there is no other sessions

This commit is contained in:
Benoit Marty 2020-09-03 10:00:01 +02:00
parent 2efe5a420c
commit 633b12f66d
5 changed files with 19 additions and 8 deletions

View file

@ -7,7 +7,7 @@ Features ✨:
Improvements 🙌:
- You can now join room through permalink and within room directory search
- Add long click gesture to copy userId, user display name, room name, room topic and room alias (#1774)
- Do not propose to verify session if there is only one session (#1901)
- Do not propose to verify session if there is only one session and 4S is not configured (#1901)
Bugfix 🐛:
- Display name not shown under Settings/General (#1926)

View file

@ -89,14 +89,18 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
title(stringProvider.getString(R.string.encryption_information_verified))
description(stringProvider.getString(R.string.settings_active_sessions_verified_device_desc))
}
} else if (data.hasOtherSessions) {
// You need to complete security, only if there are other session(s) available
} else if (data.canVerifySession) {
// You need to complete security, only if there are other session(s) available, or if 4S contains secrets
genericItem {
id("trust${cryptoDeviceInfo.deviceId}")
style(GenericItem.STYLE.BIG_TEXT)
titleIconResourceId(shield)
title(stringProvider.getString(R.string.crosssigning_verify_this_session))
description(stringProvider.getString(R.string.confirm_your_identity))
if (data.hasOtherSessions) {
description(stringProvider.getString(R.string.confirm_your_identity))
} else {
description(stringProvider.getString(R.string.confirm_your_identity_quad_s))
}
}
}
} else {
@ -133,7 +137,7 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
description("(${cryptoDeviceInfo.deviceId})")
}
if (isMine && !currentSessionIsTrusted && data.hasOtherSessions) {
if (isMine && !currentSessionIsTrusted && data.canVerifySession) {
// Add complete security
dividerItem {
id("completeSecurityDiv")

View file

@ -43,7 +43,8 @@ class DeviceVerificationInfoBottomSheetViewModel @AssistedInject constructor(@As
setState {
copy(
hasAccountCrossSigning = session.cryptoService().crossSigningService().isCrossSigningInitialized(),
accountCrossSigningIsTrusted = session.cryptoService().crossSigningService().isCrossSigningVerified()
accountCrossSigningIsTrusted = session.cryptoService().crossSigningService().isCrossSigningVerified(),
isRecoverySetup = session.sharedSecretStorageService.isRecoverySetup()
)
}
session.rx().liveCrossSigningInfo(session.myUserId)

View file

@ -28,5 +28,10 @@ data class DeviceVerificationInfoBottomSheetViewState(
val hasAccountCrossSigning: Boolean = false,
val accountCrossSigningIsTrusted: Boolean = false,
val isMine: Boolean = false,
val hasOtherSessions: Boolean = false
) : MvRxState
val hasOtherSessions: Boolean = false,
val isRecoverySetup: Boolean = false
) : MvRxState {
val canVerifySession: Boolean
get() = hasOtherSessions || isRecoverySetup
}

View file

@ -2413,6 +2413,7 @@
<string name="crosssigning_verify_session">Verify login</string>
<string name="cross_signing_verify_by_emoji">Interactively Verify by Emoji</string>
<string name="confirm_your_identity">Confirm your identity by verifying this login from one of your other sessions, granting it access to encrypted messages.</string>
<string name="confirm_your_identity_quad_s">Confirm your identity by verifying this login, granting it access to encrypted messages.</string>
<string name="mark_as_verified">Mark as Trusted</string>
<string name="error_empty_field_choose_user_name">Please choose a username.</string>