21 lines
373 B
Go
Raw Normal View History

2020-11-09 10:05:29 -03:00
package libwallet
import (
2021-01-29 18:51:08 -03:00
"fmt"
2020-11-09 10:05:29 -03:00
"github.com/btcsuite/btcd/btcec"
)
type PublicKey struct {
key *btcec.PublicKey
}
func NewPublicKeyFromBytes(bytes []byte) (*PublicKey, error) {
key, err := btcec.ParsePubKey(bytes, btcec.S256())
if err != nil {
2021-01-29 18:51:08 -03:00
return nil, fmt.Errorf("NewPublicKeyFromBytes: failed to parse pub key: %w", err)
2020-11-09 10:05:29 -03:00
}
return &PublicKey{key}, nil
}