Documentation ¶
Index ¶
- Variables
- func NewXKeys(r io.Reader) (xprv XPrv, xpub XPub, err error)
- func XPubKeys(xpubs []XPub) []sm2.PubKey
- type XPrv
- func (xprv XPrv) Bytes() []byte
- func (xprv XPrv) Child(sel []byte, hardened bool) XPrv
- func (xprv XPrv) Derive(path [][]byte) XPrv
- func (xprv XPrv) MarshalText() ([]byte, error)
- func (xprv XPrv) Sign(msg []byte) []byte
- func (xprv XPrv) String() string
- func (xprv *XPrv) UnmarshalText(inp []byte) error
- func (xprv XPrv) XPub() (xpub XPub)
- type XPub
- func (xpub XPub) Bytes() []byte
- func (xpub XPub) Child(sel []byte) (xpubkey XPub)
- func (xpub XPub) Derive(path [][]byte) XPub
- func (xpub XPub) MarshalText() ([]byte, error)
- func (xpub XPub) PublicKey() sm2.PubKey
- func (xpub XPub) String() string
- func (xpub *XPub) UnmarshalText(inp []byte) error
- func (xpub XPub) Verify(msg []byte, sig []byte) bool
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadKeyLen = errors.New("bad key length") ErrBadKeyStr = errors.New("bad key string") )
Functions ¶
Types ¶
type XPrv ¶
type XPrv [64]byte
XPrv external private key
func (XPrv) Child ¶
Child derives a child xprv based on `selector` string and `hardened` flag. If `hardened` is false, child xpub can be derived independently from the parent xpub without using the parent xprv. If `hardened` is true, child key can only be derived from the parent xprv.
func (XPrv) Derive ¶
Derive generates a child xprv by recursively deriving non-hardened child xprvs over the list of selectors: `Derive([a,b,c,...]) == Child(a).Child(b).Child(c)...`
func (XPrv) MarshalText ¶
func (*XPrv) UnmarshalText ¶
type XPub ¶
type XPub [65]byte
XPub external public key
func DeriveXPubs ¶
func (XPub) Child ¶
Child derives a child xpub based on `selector` string. The corresponding child xprv can be derived from the parent xprv using non-hardened derivation: `parentxprv.Child(sel, false)`.
func (XPub) Derive ¶
Derive generates a child xpub by recursively deriving non-hardened child xpubs over the list of selectors: `Derive([a,b,c,...]) == Child(a).Child(b).Child(c)...`