@magicred-1/ble-mesh 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1220,9 +1220,6 @@ class BleMeshModule(reactContext: ReactApplicationContext) : ReactContextBaseJav
|
|
|
1220
1220
|
return
|
|
1221
1221
|
}
|
|
1222
1222
|
|
|
1223
|
-
val publicKeyBytes = packet.payload.copyOfRange(0, publicKeySize)
|
|
1224
|
-
Log.d(TAG, "Extracted public key: ${publicKeyBytes.size} bytes")
|
|
1225
|
-
|
|
1226
1223
|
val publicKeyBytes = packet.payload.copyOfRange(0, publicKeySize)
|
|
1227
1224
|
Log.d(TAG, "Extracted public key: ${publicKeyBytes.size} bytes")
|
|
1228
1225
|
|
package/ios/BleMesh.swift
CHANGED
|
@@ -1000,14 +1000,20 @@ class BleMesh: RCTEventEmitter {
|
|
|
1000
1000
|
|
|
1001
1001
|
private func handleNoiseHandshake(_ packet: BitchatPacket, from senderID: String) {
|
|
1002
1002
|
NSLog("[BleMesh] Received handshake from \(senderID), payload size: \(packet.payload.count)")
|
|
1003
|
+
NSLog("[BleMesh] Payload hex (first 100 bytes): \(packet.payload.prefix(100).map { String(format: "%02x", $0) }.joined())")
|
|
1003
1004
|
|
|
1004
|
-
//
|
|
1005
|
-
|
|
1006
|
-
|
|
1005
|
+
// Extract Curve25519 public key from payload (should be 32 bytes, but payload might include extra data)
|
|
1006
|
+
let publicKeySize = 32
|
|
1007
|
+
guard packet.payload.count >= publicKeySize else {
|
|
1008
|
+
NSLog("[BleMesh] Invalid handshake payload size: \(packet.payload.count), expected at least \(publicKeySize)")
|
|
1007
1009
|
return
|
|
1008
1010
|
}
|
|
1009
1011
|
|
|
1010
|
-
|
|
1012
|
+
let publicKeyBytes = packet.payload.prefix(publicKeySize)
|
|
1013
|
+
NSLog("[BleMesh] Extracted public key: \(publicKeyBytes.count) bytes")
|
|
1014
|
+
|
|
1015
|
+
// Store peer's public key and derive shared secret
|
|
1016
|
+
guard let peerPublicKey = try? Curve25519.KeyAgreement.PublicKey(rawRepresentation: publicKeyBytes),
|
|
1011
1017
|
let pk = privateKey else {
|
|
1012
1018
|
NSLog("[BleMesh] Failed to parse peer public key or missing private key")
|
|
1013
1019
|
return
|
|
@@ -1026,7 +1032,7 @@ class BleMesh: RCTEventEmitter {
|
|
|
1026
1032
|
|
|
1027
1033
|
// Update peer's noise public key
|
|
1028
1034
|
if var peer = peers[senderID] {
|
|
1029
|
-
peer.noisePublicKey =
|
|
1035
|
+
peer.noisePublicKey = Data(publicKeyBytes)
|
|
1030
1036
|
peers[senderID] = peer
|
|
1031
1037
|
}
|
|
1032
1038
|
|