From d508972d321d42a8b1e2bf0fc3211322b352e4e1 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Tue, 27 Aug 2024 16:37:58 +1000 Subject: [PATCH 1/3] Added accessibilityIds to thread settings switches --- .../Conversations/Settings/ThreadSettingsViewModel.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Session/Conversations/Settings/ThreadSettingsViewModel.swift b/Session/Conversations/Settings/ThreadSettingsViewModel.swift index ad08b0521..cb0e1abd0 100644 --- a/Session/Conversations/Settings/ThreadSettingsViewModel.swift +++ b/Session/Conversations/Settings/ThreadSettingsViewModel.swift @@ -588,7 +588,8 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi .boolValue( threadViewModel.threadOnlyNotifyForMentions == true, oldValue: ((previous?.threadViewModel ?? threadViewModel).threadOnlyNotifyForMentions == true) - ) + ), + Accessibility(identifier: "Notify for Mentions Only - Switch") ), isEnabled: ( ( @@ -629,7 +630,8 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi .boolValue( threadViewModel.threadMutedUntilTimestamp != nil, oldValue: ((previous?.threadViewModel ?? threadViewModel).threadMutedUntilTimestamp != nil) - ) + ), + Accessibility(identifier: "Mute - Switch") ), isEnabled: ( ( @@ -678,7 +680,8 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi .boolValue( threadViewModel.threadIsBlocked == true, oldValue: ((previous?.threadViewModel ?? threadViewModel).threadIsBlocked == true) - ) + ), + Accessibility(identifier: "Block This User - Switch") ), accessibility: Accessibility( identifier: "\(ThreadSettingsViewModel.self).block", From c5efbbf44599bb86b3cb9335c844486887326325 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Tue, 27 Aug 2024 17:06:35 +1000 Subject: [PATCH 2/3] Fixed a build error --- .../Conversations/Settings/ThreadSettingsViewModel.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Session/Conversations/Settings/ThreadSettingsViewModel.swift b/Session/Conversations/Settings/ThreadSettingsViewModel.swift index cb0e1abd0..69205978e 100644 --- a/Session/Conversations/Settings/ThreadSettingsViewModel.swift +++ b/Session/Conversations/Settings/ThreadSettingsViewModel.swift @@ -589,7 +589,7 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi threadViewModel.threadOnlyNotifyForMentions == true, oldValue: ((previous?.threadViewModel ?? threadViewModel).threadOnlyNotifyForMentions == true) ), - Accessibility(identifier: "Notify for Mentions Only - Switch") + accessibility: Accessibility(identifier: "Notify for Mentions Only - Switch") ), isEnabled: ( ( @@ -631,7 +631,7 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi threadViewModel.threadMutedUntilTimestamp != nil, oldValue: ((previous?.threadViewModel ?? threadViewModel).threadMutedUntilTimestamp != nil) ), - Accessibility(identifier: "Mute - Switch") + accessibility: Accessibility(identifier: "Mute - Switch") ), isEnabled: ( ( @@ -681,7 +681,7 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi threadViewModel.threadIsBlocked == true, oldValue: ((previous?.threadViewModel ?? threadViewModel).threadIsBlocked == true) ), - Accessibility(identifier: "Block This User - Switch") + accessibility: Accessibility(identifier: "Block This User - Switch") ), accessibility: Accessibility( identifier: "\(ThreadSettingsViewModel.self).block", From 67830ed767ea75d4e6be74f3601c1618cb655973 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Tue, 27 Aug 2024 17:51:09 +1000 Subject: [PATCH 3/3] Fixed a legacy group message decryption issue Fixed a bug where we were incorrectly generating and requiring 64 byte secrets for legacy groups (we only need 32 bytes), since we do length checks before calling the libSession C API (to prevent crashes) we would fail before attempting to decrypt because the key was too short --- LibSession-Util | 2 +- Session.xcodeproj/project.pbxproj | 4 ++-- SessionMessagingKit/Crypto/Crypto+SessionMessagingKit.swift | 6 +++++- SessionUtilitiesKit/Crypto/Crypto+SessionUtilitiesKit.swift | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/LibSession-Util b/LibSession-Util index af0ab996d..2bf8c8144 160000 --- a/LibSession-Util +++ b/LibSession-Util @@ -1 +1 @@ -Subproject commit af0ab996da46bcbeeea5e70831cda7e23c955243 +Subproject commit 2bf8c81443494f227a9509ddd95889f196b668d6 diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 611f2a7f0..09b821a47 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -7673,7 +7673,7 @@ CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 476; + CURRENT_PROJECT_VERSION = 478; ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -7751,7 +7751,7 @@ CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Distribution"; - CURRENT_PROJECT_VERSION = 476; + CURRENT_PROJECT_VERSION = 478; ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; diff --git a/SessionMessagingKit/Crypto/Crypto+SessionMessagingKit.swift b/SessionMessagingKit/Crypto/Crypto+SessionMessagingKit.swift index 21d06eae9..f26373861 100644 --- a/SessionMessagingKit/Crypto/Crypto+SessionMessagingKit.swift +++ b/SessionMessagingKit/Crypto/Crypto+SessionMessagingKit.swift @@ -168,9 +168,13 @@ public extension Crypto.Generator { var maybePlaintext: UnsafeMutablePointer? = nil var plaintextLen: Int = 0 + // Note: We should only need a 32 byte key but there was a bug in 2.7.1 where we + // started generating 64 byte keys so, in order to support those, we accept allow + // both and the C code just takes the first 32 bytes (which is all that is needed + // from the 64 byte key anyway) guard cX25519Pubkey.count == 32, - cX25519Seckey.count == 64, + (cX25519Seckey.count == 32 || cX25519Seckey.count == 64), session_decrypt_incoming_legacy_group( &cCiphertext, cCiphertext.count, diff --git a/SessionUtilitiesKit/Crypto/Crypto+SessionUtilitiesKit.swift b/SessionUtilitiesKit/Crypto/Crypto+SessionUtilitiesKit.swift index 30b71d17d..d1ceed919 100644 --- a/SessionUtilitiesKit/Crypto/Crypto+SessionUtilitiesKit.swift +++ b/SessionUtilitiesKit/Crypto/Crypto+SessionUtilitiesKit.swift @@ -55,7 +55,7 @@ public extension Crypto.Generator { static func x25519KeyPair() -> Crypto.Generator { return Crypto.Generator(id: "x25519KeyPair") { () -> KeyPair in var pubkey: [UInt8] = [UInt8](repeating: 0, count: 32) - var seckey: [UInt8] = [UInt8](repeating: 0, count: 64) + var seckey: [UInt8] = [UInt8](repeating: 0, count: 32) guard session_curve25519_key_pair(&pubkey, &seckey) else { throw CryptoError.keyGenerationFailed }