Skip to content

Commit

Permalink
feat(crypto): Support for new UtdCause for historical messages
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Dec 16, 2024
1 parent 0e46173 commit 66613d2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@
"test_language_identifier" = "en";
"test_untranslated_default_language_identifier" = "en";
"timeline_decryption_failure_historical_event_no_key_backup" = "Historical messages are not available on this device";
"timeline_decryption_failure_historical_event_unverified_device" = "You need to verify this device for access to historical messages";
"timeline_decryption_failure_historical_event_user_not_joined" = "You don't have access to this message";
"timeline_decryption_failure_unable_to_decrypt" = "Unable to decrypt message";
"timeline_decryption_failure_withheld_unverified" = "This message was blocked either because you did not verify your device or because the sender needs to verify your identity.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
case .unknownDevice, .unsignedDevice: .ExpectedSentByInsecureDevice
case .verificationViolation: .ExpectedVerificationViolation
case .sentBeforeWeJoined: .ExpectedDueToMembership
case .historicalMessage: .HistoricalMessage
case .historicalMessageAndBackupIsDisabled, .historicalMessageAndDeviceIsUnverified: .HistoricalMessage

Check failure on line 391 in ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift

View workflow job for this annotation

GitHub Actions / Tests (Enterprise)

type 'UtdCause' has no member 'historicalMessageAndBackupIsDisabled'

Check failure on line 391 in ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift

View workflow job for this annotation

GitHub Actions / Tests (Enterprise)

type 'UtdCause' has no member 'historicalMessageAndBackupIsDisabled'

Check failure on line 391 in ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift

View workflow job for this annotation

GitHub Actions / Tests

type 'UtdCause' has no member 'historicalMessageAndBackupIsDisabled'
case .withheldForUnverifiedOrInsecureDevice: .RoomKeysWithheldForUnverifiedDevice
case .withheldBySender: .OlmKeysNotSentError
}
Expand Down
2 changes: 2 additions & 0 deletions ElementX/Sources/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2592,6 +2592,8 @@ internal enum L10n {
internal static var testUntranslatedDefaultLanguageIdentifier: String { return L10n.tr("Localizable", "test_untranslated_default_language_identifier") }
/// Historical messages are not available on this device
internal static var timelineDecryptionFailureHistoricalEventNoKeyBackup: String { return L10n.tr("Localizable", "timeline_decryption_failure_historical_event_no_key_backup") }
/// You need to verify this device for access to historical messages
internal static var timelineDecryptionFailureHistoricalEventUnverifiedDevice: String { return L10n.tr("Localizable", "timeline_decryption_failure_historical_event_unverified_device") }
/// You don't have access to this message
internal static var timelineDecryptionFailureHistoricalEventUserNotJoined: String { return L10n.tr("Localizable", "timeline_decryption_failure_historical_event_user_not_joined") }
/// Unable to decrypt message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ struct EncryptedRoomTimelineView: View {
case .unknown:
return \.time
case .sentBeforeWeJoined,
.historicalMessage,
.historicalMessageAndBackupDisabled,
.historicalMessageAndDeviceIsUnverified,
.verificationViolation,
.insecureDevice,
.witheldBySender,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ struct EncryptedRoomTimelineItem: EventBasedTimelineItemProtocol, Equatable {
case verificationViolation
case insecureDevice
case unknown
case historicalMessage
case historicalMessageAndBackupDisabled
case historicalMessageAndDeviceIsUnverified
case witheldBySender
case withheldForUnverifiedOrInsecureDevice
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
case .sentBeforeWeJoined:
encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .sentBeforeWeJoined)
errorLabel = L10n.commonUnableToDecryptNoAccess
case .historicalMessage:
encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .historicalMessage)
case .historicalMessageAndBackupIsDisabled:

Check failure on line 156 in ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift

View workflow job for this annotation

GitHub Actions / Tests

type 'UtdCause' has no member 'historicalMessageAndBackupIsDisabled'
encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .historicalMessageAndBackupDisabled)
errorLabel = L10n.timelineDecryptionFailureHistoricalEventNoKeyBackup
case .historicalMessageAndDeviceIsUnverified:

Check failure on line 159 in ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift

View workflow job for this annotation

GitHub Actions / Tests

type 'UtdCause' has no member 'historicalMessageAndDeviceIsUnverified'
encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .historicalMessageAndDeviceIsUnverified)
errorLabel = L10n.timelineDecryptionFailureHistoricalEventUnverifiedDevice
case .withheldForUnverifiedOrInsecureDevice:
encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .withheldForUnverifiedOrInsecureDevice)
errorLabel = L10n.timelineDecryptionFailureWithheldUnverified
Expand Down

0 comments on commit 66613d2

Please sign in to comment.