Improves the name of the NIP01 Crypto object

This commit is contained in:
Vitor Pamplona
2026-02-18 11:29:56 -05:00
parent 907ff6e844
commit 64c8c0edfd
21 changed files with 64 additions and 63 deletions
@@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.model.Note
import com.vitorpamplona.amethyst.model.User
import com.vitorpamplona.quartz.nip01Core.core.Address
import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.nip19Bech32.Nip19Parser
import com.vitorpamplona.quartz.nip19Bech32.bech32.Bech32
import com.vitorpamplona.quartz.nip19Bech32.bech32.bechToBytes
@@ -197,7 +197,7 @@ class NewMessageTagger(
val restOfWord = key.substring(63)
// Converts to npub
val pubkey =
Nip19Parser.uriToRoute(Nip01.pubKeyCreate(keyB32.bechToBytes()).toNpub()) ?: return null
Nip19Parser.uriToRoute(Nip01Crypto.pubKeyCreate(keyB32.bechToBytes()).toNpub()) ?: return null
return DirtyKeyInfo(pubkey, restOfWord.ifEmpty { null })
} else if (key.startsWith("npub1", true)) {
@@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.benchmark
import androidx.benchmark.junit4.BenchmarkRule
import androidx.benchmark.junit4.measureRepeated
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.nip44Encryption.Nip44v2
import com.vitorpamplona.quartz.nip44Encryption.crypto.ChaCha20
import com.vitorpamplona.quartz.utils.RandomInstance
@@ -39,8 +39,8 @@ class ChaCha20Benchmark {
val nip44v2 = Nip44v2()
val msg = "Hi, how are you? this is supposed to be representative of an average message on Nostr"
val privateKey = Nip01.privKeyCreate()
val publicKey = Nip01.pubKeyCreate(privateKey)
val privateKey = Nip01Crypto.privKeyCreate()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey)
val sharedKey = nip44v2.getConversationKey(privateKey, publicKey)
@@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.benchmark
import androidx.benchmark.junit4.BenchmarkRule
import androidx.benchmark.junit4.measureRepeated
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.nip44Encryption.Nip44v2
import com.vitorpamplona.quartz.nip44Encryption.crypto.Hkdf
import org.junit.Rule
@@ -38,8 +38,8 @@ class HkdfBenchmark {
val nip44v2 = Nip44v2()
val msg = "Hi, how are you? this is supposed to be representative of an average message on Nostr"
val privateKey = Nip01.privKeyCreate()
val publicKey = Nip01.pubKeyCreate(privateKey)
val privateKey = Nip01Crypto.privKeyCreate()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey)
val sharedKey = nip44v2.getConversationKey(privateKey, publicKey)
val encrypted = nip44v2.encrypt(msg, sharedKey)
@@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.benchmark
import androidx.benchmark.junit4.BenchmarkRule
import androidx.benchmark.junit4.measureRepeated
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.nip44Encryption.Nip44v2
import org.junit.Rule
import org.junit.Test
@@ -37,8 +37,8 @@ class Nip44EncryptDecryptBenchmark {
val nip44v2 = Nip44v2()
val msg = "Hi, how are you? this is supposed to be representative of an average message on Nostr"
val privateKey = Nip01.privKeyCreate()
val publicKey = Nip01.pubKeyCreate(privateKey)
val privateKey = Nip01Crypto.privKeyCreate()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey)
val sharedKey = nip44v2.getConversationKey(privateKey, publicKey)
val encrypted = nip44v2.encrypt(msg, sharedKey)
@@ -24,7 +24,7 @@ import androidx.benchmark.junit4.BenchmarkRule
import androidx.benchmark.junit4.measureRepeated
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.utils.RandomInstance
import com.vitorpamplona.quartz.utils.sha256.sha256
import junit.framework.TestCase.assertNotNull
@@ -42,17 +42,17 @@ class SignVerifyBenchmark {
val keyPair = KeyPair()
val msg = sha256(RandomInstance.bytes(1000))
benchmarkRule.measureRepeated { assertNotNull(Nip01.sign(msg, keyPair.privKey!!)) }
benchmarkRule.measureRepeated { assertNotNull(Nip01Crypto.sign(msg, keyPair.privKey!!)) }
}
@Test
fun verify() {
val keyPair = KeyPair()
val msg = sha256(RandomInstance.bytes(1000))
val signature = Nip01.sign(msg, keyPair.privKey!!)
val signature = Nip01Crypto.sign(msg, keyPair.privKey!!)
benchmarkRule.measureRepeated {
assertTrue(Nip01.verify(signature, msg, keyPair.pubKey))
assertTrue(Nip01Crypto.verify(signature, msg, keyPair.pubKey))
}
}
}
@@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.bloom
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.utils.RandomInstance
import com.vitorpamplona.quartz.utils.sha256.Sha256Hasher
import org.junit.Assert.assertEquals
@@ -135,7 +135,7 @@ class BloomFilterTest {
var failureCounter = 0
for (seed in 0..1000000) {
if (bloomFilter.mightContains(Nip01.pubKeyCreate(Nip01.privKeyCreate()))) {
if (bloomFilter.mightContains(Nip01Crypto.pubKeyCreate(Nip01Crypto.privKeyCreate()))) {
failureCounter++
}
}
@@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.nip01Core
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.utils.Secp256k1Instance
import com.vitorpamplona.quartz.utils.sha256.sha256
import org.junit.Assert.assertEquals
@@ -33,14 +33,14 @@ import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class Nip01Test {
class Nip01CryptoTest {
private val privateKey = "f410f88bcec6cbfda04d6a273c7b1dd8bba144cd45b71e87109cfa11dd7ed561".hexToByteArray()
@Test
fun testGetPublicFromPrivateKey() {
assertEquals(
"7d4b8806f1fd713c287235411bf95aa81b7242ead892733ec84b3f2719845be6",
Nip01.pubKeyCreate(privateKey).toHexKey(),
Nip01Crypto.pubKeyCreate(privateKey).toHexKey(),
)
}
@@ -66,7 +66,7 @@ class Nip01Test {
fun testDeterministicSign() {
assertEquals(
"1484d0e0bd62165e822e31f1f4cc8e1ce8e20c30a060e24fb0ecd7baf7c624f661fb7a3e4f0ddb43018e5f0b4892c929af64d8b7a86021aa081ec8231e3dfa37",
Nip01.sign(sha256("Test".toByteArray()), privateKey, null).toHexKey(),
Nip01Crypto.sign(sha256("Test".toByteArray()), privateKey, null).toHexKey(),
)
}
@@ -81,10 +81,10 @@ class Nip01Test {
@Test
fun testDeterministicVerify() {
assertTrue(
Nip01.verify(
Nip01Crypto.verify(
"1484d0e0bd62165e822e31f1f4cc8e1ce8e20c30a060e24fb0ecd7baf7c624f661fb7a3e4f0ddb43018e5f0b4892c929af64d8b7a86021aa081ec8231e3dfa37".hexToByteArray(),
sha256("Test".toByteArray()),
Nip01.pubKeyCreate(privateKey),
Nip01Crypto.pubKeyCreate(privateKey),
),
)
}
@@ -93,18 +93,18 @@ class Nip01Test {
fun testNonDeterministicSign() {
assertNotEquals(
"1484d0e0bd62165e822e31f1f4cc8e1ce8e20c30a060e24fb0ecd7baf7c624f661fb7a3e4f0ddb43018e5f0b4892c929af64d8b7a86021aa081ec8231e3dfa37",
Nip01.sign(sha256("Test".toByteArray()), privateKey).toHexKey(),
Nip01Crypto.sign(sha256("Test".toByteArray()), privateKey).toHexKey(),
)
}
@Test
fun testNonDeterministicSignVerify() {
val signature = Nip01.sign(sha256("Test".toByteArray()), privateKey)
val signature = Nip01Crypto.sign(sha256("Test".toByteArray()), privateKey)
assertTrue(
Nip01.verify(
Nip01Crypto.verify(
signature,
sha256("Test".toByteArray()),
Nip01.pubKeyCreate(privateKey),
Nip01Crypto.pubKeyCreate(privateKey),
),
)
}
@@ -33,7 +33,7 @@ class Nip01CryptoTest {
fun testGetPublicFromPrivateKey() {
val privateKey =
"f410f88bcec6cbfda04d6a273c7b1dd8bba144cd45b71e87109cfa11dd7ed561".hexToByteArray()
val publicKey = Nip01.pubKeyCreate(privateKey).toHexKey()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey).toHexKey()
assertEquals("7d4b8806f1fd713c287235411bf95aa81b7242ead892733ec84b3f2719845be6", publicKey)
}
}
@@ -22,7 +22,7 @@ package com.vitorpamplona.quartz.nip04Dm
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.nip04Dm.crypto.EncryptedInfo
import com.vitorpamplona.quartz.nip04Dm.crypto.Encryption
import org.junit.Assert.assertEquals
@@ -34,8 +34,8 @@ class EncryptionTest {
val sk1 = "91ba716fa9e7ea2fcbad360cf4f8e0d312f73984da63d90f524ad61a6a1e7dbe".hexToByteArray()
val sk2 = "96f6fa197aa07477ab88f6981118466ae3a982faab8ad5db9d5426870c73d220".hexToByteArray()
val pk1 = Nip01.pubKeyCreate(sk1)
val pk2 = Nip01.pubKeyCreate(sk2)
val pk1 = Nip01Crypto.pubKeyCreate(sk1)
val pk2 = Nip01Crypto.pubKeyCreate(sk2)
val expectedShared = "7ce22696eb0e303ddaa491bdf2a56b79d249f2d861b8e012a933e01dc4beba81"
@@ -21,7 +21,7 @@
package com.vitorpamplona.quartz.nip04Dm
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.nip04Dm.crypto.Nip04
import org.junit.Assert.assertEquals
import org.junit.Test
@@ -33,8 +33,8 @@ class Nip04Test {
fun encryptDecryptNIP4Test() {
val msg = "Hi"
val privateKey = Nip01.privKeyCreate()
val publicKey = Nip01.pubKeyCreate(privateKey)
val privateKey = Nip01Crypto.privKeyCreate()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey)
val encrypted = Nip04.encrypt(msg, privateKey, publicKey)
val decrypted = Nip04.decrypt(encrypted, privateKey, publicKey)
@@ -46,8 +46,8 @@ class Nip04Test {
fun encryptSharedSecretDecryptNIP4Test() {
val msg = "Hi"
val privateKey = Nip01.privKeyCreate()
val publicKey = Nip01.pubKeyCreate(privateKey)
val privateKey = Nip01Crypto.privKeyCreate()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey)
val encrypted = Nip04.encrypt(msg, privateKey, publicKey)
val decrypted = Nip04.decrypt(encrypted, privateKey, publicKey)
@@ -24,7 +24,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -68,8 +68,8 @@ class Nip44v1Test {
fun encryptDecrypt() {
val msg = "Hi"
val privateKey = Nip01.privKeyCreate()
val publicKey = Nip01.pubKeyCreate(privateKey)
val privateKey = Nip01Crypto.privKeyCreate()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey)
val encrypted = nip44v1.encrypt(msg, privateKey, publicKey)
val decrypted = nip44v1.decrypt(encrypted, privateKey, publicKey)
@@ -81,8 +81,8 @@ class Nip44v1Test {
fun encryptDecryptSharedSecret() {
val msg = "Hi"
val privateKey = Nip01.privKeyCreate()
val publicKey = Nip01.pubKeyCreate(privateKey)
val privateKey = Nip01Crypto.privKeyCreate()
val publicKey = Nip01Crypto.pubKeyCreate(privateKey)
val sharedSecret = nip44v1.getSharedSecret(privateKey, publicKey)
@@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.JsonMapper
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.utils.RandomInstance
import com.vitorpamplona.quartz.utils.sha256.sha256
import junit.framework.TestCase.assertNotNull
@@ -68,8 +68,8 @@ class Nip44v2Test {
val privateKeyA = "f410f88bcec6cbfda04d6a273c7b1dd8bba144cd45b71e87109cfa11dd7ed561".hexToByteArray()
val privateKeyB = "65f039136f8da8d3e87b4818746b53318d5481e24b2673f162815144223a0b5a".hexToByteArray()
val publicKeyA = Nip01.pubKeyCreate(privateKeyA)
val publicKeyB = Nip01.pubKeyCreate(privateKeyB)
val publicKeyA = Nip01Crypto.pubKeyCreate(privateKeyA)
val publicKeyB = Nip01Crypto.pubKeyCreate(privateKeyB)
assertEquals(
nip44v2.getConversationKey(privateKeyA, publicKeyB).toHexKey(),
@@ -82,8 +82,8 @@ class Nip44v2Test {
val privateKeyA = "f410f88bcec6cbfda04d6a273c7b1dd8bba144cd45b71e87109cfa11dd7ed561".hexToByteArray()
val privateKeyB = "e6159851715b4aa6190c22b899b0c792847de0a4435ac5b678f35738351c43b0".hexToByteArray()
val publicKeyA = Nip01.pubKeyCreate(privateKeyA)
val publicKeyB = Nip01.pubKeyCreate(privateKeyB)
val publicKeyA = Nip01Crypto.pubKeyCreate(privateKeyA)
val publicKeyB = Nip01Crypto.pubKeyCreate(privateKeyB)
assertEquals(
nip44v2.getConversationKey(privateKeyA, publicKeyB).toHexKey(),
@@ -24,7 +24,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -37,7 +37,7 @@ class SignStringTest {
val message = "8e58c8251bb406b6ded69e9eb14f55282a9a53bdab16fc49a3218c2ad3abc887".hexToByteArray()
val keyPair = KeyPair("a5ab474552c8f9c46c2eda5a0b68f27430ad81f96cb405e0cb4e34bf0c6494a2".hexToByteArray())
val signedMessage = Nip01.sign(message, keyPair.privKey!!, random).toHexKey()
val signedMessage = Nip01Crypto.sign(message, keyPair.privKey!!, random).toHexKey()
val expectedValue = "0f9be7e01ba53d5ee6874b9180c7956269fda7a5be424634c3d17b5cfcea6da001be89183876415ba08b7dafa6cff4555e393dc228fb8769b384344e9a27b77c"
assertEquals(expectedValue, signedMessage)
@@ -20,7 +20,7 @@
*/
package com.vitorpamplona.quartz.nip55AndroidSigner
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.utils.RandomInstance
import com.vitorpamplona.quartz.utils.sha256.sha256
@@ -28,4 +28,4 @@ fun signString(
message: String,
privKey: ByteArray,
nonce: ByteArray = RandomInstance.bytes(32),
): ByteArray = Nip01.sign(sha256(message.toByteArray()), privKey, nonce)
): ByteArray = Nip01Crypto.sign(sha256(message.toByteArray()), privKey, nonce)
@@ -38,7 +38,7 @@ class EventAssembler {
nonce: ByteArray? = RandomInstance.bytes(32),
): T {
val id = EventHasher.hashIdBytes(pubKey, createdAt, kind, tags, content)
val sig = Nip01.sign(id, privKey, nonce).toHexKey()
val sig = Nip01Crypto.sign(id, privKey, nonce).toHexKey()
return EventFactory.create(
id.toHexKey(),
@@ -33,7 +33,7 @@ fun Event.verifyId(): Boolean {
fun Event.verifySignature(): Boolean {
if (id.isEmpty() || sig.isEmpty()) return false
return Nip01.verify(Hex.decode(sig), Hex.decode(id), Hex.decode(pubKey))
return Nip01Crypto.verify(Hex.decode(sig), Hex.decode(id), Hex.decode(pubKey))
}
/** Checks if the ID is correct and then if the pubKey's secret key signed the event. */
@@ -34,8 +34,8 @@ class KeyPair(
if (privKey == null) {
if (pubKey == null) {
// create new, random keys
this.privKey = Nip01.privKeyCreate()
this.pubKey = Nip01.pubKeyCreate(this.privKey)
this.privKey = Nip01Crypto.privKeyCreate()
this.pubKey = Nip01Crypto.pubKeyCreate(this.privKey)
} else {
// this is a read-only account
check(pubKey.size == 32)
@@ -46,7 +46,7 @@ class KeyPair(
// as private key is provided, ignore the public key and set keys according to private key
this.privKey = privKey
if (pubKey == null || forceReplacePubkey) {
this.pubKey = Nip01.pubKeyCreate(privKey)
this.pubKey = Nip01Crypto.pubKeyCreate(privKey)
} else {
this.pubKey = pubKey
}
@@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.nip01Core.crypto
import com.vitorpamplona.quartz.utils.RandomInstance
import com.vitorpamplona.quartz.utils.Secp256k1Instance
object Nip01 {
object Nip01Crypto {
fun privKeyCreate() = RandomInstance.bytes(32)
fun pubKeyCreate(privKey: ByteArray) = Secp256k1Instance.compressedPubKeyFor(privKey).copyOfRange(1, 33)
@@ -24,7 +24,6 @@ import androidx.compose.runtime.Immutable
import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip19Bech32.bech32.bechToBytes
import com.vitorpamplona.quartz.nip19Bech32.entities.Entity
import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress
@@ -175,7 +174,7 @@ object Nip19Parser {
fun decodePublicKey(key: String): ByteArray =
when (val parsed = Nip19Parser.uriToRoute(key)?.entity) {
is NSec -> Nip01.pubKeyCreate(parsed.hex.hexToByteArray())
is NSec -> parsed.toPubKey()
is NPub -> parsed.hex.hexToByteArray()
is NProfile -> parsed.hex.hexToByteArray()
else -> Hex.decode(key) // crashes on purpose
@@ -202,7 +201,7 @@ fun decodePrivateKeyAsHexOrNull(key: String): HexKey? =
fun decodePublicKeyAsHexOrNull(key: String): HexKey? =
try {
when (val parsed = Nip19Parser.uriToRoute(key)?.entity) {
is NSec -> Nip01.pubKeyCreate(parsed.hex.hexToByteArray()).toHexKey()
is NSec -> parsed.toPubKeyHex()
is NPub -> parsed.hex
is NProfile -> parsed.hex
is NNote -> null
@@ -23,13 +23,15 @@ package com.vitorpamplona.quartz.nip19Bech32.entities
import androidx.compose.runtime.Immutable
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
@Immutable
data class NSec(
val hex: String,
) : Entity {
fun toPubKeyHex() = Nip01.pubKeyCreate(hex.hexToByteArray()).toHexKey()
fun toPubKey() = Nip01Crypto.pubKeyCreate(hex.hexToByteArray())
fun toPubKeyHex() = toPubKey().toHexKey()
companion object {
fun parse(bytes: ByteArray): NSec? {
@@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01
import com.vitorpamplona.quartz.nip01Core.crypto.Nip01Crypto
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
import com.vitorpamplona.quartz.nip01Core.signers.SignerExceptions
@@ -106,7 +106,7 @@ class PrivateZapRequestBuilder {
try {
if (altPubkeyToUse != null) {
val altPubKeyFromPrivate = Nip01.pubKeyCreate(myPrivateKeyForThisEvent).toHexKey()
val altPubKeyFromPrivate = Nip01Crypto.pubKeyCreate(myPrivateKeyForThisEvent).toHexKey()
if (altPubKeyFromPrivate == event.pubKey) {
// the sender is logged in.