wallet

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: MIT Imports: 11 Imported by: 2

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        = fmt.Errorf("invalid derivation path")
	ErrNoPublicDerivation = fmt.Errorf("no public derivation for ed25519")
)
View Source
var ErrInvalidWordCount = fmt.Errorf("invalid word count (must be 12, 15, 18, 21, or 24)")

Functions

func IsValidPath added in v0.1.10

func IsValidPath(path string) bool

IsValidPath check whether or not the path has valid segments.

Types

type Key added in v0.1.10

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

func DeriveForPath added in v0.1.10

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 added in v0.1.10

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

NewMasterKey generates a new master key from seed.

func (*Key) Derive added in v0.1.10

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

func (*Key) PublicKey added in v0.1.10

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

PublicKey returns public key for a derived private key.

func (*Key) RawSeed added in v0.1.10

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 added in v0.1.10

func NewWalletFromRecoveryPhrase(mnemonic string) *Wallet

func (*Wallet) AccountAt added in v0.1.10

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

type WordCount added in v0.1.10

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

func NewWordCount added in v0.1.10

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

func (WordCount) EntropySize added in v0.1.10

func (w WordCount) EntropySize() int

Jump to

Keyboard shortcuts

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