bip32

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2020 License: MIT Imports: 7 Imported by: 2

README

BIP32-ED25519 PkgGoDev ci codecov

golang implements for BIP32-Ed25519

Documentation

Index

Constants

View Source
const (
	XPrvSize  = 96
	XPubSize  = 64
	HardIndex = 0x80000000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type XPrv

type XPrv struct {
	// contains filtered or unexported fields
}

XPrv is exntend private key for ed25519

func NewRootXPrv

func NewRootXPrv(seed []byte) XPrv

NewRootXPrv creates XPrv by seed(bip39),the seed size should be 32 bytes at least

func NewXPrv

func NewXPrv(raw []byte) (XPrv, error)

NewXPrv creates XPrv by plain xprv bytes

func (XPrv) Bytes

func (x XPrv) Bytes() []byte

Bytes returns intenal bytes

func (XPrv) ChainCode

func (x XPrv) ChainCode() []byte

ChainCode returns chain code bytes

func (XPrv) Derive

func (x XPrv) Derive(index uint32) XPrv

Derive derives new XPrv by an index

func (XPrv) DeriveHard

func (x XPrv) DeriveHard(index uint32) XPrv

DeriveHard derives new XPrv by a hardend index

func (XPrv) PublicKey

func (x XPrv) PublicKey() []byte

PublicKey returns the public key

func (XPrv) Sign

func (x XPrv) Sign(message []byte) []byte

Sign signs message

func (XPrv) String

func (x XPrv) String() string

String implements Stringer interface and returns plain hex string

func (XPrv) Verify

func (x XPrv) Verify(msg, sig []byte) bool

Verify verifies signature by message

func (XPrv) XPub

func (x XPrv) XPub() XPub

XPub returns extends public key for current XPrv

type XPub

type XPub struct {
	// contains filtered or unexported fields
}

XPub is exntend public key for ed25519

func NewXPub

func NewXPub(raw []byte) XPub

NewXPub create XPub by plain xpub bytes

func (XPub) Bytes

func (x XPub) Bytes() []byte

Bytes returns intenal bytes

func (XPub) ChainCode

func (x XPub) ChainCode() []byte

ChainCode returns chain code bytes

func (XPub) Derive

func (x XPub) Derive(index uint32) XPub

Derive derives new XPub by a soft index

func (XPub) PublicKey

func (x XPub) PublicKey() []byte

PublicKey returns the current public key

func (XPub) String

func (x XPub) String() string

String implements Stringer interface and returns plain hex string

func (XPub) Verify

func (x XPub) Verify(msg, sig []byte) bool

Verify verifies signature by message

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL