mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 23:36:42 +01:00
Uses the new isHex64 in the ContactList
This commit is contained in:
@@ -58,13 +58,13 @@ class ContactListEvent(
|
|||||||
/**
|
/**
|
||||||
* Returns a list of p-tags that are verified as hex keys.
|
* Returns a list of p-tags that are verified as hex keys.
|
||||||
*/
|
*/
|
||||||
fun verifiedFollowKeySet(): Set<HexKey> = tags.mapNotNullTo(HashSet(), ContactTag::parseValidKey)
|
fun verifiedFollowKeySet(): Set<HexKey> = tags.mapNotNullTo(mutableSetOf(), ContactTag::parseValidKey)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of a-tags that are verified as correct.
|
* Returns a list of a-tags that are verified as correct.
|
||||||
*/
|
*/
|
||||||
@Deprecated("Use CommunityListEvent instead.")
|
@Deprecated("Use CommunityListEvent instead.")
|
||||||
fun verifiedFollowAddressSet(): Set<HexKey> = tags.mapNotNullTo(HashSet(), ATag::parseValidAddress)
|
fun verifiedFollowAddressSet(): Set<HexKey> = tags.mapNotNullTo(mutableSetOf(), ATag::parseValidAddress)
|
||||||
|
|
||||||
fun unverifiedFollowKeySet() = tags.mapNotNull(ContactTag::parseKey)
|
fun unverifiedFollowKeySet() = tags.mapNotNull(ContactTag::parseKey)
|
||||||
|
|
||||||
|
|||||||
@@ -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.NormalizedRelayUrl
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer
|
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer
|
||||||
import com.vitorpamplona.quartz.nip19Bech32.decodePublicKey
|
import com.vitorpamplona.quartz.nip19Bech32.decodePublicKey
|
||||||
|
import com.vitorpamplona.quartz.utils.Hex
|
||||||
import com.vitorpamplona.quartz.utils.Log
|
import com.vitorpamplona.quartz.utils.Log
|
||||||
import com.vitorpamplona.quartz.utils.arrayOfNotNull
|
import com.vitorpamplona.quartz.utils.arrayOfNotNull
|
||||||
import com.vitorpamplona.quartz.utils.bytesUsedInMemory
|
import com.vitorpamplona.quartz.utils.bytesUsedInMemory
|
||||||
@@ -100,7 +101,11 @@ data class ContactTag(
|
|||||||
ensure(tag[0] == TAG_NAME) { return null }
|
ensure(tag[0] == TAG_NAME) { return null }
|
||||||
ensure(tag[1].length == 64) { return null }
|
ensure(tag[1].length == 64) { return null }
|
||||||
return try {
|
return try {
|
||||||
decodePublicKey(tag[1]).toHexKey()
|
if (Hex.isHex64(tag[1])) {
|
||||||
|
tag[1]
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.w("ContactListEvent", "Can't parse contact list pubkey ${tag.joinToString(", ")}", e)
|
Log.w("ContactListEvent", "Can't parse contact list pubkey ${tag.joinToString(", ")}", e)
|
||||||
null
|
null
|
||||||
|
|||||||
Reference in New Issue
Block a user