mirror of
https://github.com/muun/recovery.git
synced 2025-02-23 11:32:33 -05:00
20 lines
388 B
Go
20 lines
388 B
Go
|
package libwallet
|
||
|
|
||
|
import (
|
||
|
"github.com/btcsuite/btcd/btcec"
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
type PublicKey struct {
|
||
|
key *btcec.PublicKey
|
||
|
}
|
||
|
|
||
|
func NewPublicKeyFromBytes(bytes []byte) (*PublicKey, error) {
|
||
|
key, err := btcec.ParsePubKey(bytes, btcec.S256())
|
||
|
if err != nil {
|
||
|
return nil, errors.Wrapf(err, "NewPublicKeyFromBytes: failed to parse pub key")
|
||
|
}
|
||
|
|
||
|
return &PublicKey{key}, nil
|
||
|
}
|