Extract Noise into a dedicated module

This commit is contained in:
islam
2026-04-14 20:16:45 +01:00
parent 4cfcefcda6
commit e8fb4a6333
26 changed files with 209 additions and 53 deletions
@@ -0,0 +1,34 @@
//
// MockKeychain.swift
// bitchat
//
// This is free and unencumbered software released into the public domain.
// For more information, see <https://unlicense.org>
//
import Foundation
@testable import Noise
// TODO: Combine with the one from the main target
final class MockKeychain: SecureMemoryCleaner {
/// Thread-safe counter for secureClear calls
private let lock = NSLock()
private var _secureClearDataCallCount = 0
var secureClearDataCallCount: Int {
lock.lock()
defer { lock.unlock() }
return _secureClearDataCallCount
}
func secureClear(_ data: inout Data) {
lock.lock()
_secureClearDataCallCount += 1
lock.unlock()
data = Data()
}
func secureClear(_ string: inout String) {
string = ""
}
}