From 3934bdcbc6222a60d2f14956102ac12f133039cf Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 2 Sep 2024 22:23:56 -0700 Subject: [PATCH 1/2] Don't set keymatch to false if we get a pki failed error --- Meshtastic/Helpers/MeshPackets.swift | 5 ----- Meshtastic/Views/Nodes/Helpers/NodeDetail.swift | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index f46600aa..efd80d72 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -632,11 +632,6 @@ func routingPacket (packet: MeshPacket, connectedNodeNum: Int64, context: NSMana } } fetchedMessage[0].ackError = Int32(routingMessage.errorReason.rawValue) - if routingError == RoutingError.pkiFailed { - fetchedMessage[0].toUser?.keyMatch = false - fetchedMessage[0].toUser?.newPublicKey = fetchedMessage[0].publicKey - } - if routingMessage.errorReason == Routing.Error.none { fetchedMessage[0].receivedACK = true diff --git a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift index f6e701a6..9195d068 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift @@ -55,11 +55,14 @@ struct NodeDetail: View { .font(.caption) .foregroundStyle(.red) Text("Public Key\(user.publicKey?.base64EncodedString() ?? "Empty Key")") + .font(.caption2) .monospaced() .allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/) Text("New Key\(user.newPublicKey?.base64EncodedString() ?? "Empty Key")") + .font(.caption2) .monospaced() .allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/) + } } icon: { Image(systemName: "key.slash.fill") From a94fd470e5b6ed9dd55b507653d6658588bfb248 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 2 Sep 2024 22:42:51 -0700 Subject: [PATCH 2/2] Remove the keys again --- Localizable.xcstrings | 9 +++------ Meshtastic/Views/Nodes/Helpers/NodeDetail.swift | 15 +++------------ 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 7298c16e..d1bbd58b 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -15389,9 +15389,6 @@ }, "Never" : { - }, - "New Key%@" : { - }, "Newer firmware is available" : { @@ -16759,9 +16756,6 @@ }, "Public Key Mismatch" : { - }, - "Public Key%@" : { - }, "PWD" : { @@ -21128,6 +21122,9 @@ }, "The minimum distance change in meters to be considered for a smart position broadcast." : { + }, + "The most recent public key for this node does not match the previously recorded key. You can delete the node and let it exchange keys again, but this also may indicate a more serious security problem. Contact the user through another trusted channel to determine if the key change was due to a factory reset or other intentional action." : { + }, "The public key authorized to send admin messages to this node." : { diff --git a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift index 9195d068..11defc79 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift @@ -51,18 +51,9 @@ struct NodeDetail: View { Text("Public Key Mismatch") .font(.title3) .foregroundStyle(.red) - Text("The public key does not match the recorded key. You may delete the node and let it exchange keys again, but this may indicate a more serious security problem. Contact the user through another trusted channel, to determine if the key change was due to a factory reset or other intentional action.") - .font(.caption) - .foregroundStyle(.red) - Text("Public Key\(user.publicKey?.base64EncodedString() ?? "Empty Key")") - .font(.caption2) - .monospaced() - .allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/) - Text("New Key\(user.newPublicKey?.base64EncodedString() ?? "Empty Key")") - .font(.caption2) - .monospaced() - .allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/) - + Text("The most recent public key for this node does not match the previously recorded key. You can delete the node and let it exchange keys again, but this also may indicate a more serious security problem. Contact the user through another trusted channel to determine if the key change was due to a factory reset or other intentional action.") + .foregroundStyle(.secondary) + .font(.callout) } } icon: { Image(systemName: "key.slash.fill")