mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
update nip04 to btcec/v2
This commit is contained in:
parent
fb29445ef9
commit
4a3aea6d4b
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user