keys

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyTypeECDSA = "ecdsa"
	KeyTypeBLS   = "bls"

	// MinEntropyBits For password validation
	MinEntropyBits = 70
)

Variables

View Source
var (
	ErrInvalidNumberOfArgs           = errors.New("invalid number of arguments")
	ErrEmptyKeyName                  = errors.New("key name cannot be empty")
	ErrEmptyPrivateKey               = errors.New("private key cannot be empty")
	ErrKeyContainsWhitespaces        = errors.New("key name cannot contain spaces")
	ErrPrivateKeyContainsWhitespaces = errors.New("private key cannot contain spaces")
	ErrInvalidKeyType                = errors.New("invalid key type. key type must be either 'ecdsa' or 'bls'")
	ErrInvalidPassword               = errors.New("invalid password")
	ErrInvalidHexPrivateKey          = errors.New("invalid hex private key")
)
View Source
var (
	KeyTypeFlag = StringFlag{
		Name:     "key-type",
		Aliases:  "k",
		Required: true,
		Usage:    "Type of key you want to create. Currently supports 'ecdsa' and 'bls'",
		EnvVars:  []string{"KEY_TYPE"},
	}

	InsecureFlag = BoolFlag{
		Name:    "insecure",
		Aliases: "i",
		Usage:   "Use this flag to skip password validation",
		EnvVars: []string{"INSECURE"},
	}

	KeyPathFlag = StringFlag{
		Name:    "key-path",
		Aliases: "p",
		Usage:   "Use this flag to specify the path of the key",
		EnvVars: []string{"KEY_PATH"},
	}
)

Functions

func CreateCmd

func CreateCmd(p utils.Prompter) *cobra.Command

func ExportCmd

func ExportCmd(p utils.Prompter) *cobra.Command

func GetAddress

func GetAddress(keyStoreFile string) (string, error)

func GetECDSAPrivateKey

func GetECDSAPrivateKey(keyStoreFile string, password string) (*ecdsa.PrivateKey, error)

GetECDSAPrivateKey - Keeping it right now as we might need this function to export the keys

func GetIDFromBLSPubKey

func GetIDFromBLSPubKey(pubKey string) (string, error)

func GetKeysStoredDir

func GetKeysStoredDir(cfg *cmtcfg.Config) string

func GetPubKey

func GetPubKey(keyStoreFile string) (string, error)

func ImportCmd

func ImportCmd(p utils.Prompter) *cobra.Command

func ListCmd

func ListCmd(p utils.Prompter) *cobra.Command

func ShowCmd

func ShowCmd(p utils.Prompter) *cobra.Command

Types

type BoolFlag

type BoolFlag struct {
	Name     string
	Aliases  string
	Value    bool
	Usage    string
	EnvVars  []string
	Required bool
}

type KeyPath

type KeyPath struct {
	ECDSA string
	BLS   string
}

func GetKeysPath

func GetKeysPath(cfg *cmtcfg.Config, name string) KeyPath

func (*KeyPath) IsAllExists

func (kp *KeyPath) IsAllExists() bool

func (*KeyPath) IsAnyExists

func (kp *KeyPath) IsAnyExists() bool

func (*KeyPath) IsBLSExist

func (kp *KeyPath) IsBLSExist() bool

func (*KeyPath) IsECDSAExist

func (kp *KeyPath) IsECDSAExist() bool

type StringFlag

type StringFlag struct {
	Name     string
	Aliases  string
	Value    string
	Usage    string
	EnvVars  []string
	Required bool
}

Jump to

Keyboard shortcuts

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