Public key mismatch warning

This commit is contained in:
Garth Vander Houwen 2024-08-14 20:52:47 -07:00
parent 3b0d40668f
commit 0b5e72cd43
4 changed files with 27 additions and 0 deletions

View file

@ -10784,6 +10784,9 @@
},
"Key" : {
},
"Key does not match the public key that was used previously, delete the node and let it negotatiate keys again." : {
},
"Key Mapping" : {
@ -16659,6 +16662,9 @@
},
"Public Key" : {
},
"Public Key Mismatch" : {
},
"PWD" : {

View file

@ -630,6 +630,7 @@ 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 {
@ -854,6 +855,7 @@ func textMessageAppPacket(
/// We have a key, check if it matches
if newMessage.fromUser?.publicKey != newMessage.publicKey {
newMessage.fromUser?.keyMatch = false
newMessage.fromUser?.newPublicKey = newMessage.publicKey
}
} else {
/// We have no key, set it

View file

@ -436,6 +436,7 @@
<attribute name="lastMessage" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="longName" attributeType="String"/>
<attribute name="mute" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="newPublicKey" optional="YES" attributeType="Binary"/>
<attribute name="num" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="numString" optional="YES" attributeType="String"/>
<attribute name="pkiEncrypted" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>

View file

@ -44,6 +44,24 @@ struct NodeDetail: View {
NodeInfoItem(node: node)
}
Section("Node") {
if let user = node.user {
if user.keyMatch {
Label {
VStack(alignment: .leading) {
Text("Public Key Mismatch")
.font(.title3)
.foregroundStyle(.red)
Text("Key does not match the public key that was used previously, delete the node and let it negotatiate keys again.")
.font(.caption)
.foregroundStyle(.red)
}
} icon: {
Image(systemName: "key.slash.fill")
.symbolRenderingMode(.multicolor)
.foregroundStyle(.red)
}
}
}
HStack {
Label {
Text("Node Number")