Init handshake on dm (#187)

* kinda working

* establish handshake if not done yet

* add handshakerequest packet

* read receipt
This commit is contained in:
callebtc
2025-07-25 19:11:45 +02:00
committed by GitHub
parent 565e4ab33c
commit 34b3d8dd82
7 changed files with 338 additions and 30 deletions
@@ -32,7 +32,17 @@ class ChatViewModel(
private val dataManager = DataManager(application.applicationContext)
private val messageManager = MessageManager(state)
private val channelManager = ChannelManager(state, messageManager, dataManager, viewModelScope)
val privateChatManager = PrivateChatManager(state, messageManager, dataManager)
// Create Noise session delegate for clean dependency injection
private val noiseSessionDelegate = object : NoiseSessionDelegate {
override fun hasEstablishedSession(peerID: String): Boolean = meshService.hasEstablishedSession(peerID)
override fun initiateHandshake(peerID: String) = meshService.initiateNoiseHandshake(peerID)
override fun sendIdentityAnnouncement() = meshService.sendKeyExchangeToDevice()
override fun sendHandshakeRequest(targetPeerID: String, pendingCount: UByte) = meshService.sendHandshakeRequest(targetPeerID, pendingCount)
override fun getMyPeerID(): String = meshService.myPeerID
}
val privateChatManager = PrivateChatManager(state, messageManager, dataManager, noiseSessionDelegate)
private val commandProcessor = CommandProcessor(state, messageManager, channelManager, privateChatManager)
private val notificationManager = NotificationManager(application.applicationContext)