Moves lud06 to lud16 mapping to Quartz

This commit is contained in:
Vitor Pamplona
2026-02-07 12:29:13 -05:00
parent 4e39a531b7
commit 03e8316db4
2 changed files with 13 additions and 13 deletions
@@ -157,20 +157,9 @@ class User(
metaEvent: MetadataEvent,
) {
newUserInfo.cleanBlankNames()
newUserInfo.convertLud06toLud16IfNeeded()
// converts lud06 to lud16
if (newUserInfo.lud16.isNullOrBlank()) {
newUserInfo.lud06?.let {
if (it.lowercase().startsWith("lnurl")) {
newUserInfo.lud16 = Lud06().toLud16(it)
}
}
}
val metadata = metadata()
metadata.newMetadata(newUserInfo, metaEvent)
metadata().newMetadata(newUserInfo, metaEvent)
// doesn't create Nip05 unless needed.
nip05StateOrNull()?.newMetadata(newUserInfo.nip05, metaEvent.pubKey)
}
@@ -21,6 +21,7 @@
package com.vitorpamplona.quartz.nip01Core.metadata
import androidx.compose.runtime.Stable
import com.vitorpamplona.quartz.lightning.Lud06
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@@ -102,4 +103,14 @@ class UserMetadata {
if (domain?.isBlank() == true) domain = null
if (pronouns?.isBlank() == true) pronouns = null
}
fun convertLud06toLud16IfNeeded() {
if (lud16.isNullOrBlank()) {
lud06?.let {
if (it.lowercase().startsWith("lnurl")) {
lud16 = Lud06().toLud16(it)
}
}
}
}
}