package lnwire import ( "crypto/rand" "encoding/hex" "github.com/btcsuite/btcd/btcec/v2" ) // pubkeyFromHex parses a Bitcoin public key from a hex encoded string. func pubkeyFromHex(keyHex string) (*btcec.PublicKey, error) { bytes, err := hex.DecodeString(keyHex) if err != nil { return nil, err } return btcec.ParsePubKey(bytes) } // generateRandomBytes returns a slice of n random bytes. func generateRandomBytes(n int) ([]byte, error) { b := make([]byte, n) _, err := rand.Read(b) if err != nil { return nil, err } return b, nil }