bip39

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitLengthToWordLength

func BitLengthToWordLength(bitLength uint) (uint, error)

BitLengthToWordLength returns the length of words for specified bit-length.

func GetWord

func GetWord(lang Language, index int64) (string, error)

GetWord returns a word for the given language at the index

func WordLengthToBitLength

func WordLengthToBitLength(n uint) (uint, error)

WordLengthToBitLength returns the length in bits for specified word length.

Types

type Language

type Language string

Language type indicates supported mnemonic languages

const (
	// English language
	English Language = "english"

	// Japanese language
	Japanese Language = "japanese"

	// Korean language
	Korean Language = "korean"

	// Spanish language
	Spanish Language = "spanish"

	// ChineseSimplified language
	ChineseSimplified Language = "chineseSimplified"

	// ChineseTraditional language
	ChineseTraditional Language = "chineseTraditional"

	// French Language
	French Language = "french"

	// Italian Language
	Italian Language = "italian"
)

type Mnemonic

type Mnemonic struct {
	Words    []string
	Language Language
}

Mnemonic represents a collection of human readable words used for HD wallet seed generation

func New

func New(ent []byte, lang Language) (*Mnemonic, error)

New returns a new Mnemonic for the given entropy and language

func NewRandom

func NewRandom(length int, lang Language) (*Mnemonic, error)

NewRandom returns a new Mnemonic with random entropy of the given length in bits

func (*Mnemonic) GenerateSeed

func (m *Mnemonic) GenerateSeed(passphrase string) *Seed

GenerateSeed returns a seed used for wallet generation per BIP-0032 or similar method. The internal Words set of the Mnemonic will be used

func (*Mnemonic) Sentence

func (m *Mnemonic) Sentence() string

Sentence returns a Mnemonic's word collection as a space separated sentence

type Seed

type Seed struct {
	Bytes []byte
}

Seed represents a binary seed used for HD wallet generation

func NewSeed

func NewSeed(sentence string, passphrase string) *Seed

NewSeed creae a new Seed with the given sentence and passphrase

func (*Seed) String

func (s *Seed) String() string

func (*Seed) ToHex

func (s *Seed) ToHex() string

ToHex returns the seed bytes as a hex encoded string

Jump to

Keyboard shortcuts

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