Documentation ¶
Index ¶
- Constants
- Variables
- func DeriveChildSK(parent_SK *big.Int, index uint32) (*big.Int, error)
- func DeriveMasterSK(seed []byte) (*big.Int, error)
- func GenerateSeed(length uint8) ([]byte, error)
- type DerivationPath
- type ExtendedKey
- func (k *ExtendedKey) Address() address.Address
- func (k *ExtendedKey) Child(i uint32) (*ExtendedKey, error)
- func (k *ExtendedKey) Depth() uint8
- func (k *ExtendedKey) MarshalJSON() ([]byte, error)
- func (k *ExtendedKey) ParentFingerprint() uint32
- func (k *ExtendedKey) PrivateKey() ffi.PrivateKey
- func (k *ExtendedKey) PublicKey() ffi.PublicKey
- func (k *ExtendedKey) String() string
- func (k *ExtendedKey) UnmarshalJSON(b []byte) error
- func (k *ExtendedKey) Zero()
Constants ¶
const ( RecommendedSeedLen = 32 // 256 bits MinSeedBytes = 16 // 128 bits MaxSeedBytes = 64 // 512 bits )
const DefaultPurpose = 12381
Variables ¶
var ( ErrInvalidSeedLen = fmt.Errorf("seed length must be between %d and %d bits", MinSeedBytes*8, MaxSeedBytes*8) ErrDeriveBeyondMaxDepth = errors.New("cannot derive a key with more than 255 indices in its path") ErrInvalidKeyLen = errors.New("the provided serialized extended key length is invalid") ErrBadChecksum = errors.New("bad extended key checksum") )
Functions ¶
func DeriveChildSK ¶
noinspection ALL
func GenerateSeed ¶
Types ¶
type DerivationPath ¶
type DerivationPath []uint32
func ParseDerivationPath ¶
func ParseDerivationPath(path string, base ...DerivationPath) (DerivationPath, error)
ParseDerivationPath converts a user specified derivation path string to the internal binary representation.
Full derivation paths need to start with the `m/` prefix, relative derivation paths (which will get appended to the provided base path) must not have prefixes in front of the first element. Whitespace is ignored. Modified copy from https://github.com/ethereum/go-ethereum/blob/master/accounts/hd.go
func (DerivationPath) String ¶
func (path DerivationPath) String() string
String implements the stringer interface, converting a binary derivation path to its canonical representation.
type ExtendedKey ¶
type ExtendedKey struct {
// contains filtered or unexported fields
}
func DeriveKey ¶
func DeriveKey(master *ExtendedKey, path DerivationPath) (*ExtendedKey, error)
func NewExtendedKey ¶
func NewExtendedKey(privateKey, parentFP []byte, depth uint8, childNum uint32) *ExtendedKey
func NewKeyFromString ¶
func NewKeyFromString(key string) (*ExtendedKey, error)
NewKeyFromString returns a new extended key instance from a base58-encoded extended key.
func NewMaster ¶
func NewMaster(seed []byte) (*ExtendedKey, error)
func (*ExtendedKey) Address ¶
func (k *ExtendedKey) Address() address.Address
func (*ExtendedKey) Child ¶
func (k *ExtendedKey) Child(i uint32) (*ExtendedKey, error)
func (*ExtendedKey) Depth ¶
func (k *ExtendedKey) Depth() uint8
func (*ExtendedKey) MarshalJSON ¶
func (k *ExtendedKey) MarshalJSON() ([]byte, error)
func (*ExtendedKey) ParentFingerprint ¶
func (k *ExtendedKey) ParentFingerprint() uint32
func (*ExtendedKey) PrivateKey ¶
func (k *ExtendedKey) PrivateKey() ffi.PrivateKey
func (*ExtendedKey) PublicKey ¶
func (k *ExtendedKey) PublicKey() ffi.PublicKey
func (*ExtendedKey) String ¶
func (k *ExtendedKey) String() string
String returns the extended key as a human-readable base58-encoded string.
func (*ExtendedKey) UnmarshalJSON ¶
func (k *ExtendedKey) UnmarshalJSON(b []byte) error
func (*ExtendedKey) Zero ¶
func (k *ExtendedKey) Zero()