From 1a7dbdca426f3018c6e5f4f655aca5942793a972 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Mon, 23 Mar 2026 13:12:22 -0300 Subject: [PATCH] Replace hardcoded developer public key with Amber.DEVELOPER_HEX_KEY constant - Define `DEVELOPER_HEX_KEY` constant in `Amber.kt` to centralize the developer's public key. - Update `EventData.kt`, `CrashReportScreen.kt`, and `Amber.kt` to use the new constant instead of the hardcoded hex string when generating Nostr URI intents, direct messages, and Git issue events. - Suppress unused exception variable in `Amber.isSocksProxyAlive`. --- app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt | 8 +++++--- .../com/greenart7c3/nostrsigner/ui/CrashReportScreen.kt | 4 ++-- .../greenart7c3/nostrsigner/ui/components/EventData.kt | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt b/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt index 9249622c..3d132077 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt @@ -151,7 +151,7 @@ class Amber : socket.connect(InetSocketAddress(proxyHost, port), 5000) socket.close() true - } catch (e: Exception) { + } catch (_: Exception) { false } } @@ -521,7 +521,7 @@ class Amber : val repositoryEvent = GitRepositoryEvent( "", - "7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19", + DEVELOPER_HEX_KEY, TimeUtils.now(), tags = arrayOf(arrayOf("d", "Amber")), "", @@ -532,7 +532,7 @@ class Amber : subject, body, EventHintBundle(repositoryEvent), - listOf(PTag("7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19", null)), + listOf(PTag(DEVELOPER_HEX_KEY, null)), listOf(if (type == FeedbackType.BUG_REPORT) "bug" else "enhancement"), ) @@ -551,6 +551,8 @@ class Amber : const val TAG = "Amber" lateinit var instance: Amber private set + + const val DEVELOPER_HEX_KEY = "7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19" } } diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/ui/CrashReportScreen.kt b/app/src/main/java/com/greenart7c3/nostrsigner/ui/CrashReportScreen.kt index a2af2f93..321dd45b 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/ui/CrashReportScreen.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/ui/CrashReportScreen.kt @@ -137,7 +137,7 @@ fun CrashReportScreen( ClipEntry(ClipData.newPlainText("", report)), ) val intent = Intent(Intent.ACTION_VIEW) - val npub = Hex.decode("7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19").toNpub() + val npub = Hex.decode(Amber.DEVELOPER_HEX_KEY).toNpub() intent.data = "nostr:$npub".toUri() intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK Amber.instance.startActivity(intent) @@ -155,7 +155,7 @@ fun CrashReportScreen( val template = ChatMessageEvent.build( msg = report, - to = listOf(PTag("7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19")), + to = listOf(PTag(Amber.DEVELOPER_HEX_KEY)), createdAt = System.currentTimeMillis() / 1000, ) { val thirtyDaysInSeconds = 30L * 86_400 diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/EventData.kt b/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/EventData.kt index d07409d5..e3d02450 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/EventData.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/EventData.kt @@ -247,7 +247,7 @@ fun ReportMissingEventKindButton(account: Account, kind: Int) { ), ) val intent = Intent(Intent.ACTION_VIEW) - val npub = Hex.decode("7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19").toNpub() + val npub = Hex.decode(Amber.DEVELOPER_HEX_KEY).toNpub() intent.data = "nostr:$npub".toUri() intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK Amber.instance.startActivity(intent) @@ -258,7 +258,7 @@ fun ReportMissingEventKindButton(account: Account, kind: Int) { client.connect() val template = ChatMessageEvent.build( msg = text, - to = listOf(PTag("7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19")), + to = listOf(PTag(Amber.DEVELOPER_HEX_KEY)), createdAt = System.currentTimeMillis() / 1000, ) { val tenDaysInSeconds = 10L * 86_400