mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Set message size to 200 bytes, add extra pki check before setting key
This commit is contained in:
parent
70b9a8de51
commit
5a1818d503
5 changed files with 9 additions and 7 deletions
|
|
@ -14559,7 +14559,7 @@
|
|||
"Message" : {
|
||||
|
||||
},
|
||||
"Message content exceeds 228 bytes." : {
|
||||
"Message content exceeds 200 bytes." : {
|
||||
|
||||
},
|
||||
"Message Status Options" : {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ struct MessageChannelIntent: AppIntent {
|
|||
throw AppIntentErrors.AppIntentError.message("Failed to encode message content")
|
||||
}
|
||||
|
||||
if messageData.count > 228 {
|
||||
throw $messageContent.needsValueError("Message content exceeds 228 bytes.")
|
||||
if messageData.count > 200 {
|
||||
throw $messageContent.needsValueError("Message content exceeds 200 bytes.")
|
||||
}
|
||||
|
||||
if(!BLEManager.shared.sendMessage(message: messageContent, toUserNum: 0, channel: Int32(channelNumber), isEmoji: false, replyID: 0)){
|
||||
|
|
|
|||
|
|
@ -891,9 +891,11 @@ func textMessageAppPacket(
|
|||
if newMessage.fromUser?.publicKey != newMessage.publicKey {
|
||||
newMessage.fromUser?.keyMatch = false
|
||||
newMessage.fromUser?.newPublicKey = newMessage.publicKey
|
||||
Logger.data.error("🔑 Key Mismatch origninal key: \(newMessage.fromUser?.publicKey?.base64EncodedString() ?? "No Key") new key: \(newMessage.fromUser?.newPublicKey?.base64EncodedString() ?? "No Key") ")
|
||||
let nodeKey = String(newMessage.fromUser?.publicKey?.base64EncodedString() ?? "No Key").prefix(8)
|
||||
let messageKey = String(newMessage.fromUser?.newPublicKey?.base64EncodedString() ?? "No Key").prefix(8)
|
||||
Logger.data.error("🔑 Key Mismatch origninal key: \(nodeKey, privacy: .public) . . . new key: \(messageKey, privacy: .public) . . .")
|
||||
}
|
||||
} else {
|
||||
} else if packet.pkiEncrypted {
|
||||
/// We have no key, set it if it is not empty
|
||||
if !packet.publicKey.isEmpty {
|
||||
newMessage.fromUser?.pkiEncrypted = true
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import SwiftUI
|
|||
import OSLog
|
||||
|
||||
struct TextMessageField: View {
|
||||
static let maxbytes = 228
|
||||
static let maxbytes = 200
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
|
||||
let destination: MessageDestination
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ struct TextMessageSize: View {
|
|||
|
||||
struct TextMessageSizePreview: PreviewProvider {
|
||||
static var previews: some View {
|
||||
TextMessageSize(maxbytes: 228, totalBytes: 100)
|
||||
TextMessageSize(maxbytes: 200, totalBytes: 100)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue