mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 08:47:33 +00:00
Add censorship-resistant NIP-05 verification using the Namecoin blockchain to the Desktop (JVM) app, porting functionality from PRs #1734, #1771, New files: - DesktopNamecoinNameService: app-level service wrapping the Quartz NamecoinNameResolver with caching, custom server support, and live state flows. Uses plain JVM sockets (no Tor support on Desktop yet). - DesktopNamecoinPreferences: Java Preferences API-backed persistence for Namecoin settings (enabled toggle + custom ElectrumX servers). - NamecoinSettings: Desktop copy of the settings data class (no Android dependencies). - LocalNamecoin: CompositionLocals for threading Namecoin service/prefs through the compose tree. - NamecoinSettingsSection: Compose Desktop UI for configuring ElectrumX servers — toggle, active server display with DEFAULT/CUSTOM badge, add/remove custom servers, reset to defaults. Uses onPreviewKeyEvent for Enter-to-submit instead of Android KeyboardActions. - ImportFollowListDialog: Dialog for importing follow lists via npub, hex, NIP-05, or Namecoin identifiers. Resolves identifiers to pubkeys with Namecoin blockchain support. Modified: - Main.kt: Instantiate DesktopNamecoinPreferences and DesktopNamecoinNameService in App composable, provide via CompositionLocals, wire into RelaySettingsScreen. - SearchScreen.kt: Detect Namecoin identifiers (.bit, d/, id/) in the search bar, resolve via DesktopNamecoinNameService with loading/error states, display resolved user above standard results. Uses LaunchedEffect with key-based cancellation for stale lookups. - DeckColumnContainer.kt: Pass namecoinPreferences to RelaySettingsScreen from CompositionLocal. Tests: - DesktopNamecoinPreferencesTest: round-trip persistence, add/remove servers, enable/disable, reset, duplicate handling. - NamecoinSettingsTest: server string parsing/formatting, round-trips, edge cases, toElectrumxServers conversion. The Quartz KMP library (commonMain + jvmAndroid) already contains the core Namecoin resolution code (ElectrumXClient, NamecoinNameResolver, NamecoinLookupCache) shared across Android and Desktop.