mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 16:25:21 +00:00
Fix asymmetric voice/media delivery in private chats
When selectedPrivateChatPeer was migrated to a 64-hex stable Noise key after session establishment, file transfers would silently fail because: 1. Sender used raw 64-hex key, truncated to first 8 bytes by BinaryProtocol 2. Receiver's myPeerID is SHA256-fingerprint-derived (different value) 3. Recipient check failed, causing silent packet drop The fix normalizes peerID to short form (SHA256-derived 16-hex) in sendFilePrivate before constructing recipientData, ensuring the wire format matches what receivers expect. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -728,7 +728,10 @@ final class BLEService: NSObject {
|
||||
SecureLogger.error("❌ Failed to encode file packet for private send", category: .session)
|
||||
return
|
||||
}
|
||||
guard let recipientData = Data(hexString: peerID.id) else {
|
||||
// Normalize to short form (SHA256-derived 16-hex) for wire protocol compatibility
|
||||
// This ensures 64-hex Noise keys are converted to the canonical routing format
|
||||
let targetID = peerID.toShort()
|
||||
guard let recipientData = Data(hexString: targetID.id) else {
|
||||
SecureLogger.error("❌ Invalid recipient peer ID for file transfer: \(peerID)", category: .session)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user