Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateCommand = &cli.Command{ Name: "create", Usage: "Generates a Bls keystore JSON file for a private key", Flags: append([]cli.Flag{ &cli.StringFlag{ Name: "key", Usage: "Bls private key in large number", Required: true, }, &cli.StringFlag{ Name: "path", Usage: "Full path to save keystore file, including filename (e.g., ./operator_keys/operator1.json)", Required: true, }, &cli.StringFlag{ Name: "type", Usage: "Curve type (only 'bn254' supported)", Value: "bn254", }, &cli.StringFlag{ Name: "password", Usage: `Password to encrypt the keystore file. Default password is "" `, Value: "", }, }, common.GlobalFlags...), Action: func(cCtx *cli.Context) error { logger := common.LoggerFromContext(cCtx.Context) privateKey := cCtx.String("key") path := cCtx.String("path") curve := cCtx.String("type") password := cCtx.String("password") logger.Debug("🔐 Starting Bls keystore creation") logger.Debug("• Curve: %s", curve) logger.Debug("• Output Path: %s", path) return CreateBLSKeystore(logger, privateKey, path, password, curve) }, }
View Source
var KeystoreCommand = &cli.Command{ Name: "keystore", Usage: "Manage keystore operations", Subcommands: []*cli.Command{ CreateCommand, ReadCommand, }, }
View Source
var ReadCommand = &cli.Command{ Name: "read", Usage: "Print the Bls key from a given keystore file, password", Flags: append([]cli.Flag{ &cli.StringFlag{ Name: "path", Usage: "Path to the keystore JSON", Required: true, }, &cli.StringFlag{ Name: "password", Usage: "Password to decrypt the keystore file", Required: true, }, }, common.GlobalFlags...), Action: func(cCtx *cli.Context) error { path := cCtx.String("path") password := cCtx.String("password") scheme := bn254.NewScheme() keystoreData, err := keystore.LoadKeystoreFile(path) if err != nil { return fmt.Errorf("failed to load the keystore file from given path %s", path) } privateKeyData, err := keystoreData.GetPrivateKey(password, scheme) if err != nil { return fmt.Errorf("failed to extract the private key from the keystore file") } log.Println("✅ Keystore generated successfully") log.Println("") log.Println("🔑 Save this BLS private key in a secure location:") log.Printf(" %s\n", privateKeyData.Bytes()) log.Println("") return nil }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.