From 414e0bb5449c44226ff991265673f94431abc367 Mon Sep 17 00:00:00 2001 From: andrekir Date: Sun, 3 Nov 2024 06:48:32 -0300 Subject: [PATCH] fix: clear public keys if the user is licensed --- .../com/geeksville/mesh/service/MeshService.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index bcd53c97..5d539477 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -49,7 +49,8 @@ import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.withTimeoutOrNull -import java.util.* +import java.util.Random +import java.util.UUID import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentLinkedQueue import java.util.concurrent.TimeUnit @@ -686,8 +687,10 @@ class MeshService : Service(), Logging { // Handle new style user info Portnums.PortNum.NODEINFO_APP_VALUE -> if (!fromUs) { - val u = MeshProtos.User.parseFrom(data.payload) - .copy { if (packet.viaMqtt) longName = "$longName (MQTT)" } + val u = MeshProtos.User.parseFrom(data.payload).copy { + if (isLicensed) clearPublicKey() + if (packet.viaMqtt) longName = "$longName (MQTT)" + } handleReceivedUser(packet.from, u, packet.channel) } @@ -1386,7 +1389,10 @@ class MeshService : Service(), Logging { // Just replace/add any entry updateNodeInfo(info.num) { if (info.hasUser()) { - it.user = info.user.copy { if (info.viaMqtt) longName = "$longName (MQTT)" } + it.user = info.user.copy { + if (isLicensed) clearPublicKey() + if (info.viaMqtt) longName = "$longName (MQTT)" + } it.longName = info.user.longName it.shortName = info.user.shortName }