From 4a3aea6d4b1d66b1061f0cfb8648baa8da71280c Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 11 Dec 2022 16:35:42 -0300 Subject: [PATCH] update nip04 to btcec/v2 --- nip04/nip04.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nip04/nip04.go b/nip04/nip04.go index 4d2c054..c2d990e 100644 --- a/nip04/nip04.go +++ b/nip04/nip04.go @@ -10,7 +10,7 @@ import ( "fmt" "strings" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" ) // ECDH @@ -19,14 +19,14 @@ func ComputeSharedSecret(senderPrivKey string, receiverPubKey string) (sharedSec if err != nil { return nil, fmt.Errorf("Error decoding sender private key: %s. \n", err) } - privKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), privKeyBytes) + privKey, _ := btcec.PrivKeyFromBytes(privKeyBytes) // adding 02 to signal that this is a compressed public key (33 bytes) pubKeyBytes, err := hex.DecodeString("02" + receiverPubKey) if err != nil { return nil, fmt.Errorf("Error decoding hex string of receiver public key: %s. \n", err) } - pubKey, err := btcec.ParsePubKey(pubKeyBytes, btcec.S256()) + pubKey, err := btcec.ParsePubKey(pubKeyBytes) if err != nil { return nil, fmt.Errorf("Error parsing receiver public key: %s. \n", err) }