wallet

package
v1.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TextileAccountPrefix is a prefix for Textile key pairs derivation.
	TextileAccountPrefix = "m/44'/406'"
	// TextilePrimaryAccountPath is a derivation path of the primary account.
	TextilePrimaryAccountPath = "m/44'/406'/0'"
	// TextileAccountPathFormat is a path format used for Textile key pair
	// derivation as described in SEP-00XX. Use with `fmt.Sprintf` and `DeriveForPath`.
	TextileAccountPathFormat = "m/44'/406'/%d'"
	// FirstHardenedIndex is the index of the first hardened key.
	FirstHardenedIndex = uint32(0x80000000)
)

Variables

View Source
var (
	ErrInvalidPath        = errors.New("invalid derivation path")
	ErrNoPublicDerivation = errors.New("no public derivation for ed25519")
)
View Source
var ErrInvalidWordCount = errors.New("invalid word count (must be 12, 15, 18, 21, or 24)")

Functions

func IsValidPath

func IsValidPath(path string) bool

IsValidPath check whether or not the path has valid segments.

Types

type Key

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

func DeriveForPath

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

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

func NewMasterKey

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

NewMasterKey generates a new master key from seed.

func (*Key) Derive

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

func (*Key) PublicKey

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

PublicKey returns public key for a derived private key.

func (*Key) RawSeed

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

RawSeed returns raw seed bytes

type Wallet

type Wallet struct {
	RecoveryPhrase string
}

Wallet is a BIP32 Hierarchical Deterministic Wallet based on stellar's implementation of https://github.com/satoshilabs/slips/blob/master/slip-0010.md, https://github.com/stellar/stellar-protocol/pull/63

func NewWallet

func NewWallet(entropySize int) (*Wallet, error)

NewWallet creates a new wallet with the given entropy size

func NewWalletFromRecoveryPhrase

func NewWalletFromRecoveryPhrase(mnemonic string) *Wallet

func (*Wallet) AccountAt

func (w *Wallet) AccountAt(index int, password string) (*keypair.Full, error)

type WordCount

type WordCount int
const (
	TwelveWords     WordCount = 12
	FifteenWords    WordCount = 15
	EighteenWords   WordCount = 18
	TwentyOneWords  WordCount = 21
	TwentyFourWords WordCount = 24
)

func NewWordCount

func NewWordCount(cnt int) (*WordCount, error)

func (WordCount) EntropySize

func (w WordCount) EntropySize() int

Jump to

Keyboard shortcuts

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