mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 01:05:19 +00:00
Remove noise service exposure; single-owner selection state
Transport callers no longer reach the raw NoiseEncryptionService: getNoiseService() is deleted in favor of narrow purpose-named Transport methods (session public key, identity fingerprint, static/signing keys, sign/verify, callback installation). VerificationService now reaches crypto through the transport, so it can no longer pin a stale service across a panic reset. myPeerID/myNickname become private(set); the existing setNickname mutator is the sole nickname path. ConversationStore is now the sole owner of private-chat selection: PrivateChatManager.selectedPeer is a published read-only mirror, and startChat/endChat mutate through the store intent. The bridge method and its five call sites are deleted, removing a latent bug where a stale manager selection pushed back into the store could resurrect a just-removed conversation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,8 +109,34 @@ final class MockTransport: Transport {
|
||||
triggeredHandshakes.append(peerID)
|
||||
}
|
||||
|
||||
func getNoiseService() -> NoiseEncryptionService {
|
||||
NoiseEncryptionService(keychain: mockKeychain)
|
||||
// Noise identity wrappers backed by a mock-keychain encryption service
|
||||
// (mirrors the previous `getNoiseService()` placeholder behavior: a real
|
||||
// identity, but no peer sessions). Exposed so tests can assert against
|
||||
// the same identity the wrappers use.
|
||||
private(set) lazy var mockNoiseService = NoiseEncryptionService(keychain: mockKeychain)
|
||||
|
||||
func noiseSessionPublicKeyData(for peerID: PeerID) -> Data? {
|
||||
mockNoiseService.getPeerPublicKeyData(peerID)
|
||||
}
|
||||
|
||||
func noiseIdentityFingerprint() -> String {
|
||||
mockNoiseService.getIdentityFingerprint()
|
||||
}
|
||||
|
||||
func noiseStaticPublicKeyData() -> Data {
|
||||
mockNoiseService.getStaticPublicKeyData()
|
||||
}
|
||||
|
||||
func noiseSigningPublicKeyData() -> Data {
|
||||
mockNoiseService.getSigningPublicKeyData()
|
||||
}
|
||||
|
||||
func noiseSignData(_ data: Data) -> Data? {
|
||||
mockNoiseService.signData(data)
|
||||
}
|
||||
|
||||
func noiseVerifySignature(_ signature: Data, for data: Data, publicKey: Data) -> Bool {
|
||||
mockNoiseService.verifySignature(signature, for: data, publicKey: publicKey)
|
||||
}
|
||||
|
||||
// MARK: - Messaging
|
||||
|
||||
Reference in New Issue
Block a user