From 51d8bdb99140b01b9ab17ff84ab5e40dbe1049ba Mon Sep 17 00:00:00 2001 From: wollow Date: Sat, 26 Sep 2026 14:13:19 +0300 Subject: [PATCH] Fix app and Wear unit test compilation --- .../bitchat/android/nostr/GeohashMessageHandler.kt | 13 ++++++++++++- .../java/com/bitchat/watch/ui/theme/Typography.kt | 6 ++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/bitchat/android/nostr/GeohashMessageHandler.kt b/app/src/main/java/com/bitchat/android/nostr/GeohashMessageHandler.kt index 88d41466..a43194cb 100644 --- a/app/src/main/java/com/bitchat/android/nostr/GeohashMessageHandler.kt +++ b/app/src/main/java/com/bitchat/android/nostr/GeohashMessageHandler.kt @@ -3,8 +3,11 @@ package com.bitchat.android.nostr import android.app.Application import android.util.Log import com.bitchat.android.model.BitchatMessage +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import java.util.Date /** @@ -18,7 +21,8 @@ class GeohashMessageHandler( private val repo: GeohashRepository, private val scope: CoroutineScope, private val dataManager: com.bitchat.android.ui.DataManager, - private val addChannelMessage: (String, BitchatMessage) -> Unit + private val addChannelMessage: (String, BitchatMessage) -> Unit, + private val signatureVerificationDispatcher: CoroutineDispatcher = Dispatchers.Default ) { companion object { private const val TAG = "GeohashMessageHandler" } @@ -44,6 +48,13 @@ class GeohashMessageHandler( if (event.kind != NostrKind.EPHEMERAL_EVENT && event.kind != NostrKind.GEOHASH_PRESENCE) return@launch val tagGeo = event.tags.firstOrNull { it.size >= 2 && it[0] == "g" }?.getOrNull(1) if (tagGeo == null || !tagGeo.equals(subscribedGeohash, true)) return@launch + val hasValidSignature = withContext(signatureVerificationDispatcher) { + event.isValidSignature() + } + if (!hasValidSignature) { + Log.w(TAG, "Rejecting geohash event ${event.id.take(8)}... with invalid signature") + return@launch + } if (dedupe(event.id)) return@launch // PoW validation (if enabled) - apply to chat messages primarily diff --git a/wear/src/main/java/com/bitchat/watch/ui/theme/Typography.kt b/wear/src/main/java/com/bitchat/watch/ui/theme/Typography.kt index ff66567d..aca6c631 100644 --- a/wear/src/main/java/com/bitchat/watch/ui/theme/Typography.kt +++ b/wear/src/main/java/com/bitchat/watch/ui/theme/Typography.kt @@ -37,7 +37,9 @@ object ChatVisualTokens { val SystemActionStyle = TextStyle( fontFamily = BitchatFontFamily, fontWeight = FontWeight.Medium, - fontSize = 11.sp, - lineHeight = 14.sp, + fontSize = 12.sp, + lineHeight = 15.sp, ) + + val TimestampStyle = SystemActionStyle.copy(fontSize = 10.sp, lineHeight = 12.sp) }