diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/encoders/Nip19Bech32.kt b/quartz/src/main/java/com/vitorpamplona/quartz/encoders/Nip19Bech32.kt index 0516f1916..de2e719b3 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/encoders/Nip19Bech32.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/encoders/Nip19Bech32.kt @@ -111,6 +111,7 @@ object Nip19Bech32 { val bytes = (type + key).bechToBytes() when (type.lowercase()) { + "nsec1" -> nsec(bytes) "npub1" -> npub(bytes) "note1" -> note(bytes) "nprofile1" -> nprofile(bytes) @@ -133,6 +134,11 @@ object Nip19Bech32 { return NEmbed(Event.fromJson(ungzip(bytes))) } + private fun nsec(bytes: ByteArray): NSec? { + if (bytes.isEmpty()) return null + return NSec(bytes.toHexKey()) + } + private fun npub(bytes: ByteArray): NPub? { if (bytes.isEmpty()) return null return NPub(bytes.toHexKey())