Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Entropy bit lengths EntropyBits128 = 128 EntropyBits160 = 160 EntropyBits192 = 192 EntropyBits224 = 224 EntropyBits256 = 256 )
Constants
View Source
const ( // Words number WordsNum12 = 12 WordsNum15 = 15 WordsNum18 = 18 WordsNum21 = 21 WordsNum24 = 24 )
Constants
Variables ¶
View Source
var ( // ErrWordsNum is returned when trying to generate mnemonic with invalid words number ErrWordsNum = errors.New("The specified words number is not valid for mnemonic generation") // ErrInvalidWord is returned when trying to get entropy or validating a mnemonic with invalid words ErrInvalidWord = errors.New("The mnemonic contains an invalid word") // ErrChecksum is returned when trying to get entropy or validating a mnemonic with invalid checksum ErrChecksum = errors.New("The checksum of the mnemonic is not valid") )
Variables
View Source
var ( // ErrBinaryString is returned when trying to convert an invalid binary string to byte slice ErrBinaryString = errors.New("The specified binary string is not valid") )
Variables
View Source
var ( // ErrEntropyBitLen is returned when trying to generate entropy with invalid bit length ErrEntropyBitLen = errors.New("The specified bit length is not valid for entropy generation") )
Variables
Functions ¶
func GenerateEntropy ¶
Generate entropy bytes with the specified bit length.
Types ¶
type Mnemonic ¶
type Mnemonic struct {
Words string
}
Structure for mnemonic
func MnemonicFromEntropy ¶
Generate mnemonic from the specific entropy. The entropy slice shall be of a valid length.
func MnemonicFromString ¶
Create mnemonic object from a mnemonic string.
func MnemonicFromWordsNum ¶
Generate mnemonic from the specified words number. A random entropy is used for generating mnemonic.
func (*Mnemonic) GenerateSeed ¶
Generate the seed from a mnemonic using the specified passphrase for protection.
func (*Mnemonic) IsValid ¶
Get if a mnemonic is valid. It's the same of the Validate method but returns bool instead of error.
Click to show internal directories.
Click to hide internal directories.