wallet

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHDVersion = errors.New("Version mismatch")
	ErrHDPath    = errors.New("Invalid HD path")
	ErrHDKey     = errors.New("Invalid HD key")
)

Error codes

View Source
var (
	// CoinList of all all available BIP44 coin types
	CoinList = []*CoinSpec{}/* 308 elements not displayed */

)
View Source
var (
	ErrInvalidEntropy = fmt.Errorf("Invalid entropy data")
)

Error codes

Functions

func EntropyToWords

func EntropyToWords(ent []byte) (s string, err error)

EntropyToWords converts an entropy into a sequence of words

func WordsToEntropy

func WordsToEntropy(s string) ([]byte, string)

WordsToEntropy converts a sequence of words into an entropy. Returns the entropy OR the words where the conversion failed. If the number of words are incorrect, "#" is returned.

func WordsToSeed

func WordsToSeed(words, password string) ([]byte, string)

WordsToSeed computes a seed value for a given word list

Types

type CoinSpec

type CoinSpec struct {
	ID     int
	Symbol string
	Name   string
}

CoinSpec defines a BIP44 registered coin. (see https://github.com/satoshilabs/slips/blob/master/slip-0044.md)

type ExtendedData

type ExtendedData struct {
	Version   uint32 `order:"big"`
	Depth     uint8
	ParentFP  uint32 `order:"big"`
	Child     uint32 `order:"big"`
	Chaincode []byte `size:"32"`
	Keydata   []byte `size:"33"`
}

ExtendedData is the data structure representing ExtendedKeys (both public and private) for exchange purposes.

func NewExtendedData

func NewExtendedData() *ExtendedData

NewExtendedData alloctates a new extended data object

func ParseExtended

func ParseExtended(s string) (*ExtendedData, error)

ParseExtended returns a new data object for a given extended key string

func (*ExtendedData) String

func (d *ExtendedData) String() string

String converts an extended data object into a human-readable representation.

type ExtendedPrivateKey

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

ExtendedPrivateKey represents a private key in a HD tree

func CKDprv

func CKDprv(k *ExtendedPrivateKey, i uint32) (ki *ExtendedPrivateKey)

CKDprv is a key derivation function for private keys

func ParseExtendedPrivateKey

func ParseExtendedPrivateKey(s string) (k *ExtendedPrivateKey, err error)

ParseExtendedPrivateKey converts a xprv string to a private key

func (*ExtendedPrivateKey) Public

Public returns the associated public key

func (*ExtendedPrivateKey) String

func (k *ExtendedPrivateKey) String() string

String returns the string representation of an ExtendedPrivateKey

type ExtendedPublicKey

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

ExtendedPublicKey represents a public key in a HD tree

func CKDpub

func CKDpub(k *ExtendedPublicKey, i uint32) (ki *ExtendedPublicKey)

CKDpub is a key derivation function for public keys

func ParseExtendedPublicKey

func ParseExtendedPublicKey(s string) (k *ExtendedPublicKey, err error)

ParseExtendedPublicKey converts a xpub string to a public key

func (*ExtendedPublicKey) Clone

Clone returns a deep copy of a public key

func (*ExtendedPublicKey) Fingerprint

func (e *ExtendedPublicKey) Fingerprint() (i uint32)

Fingerprint returns the fingerprint of an ExtendedPublicKey

func (*ExtendedPublicKey) String

func (e *ExtendedPublicKey) String() string

String returns the string representation of an ExtendedPublicKey

type HD

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

HD represents a hierarchically deterministic key space.

func NewHD

func NewHD(seed []byte) *HD

NewHD initializes a new HD from a seed value.

func (*HD) Private

func (hd *HD) Private(path string) (prv *ExtendedPrivateKey, err error)

Private returns an extended private key for a given path (BIP32,BIP44)

func (*HD) Public

func (hd *HD) Public(path string) (pub *ExtendedPublicKey, err error)

Public returns an extended public key for a given path (BIP32,BIP44)

type HDPublic

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

HDPublic represents a public branch in a hierarchically deterministic key space.

func NewHDPublic

func NewHDPublic(key *ExtendedPublicKey, path string) *HDPublic

NewHDPublic initializes a new HDPublic from an extended public key with a given path.

func (*HDPublic) Public

func (hd *HDPublic) Public(path string) (pub *ExtendedPublicKey, err error)

Public returns an extended public key for a given path. The path MUST NOT contain hardened elements and must start with the path of the public key in HDPublic!

Jump to

Keyboard shortcuts

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