From b002f9f37e02138120892f03baec1fa6ed9645f4 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 3 Oct 2025 15:58:38 -0400 Subject: [PATCH] Uses the new isHex64 in the ContactList --- .../quartz/nip02FollowList/ContactListEvent.kt | 4 ++-- .../quartz/nip02FollowList/tags/ContactTag.kt | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/ContactListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/ContactListEvent.kt index a3f6dde13..5fd4e5d0a 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/ContactListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/ContactListEvent.kt @@ -58,13 +58,13 @@ class ContactListEvent( /** * Returns a list of p-tags that are verified as hex keys. */ - fun verifiedFollowKeySet(): Set = tags.mapNotNullTo(HashSet(), ContactTag::parseValidKey) + fun verifiedFollowKeySet(): Set = tags.mapNotNullTo(mutableSetOf(), ContactTag::parseValidKey) /** * Returns a list of a-tags that are verified as correct. */ @Deprecated("Use CommunityListEvent instead.") - fun verifiedFollowAddressSet(): Set = tags.mapNotNullTo(HashSet(), ATag::parseValidAddress) + fun verifiedFollowAddressSet(): Set = tags.mapNotNullTo(mutableSetOf(), ATag::parseValidAddress) fun unverifiedFollowKeySet() = tags.mapNotNull(ContactTag::parseKey) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/tags/ContactTag.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/tags/ContactTag.kt index ace9606d3..8320fcfcf 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/tags/ContactTag.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip02FollowList/tags/ContactTag.kt @@ -28,6 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.hints.types.PubKeyHint import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip19Bech32.decodePublicKey +import com.vitorpamplona.quartz.utils.Hex import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.arrayOfNotNull import com.vitorpamplona.quartz.utils.bytesUsedInMemory @@ -100,7 +101,11 @@ data class ContactTag( ensure(tag[0] == TAG_NAME) { return null } ensure(tag[1].length == 64) { return null } return try { - decodePublicKey(tag[1]).toHexKey() + if (Hex.isHex64(tag[1])) { + tag[1] + } else { + null + } } catch (e: Exception) { Log.w("ContactListEvent", "Can't parse contact list pubkey ${tag.joinToString(", ")}", e) null