mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-04-19 03:01:06 -04:00
Adding Basic Private Key Management (#671)
* adding flags * adding modified key utils * adding more funcs * more changes * more changes * documentation * changes to node * gazelle * fixing bazel build * gazelle * adding tests * more tests * addressing terence's feedback * adding geth header * test * changes * fixedd it * fixed marshalling * adding more to tests * gazelle * adding more tests * lint * add cov * cov * fix imports
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/cmd"
|
||||
"github.com/prysmaticlabs/prysm/shared/database"
|
||||
"github.com/prysmaticlabs/prysm/shared/debug"
|
||||
"github.com/prysmaticlabs/prysm/shared/keystore"
|
||||
"github.com/prysmaticlabs/prysm/shared/p2p"
|
||||
"github.com/prysmaticlabs/prysm/validator/attester"
|
||||
"github.com/prysmaticlabs/prysm/validator/beacon"
|
||||
@@ -60,17 +61,15 @@ func NewValidatorClient(ctx *cli.Context) (*ValidatorClient, error) {
|
||||
|
||||
var pubKey []byte
|
||||
|
||||
inputKey := ctx.GlobalString(types.PubKeyFlag.Name)
|
||||
if inputKey == "" {
|
||||
var err error
|
||||
pubKey, err = GeneratePubKey()
|
||||
keystorePath := ctx.GlobalString(cmd.KeystoreDirectoryFlag.Name)
|
||||
password := ctx.GlobalString(cmd.KeystorePasswordFlag.Name)
|
||||
if keystorePath != "" && password != "" {
|
||||
blspubkey, err := keystore.RetrievePubKey(keystorePath, password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Warnf("PublicKey not detected, generating a new one: %v", pubKey)
|
||||
|
||||
} else {
|
||||
pubKey = []byte(inputKey)
|
||||
pubKey = blspubkey.BufferedPublicKey()
|
||||
}
|
||||
|
||||
if err := ValidatorClient.startDB(ctx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user