mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 07:05:19 +00:00
PeerID 31/n: Remove String interop to be explicit (#840)
* PeerID 28/n: `ChatViewModel.getShortIDForNoiseKey` * PeerID 29/n: `BLEService` + remove dupe funcs from #823 * `handleFileTransfer` to use PeerID * `sendMessage` and `sendPrivateMessage` * PeerID 30/n: Update some leftovers * `lowercased()` inside PeerID for normalization * PeerID 31/n: Remove String interop to be explicit * MockBLEService: Remove direct target delivery This causes a delivery even if the sender and receiver are not connected --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
@@ -261,7 +261,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
|
||||
nickname = trimmed
|
||||
}
|
||||
// Update mesh service nickname if it's initialized
|
||||
if meshService.myPeerID != "" {
|
||||
if !meshService.myPeerID.isEmpty {
|
||||
meshService.setNickname(nickname)
|
||||
}
|
||||
}
|
||||
@@ -4103,7 +4103,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
|
||||
if let spid = message.senderPeerID {
|
||||
if case .location(let ch) = activeChannel, spid.id.hasPrefix("nostr:") {
|
||||
if let myGeo = try? idBridge.deriveIdentity(forGeohash: ch.geohash) {
|
||||
return spid == "nostr:\(myGeo.publicKeyHex.prefix(TransportConfig.nostrShortKeyDisplayLength))"
|
||||
return spid == PeerID(nostr: myGeo.publicKeyHex)
|
||||
}
|
||||
}
|
||||
return spid == meshService.myPeerID
|
||||
@@ -5623,7 +5623,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
|
||||
}
|
||||
|
||||
// Validate recipient
|
||||
if let rid = packet.recipientID, rid.hexEncodedString() != meshService.myPeerID {
|
||||
if PeerID(hexData: packet.recipientID) != meshService.myPeerID {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user