mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 17:25:20 +00:00
* Make static functions instance functions to be testable * Injectable KeychainManager + Mock + updated tests * Remove `pendingActions` from identity manager (dead code) * Remove `getHandshakeState` from identity manager (dead code) * Remove `getAllSocialIdentities` from identity manager (dead code) * Remove `getCryptographicIdentity` from identity manager (dead code) * Remove `resolveIdentity` from identity manager (dead code) * Identity Manager: minor clean up * Put Identity Manager behind a protocol * Remove Keychain and Identity Manager singletons * Tests: include MockKeychain/MockIdentityManager in project; init identityManager in CommandProcessorTests --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
81 lines
2.0 KiB
Swift
81 lines
2.0 KiB
Swift
//
|
|
// MockIdentityManager.swift
|
|
// bitchat
|
|
//
|
|
// This is free and unencumbered software released into the public domain.
|
|
// For more information, see <https://unlicense.org>
|
|
//
|
|
|
|
import Foundation
|
|
@testable import bitchat
|
|
|
|
final class MockIdentityManager: SecureIdentityStateManagerProtocol {
|
|
private let keychain: KeychainManagerProtocol
|
|
|
|
init(_ keychain: KeychainManagerProtocol) {
|
|
self.keychain = keychain
|
|
}
|
|
|
|
func loadIdentityCache() {}
|
|
|
|
func saveIdentityCache() {}
|
|
|
|
func forceSave() {}
|
|
|
|
func getSocialIdentity(for fingerprint: String) -> SocialIdentity? {
|
|
nil
|
|
}
|
|
|
|
func upsertCryptographicIdentity(fingerprint: String, noisePublicKey: Data, signingPublicKey: Data?, claimedNickname: String?) {}
|
|
|
|
func getCryptoIdentitiesByPeerIDPrefix(_ peerID: String) -> [CryptographicIdentity] {
|
|
[]
|
|
}
|
|
|
|
func updateSocialIdentity(_ identity: SocialIdentity) {}
|
|
|
|
func getFavorites() -> Set<String> {
|
|
Set()
|
|
}
|
|
|
|
func setFavorite(_ fingerprint: String, isFavorite: Bool) {}
|
|
|
|
func isFavorite(fingerprint: String) -> Bool {
|
|
false
|
|
}
|
|
|
|
func isBlocked(fingerprint: String) -> Bool {
|
|
false
|
|
}
|
|
|
|
func setBlocked(_ fingerprint: String, isBlocked: Bool) {}
|
|
|
|
func isNostrBlocked(pubkeyHexLowercased: String) -> Bool {
|
|
true
|
|
}
|
|
|
|
func setNostrBlocked(_ pubkeyHexLowercased: String, isBlocked: Bool) {}
|
|
|
|
func getBlockedNostrPubkeys() -> Set<String> {
|
|
Set()
|
|
}
|
|
|
|
func registerEphemeralSession(peerID: String, handshakeState: HandshakeState) {}
|
|
|
|
func updateHandshakeState(peerID: String, state: HandshakeState) {}
|
|
|
|
func clearAllIdentityData() {}
|
|
|
|
func removeEphemeralSession(peerID: String) {}
|
|
|
|
func setVerified(fingerprint: String, verified: Bool) {}
|
|
|
|
func isVerified(fingerprint: String) -> Bool {
|
|
true
|
|
}
|
|
|
|
func getVerifiedFingerprints() -> Set<String> {
|
|
Set()
|
|
}
|
|
}
|