Remove message retention and /save command

- Delete MessageRetentionService.swift
- Remove retentionEnabledChannels from ChatViewModel
- Remove /save command handling
- Remove retention UI elements from ContentView
- Remove channelRetention message type from protocol
- Update documentation and tests
This commit is contained in:
jack
2025-07-16 15:59:38 +02:00
parent fcc0735928
commit b61904bee9
9 changed files with 2 additions and 532 deletions
@@ -97,12 +97,10 @@ class KeychainIntegrationTests: XCTestCase {
func testNoPlaintextInUserDefaults() {
// Create services to generate keys
_ = NoiseEncryptionService()
_ = MessageRetentionService.shared
// Check UserDefaults for any sensitive data
let keysToCheck = [
"bitchat.noiseIdentityKey",
"bitchat.messageRetentionKey",
"bitchat.channelPasswords",
"bitchat.identityKey",
"bitchat.staticKey"
@@ -112,31 +112,7 @@ class NoiseIdentityPersistenceTests: XCTestCase {
}
// MARK: - Message Retention Key Tests
func testMessageRetentionKeyPersistence() {
// Create first instance
_ = MessageRetentionService.shared
// Get key from keychain
let keyData1 = KeychainManager.shared.getIdentityKey(forKey: "messageRetentionKey")
XCTAssertNotNil(keyData1, "Message retention key should be stored")
// Simulate app restart by clearing the singleton
// (In real app, this would be a new process)
// Get key again
let keyData2 = KeychainManager.shared.getIdentityKey(forKey: "messageRetentionKey")
XCTAssertEqual(keyData1, keyData2, "Message retention key should persist")
}
func testMessageRetentionKeyNotInUserDefaults() {
// Ensure service is initialized
_ = MessageRetentionService.shared
// Verify key is NOT in UserDefaults
let userDefaultsData = UserDefaults.standard.data(forKey: "bitchat.messageRetentionKey")
XCTAssertNil(userDefaultsData, "Message retention key should NOT be in UserDefaults")
}
// Message retention feature has been removed
// MARK: - Keychain Service Name Tests