keygen

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KeyFile is a flag that contains the path where the node key will be written
	KeyFile = altsrc.NewPathFlag(&cli.PathFlag{
		Name:        "key-file",
		Value:       "./nodekey",
		Usage:       "Path to a file containing the private key for the P2P node",
		Destination: &Options.KeyFile,
		EnvVars:     []string{"WAKUNODE2_KEY_FILE"},
	})
	// KeyPassword is a flag to set the password used to encrypt the file
	KeyPassword = altsrc.NewStringFlag(&cli.StringFlag{
		Name:        "key-password",
		Value:       "secret",
		Usage:       "Password used for the private key file",
		Destination: &Options.KeyPasswd,
		EnvVars:     []string{"WAKUNODE2_KEY_PASSWORD"},
	})
	// Overwrite is a flag used to overwrite an existing key file
	Overwrite = altsrc.NewBoolFlag(&cli.BoolFlag{
		Name:        "overwrite",
		Value:       false,
		Usage:       "Overwrite the nodekey file if it already exists",
		Destination: &Options.Overwrite,
	})
)
View Source
var Command = cli.Command{
	Name:  "generate-key",
	Usage: "Generate private key file at path specified in --key-file with the password defined by --key-password",
	Action: func(cCtx *cli.Context) error {
		if err := generateKeyFile(Options.KeyFile, []byte(Options.KeyPasswd), Options.Overwrite); err != nil {
			utils.Logger().Fatal("could not write keyfile", zap.Error(err))
		}
		return nil
	},
	Flags: []cli.Flag{
		KeyFile,
		KeyPassword,
		Overwrite,
	},
}

Command generates a key file used to generate the node's peerID, encrypted with an optional password

Functions

This section is empty.

Types

type GenerateKeyOptions

type GenerateKeyOptions struct {
	KeyFile   string
	KeyPasswd string
	Overwrite bool
}

GenerateKeyOptions contains all the settings that can be used when generating a keyfile with the generate-key command

var Options GenerateKeyOptions

Options contain the settings used for generating a key file

Jump to

Keyboard shortcuts

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