Files
Morgan Pretty e42dda74b5 Refactored the message deduplication logic
• Added the new MessageDeduplication table
• Added a migration to populate the MessageDeduplication table
• Added ExtensionHelper functions to store records in the AppGroup for deduplication purposes
• Updated the logic to use MessageDeduplication table & files for deduplication purposes
• Refactored message parsing to not rely on the database
• Refactored message deduplication to not rely on the database in the PN extension
• Removed the old ControlMessageProcessRecord table
2025-05-13 14:03:02 +10:00

47 lines
1.5 KiB
Swift

// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
import Foundation
import SessionUtilitiesKit
class MockKeychain: Mock<KeychainStorageType>, KeychainStorageType {
func string(forKey key: KeychainStorage.StringKey) throws -> String {
return try mockThrowing(args: [key])
}
func set(string: String, forKey key: KeychainStorage.StringKey) throws {
return try mockThrowing(args: [key])
}
func remove(key: KeychainStorage.StringKey) throws {
return try mockThrowing(args: [key])
}
func data(forKey key: KeychainStorage.DataKey) throws -> Data {
return try mockThrowing(args: [key])
}
func set(data: Data, forKey key: KeychainStorage.DataKey) throws {
return try mockThrowing(args: [key])
}
func remove(key: KeychainStorage.DataKey) throws {
return try mockThrowing(args: [key])
}
func removeAll() throws { try mockThrowingNoReturn() }
func migrateLegacyKeyIfNeeded(legacyKey: String, legacyService: String?, toKey key: KeychainStorage.DataKey) throws {
try mockThrowingNoReturn(args: [legacyKey, legacyService, key])
}
func getOrGenerateEncryptionKey(
forKey key: KeychainStorage.DataKey,
length: Int,
cat: Log.Category,
legacyKey: String?,
legacyService: String?
) throws -> Data {
return try mockThrowing(args: [key, length, cat, legacyKey, legacyService])
}
}