mnemonics

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 9

Documentation

Index

Constants

View Source
const (
	LanguageEnglish            = "English"
	LanguageJapanese           = "Japanese"
	LanguageChineseSimplified  = "ChineseSimplified"
	LanguageChineseTraditional = "ChineseTraditional"
	LanguageCzech              = "Czech"
	LanguageFrench             = "French"
	LanguageItalian            = "Italian"
	LanguageKorean             = "Korean"
	LanguageSpanish            = "Spanish"
)

Variables

This section is empty.

Functions

func New

func New(length int, language string) (string, error)

New generates a new mnemonic of specified length and for requested input language.

func NewFromEntropy

func NewFromEntropy(entropy []byte, language string) (string, error)

NewFromEntropy generates new mnemonic sequence from a valid length of entropy bytes. Valid lengths are 16, 20, 24, 28, 32.

func NewFromFields

func NewFromFields(fields []string) string

NewFromFields generates a new mnemonic sentence using input fields

func Prompt

func Prompt(w io.Writer) error

Prompt prompts for new mnemonic

func Read

func Read(r io.Reader) (string, error)

Read reads a new mnemonic from input. It splits input into fields and then recombines them to ensure that the mnemonic is not affected by extra whitespaces and/or trailing newline char

func SetLanguage

func SetLanguage(language string) error

SetLanguage sets language for mnemonic generation and validation

func Tidy

func Tidy(mnemonic string) string

Tidy ensures that the mnemonic sentence does not have extra white spaces or trailing newlines. Since mnemonic sentence is used in cryptographic seed generation it is necessary to make sure that same seed is generated if the fields are the same irrespective of spacing between them

func Translate

func Translate(mnemonic, fromLanguage, toLanguage string) (string, error)

Translate translates mnemonic in a way that the underlying entropy is preserved

func Validate

func Validate(mnemonic string, language ...string) error

Validate validates mnemonic with default language to be english. please note that despite language input being variadic, at most only one value is accepted

Types

This section is empty.

Jump to

Keyboard shortcuts

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