Version: v0.0.0-...-96daba7 Latest Latest

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

Go to latest
Published: Jul 28, 2019 License: GPL-3.0 Imports: 13 Imported by: 2




View Source
const (
	ViteAccountPrefix      = "m/44'/666666'"
	VitePrimaryAccountPath = "m/44'/666666'/0'"
	ViteAccountPathFormat  = "m/44'/666666'/%d'"
	FirstHardenedIndex     = 1 << 31 // bip 44, hardened child key mast begin with 2^32



View Source
var (
	ErrInvalidPath        = errors.New("invalid derivation path")
	ErrNoPublicDerivation = errors.New("no public derivation for ed25519")


func GetPrimaryAddress

func GetPrimaryAddress(seed []byte) (*types.Address, error)

func Menmonic

func Menmonic(entropy []byte, passphrase string) error

func RandomMnemonic12

func RandomMnemonic12(passphrase string) error

func RandomMnemonic24

func RandomMnemonic24(passphrase string) error


type Key

type Key struct {
	Key       []byte
	ChainCode []byte

func DeriveForPath

func DeriveForPath(path string, seed []byte) (*Key, error)

DeriveForPath derives key for chain path in BIP-44 format and chain seed. Ed25119 derivation operated on hardened keys only.

func DeriveWithIndex

func DeriveWithIndex(i uint32, seed []byte) (*Key, error)

func NewMasterKey

func NewMasterKey(seed []byte) (*Key, error)

func (Key) Address

func (k Key) Address() (address *types.Address, err error)

func (*Key) Derive

func (k *Key) Derive(i uint32) (*Key, error)

func (Key) PrivateKey

func (k Key) PrivateKey() (ed25519.PrivateKey, error)

func (Key) PublicKey

func (k Key) PublicKey() (ed25519.PublicKey, error)

func (*Key) RawSeed

func (k *Key) RawSeed() [32]byte

func (Key) SignData

func (k Key) SignData(message []byte) (signData []byte, pub ed25519.PublicKey, err error)

func (Key) StringPair

func (k Key) StringPair() (seed string, address string, err error)

Jump to

Keyboard shortcuts

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