From dbd0fe03fa80c64c23b9dc98f5dfc346951a17e6 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sat, 28 Mar 2026 18:42:04 -0400 Subject: [PATCH] Adds another test case for NIP-11 --- .../nip86RelayManagement/Nip86Client.kt | 2 +- .../Nip11RelayInformationTest.kt | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/Nip86Client.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/Nip86Client.kt index bc3410627..3685bb11b 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/Nip86Client.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/Nip86Client.kt @@ -51,7 +51,7 @@ class Nip86Client( method = "POST", file = payload, ) - val signedEvent = signer.sign(template) + val signedEvent = signer.sign(template) return signedEvent.toAuthToken() } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11RelayInformationTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11RelayInformationTest.kt index 7905d5731..158e4fc3a 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11RelayInformationTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11RelayInformationTest.kt @@ -206,4 +206,81 @@ class Nip11RelayInformationTest { assertEquals("test relay", info.name) assertEquals((1..100).map { it.toString() }, info.supported_nips) } + + @Test() + fun testNostr1Com() { + val json = + """ + { + "description": "Vitor's read relay", + "name": "vitor.nostr1.com", + "pubkey": "460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c", + "software": "git+https://github.com/hoytech/strfry.git", + "supported_nips": [ + 1, + 2, + 4, + 9, + 11, + 12, + 16, + 20, + 22, + 28, + 33, + 40, + 17, + 86, + 77 + ], + "version": "strfry v315-3cff8c9", + "posting_policy": "https://vitor.nostr1.com#policy", + "limitation": { + "payment_required": false, + "max_message_length": 262200, + "max_subscriptions": 80, + "max_filters": 1000, + "max_limit": 10000, + "max_event_tags": 10000, + "max_content_length": 262140, + "min_pow_difficulty": 0, + "auth_required": false, + "created_at_lower_limit": 94608000, + "created_at_upper_limit": 900 + }, + "icon": "https://image.nostr.build/6e291df3474cab17a7c079b35e704fde319fa7cd44086684a27cddcc53c3ba07.png" + } + """.trimIndent() + + val info = Nip11RelayInformation.fromJson(json) + + assertNotNull(info) + assertEquals("vitor.nostr1.com", info.name) + assertEquals("Vitor's read relay", info.description) + assertEquals("460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c", info.pubkey) + assertEquals( + listOf( + "1", + "2", + "4", + "9", + "11", + "12", + "16", + "20", + "22", + "28", + "33", + "40", + "17", + "86", + "77", + ), + info.supported_nips, + ) + assertEquals("strfry v315-3cff8c9", info.version) + assertEquals("git+https://github.com/hoytech/strfry.git", info.software) + assertEquals("https://vitor.nostr1.com#policy", info.posting_policy) + assertEquals("https://image.nostr.build/6e291df3474cab17a7c079b35e704fde319fa7cd44086684a27cddcc53c3ba07.png", info.icon) + } }