mnemonic

package
v0.1.63 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MnemonicCmd = &cobra.Command{
	Use:   "mnemonic",
	Short: "Generate a BIP39 mnemonic seed.",
	Long:  "",
	RunE: func(cmd *cobra.Command, args []string) error {
		mnemonic, err := hdwallet.NewMnemonic(*inputMnemonicWords, *inputMnemonicLang)
		if err != nil {
			return err
		}
		cmd.Println(mnemonic)
		return nil
	},
	PreRunE: func(cmd *cobra.Command, args []string) error {
		if *inputMnemonicWords < 12 {
			return fmt.Errorf("the number of words in the mnemonic must be 12 or more. Given: %d", *inputMnemonicWords)
		}
		if *inputMnemonicWords > 24 {
			return fmt.Errorf("the number of words in the mnemonic must be 24 or less. Given: %d", *inputMnemonicWords)
		}
		if *inputMnemonicWords%3 != 0 {
			return fmt.Errorf("the number of words in the mnemonic must be a multiple of 3")
		}
		return nil

	},
}

mnemonicCmd represents the mnemonic command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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