Testing that both 02 and 03 compressed keys are valid Nostr keys and can encrypt and decrypt to each other.

This commit is contained in:
Vitor Pamplona
2024-07-29 19:23:22 -04:00
parent b440661e0d
commit 143c3a1444
3 changed files with 51 additions and 1 deletions
@@ -33,7 +33,9 @@ class Nip01(
/** Provides a 32B "private key" aka random number */
fun privkeyCreate() = random(32)
fun pubkeyCreate(privKey: ByteArray) = secp256k1.pubKeyCompress(secp256k1.pubkeyCreate(privKey)).copyOfRange(1, 33)
fun compressedPubkeyCreate(privKey: ByteArray) = secp256k1.pubKeyCompress(secp256k1.pubkeyCreate(privKey))
fun pubkeyCreate(privKey: ByteArray) = compressedPubkeyCreate(privKey).copyOfRange(1, 33)
fun sign(
data: ByteArray,