This commit is contained in:
Leon Böttger committed 2025-08-23 11:59:16 +02:00
1 parent 48164b8095
commit 448cc15a7e
2 files changed
+10 -5

No files matched your search

@@ -387,11 +387,10 @@ class InboundNearbyConnection: NearbyConnection {
private func processPairedKeyEncryptionFrame(_ frame: Sharing_Nearby_Frame) throws {
let pkeFrame = frame.v1.pairedKeyEncryption
log("[InboundNearbyConnection \(self.id)] Processing paired key encryption frame with secretIDHash: \(pkeFrame.secretIDHash.hex)")
log("Signed data: " + pkeFrame.signedData.hex)
guard frame.hasV1, frame.v1.hasPairedKeyEncryption else { throw NearbyError.requiredFieldMissing("shareNearbyFrame.v1.pairedKeyEncryption") }
let pkeFrame = frame.v1.pairedKeyEncryption
// Check if we can accept the connection automatically
if !pkeFrame.secretIDHash.isEmpty,
@@ -304,7 +304,13 @@ class OutboundNearbyConnection: NearbyConnection {
pairedEncryption.v1.pairedKeyResult.status = .success
}
else {
log("[OutboundNearbyConnection \(self.id)] No private key available, cannot send signing certificate!")
pairedEncryption.v1.pairedKeyEncryption.secretIDHash = Data.randomData(length: 6)
pairedEncryption.v1.pairedKeyEncryption.signedData = Data.randomData(length: 72)
}
if let qrKey = qrCodePrivateKey, let authKey = authKey {
let signature = qrKey.sign(msg: authKey.data())