Merge pull request #5118 from filcloud/keygen-outfile

add keygen outfile
This commit is contained in:
Łukasz Magiera 2020-12-07 13:11:11 +01:00 committed by GitHub
commit 5c37c9d8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

1
.gitignore vendored
View File

@ -13,6 +13,7 @@
/lotus-gateway
/lotus-pcr
/lotus-wallet
/lotus-keygen
/bench.json
/lotuspond/front/node_modules
/lotuspond/front/build

View File

@ -204,6 +204,12 @@ lotus-wallet:
.PHONY: lotus-wallet
BINS+=lotus-wallet
lotus-keygen:
rm -f lotus-keygen
go build -o lotus-keygen ./cmd/lotus-keygen
.PHONY: lotus-keygen
BINS+=lotus-keygen
testground:
go build -tags testground -o /dev/null ./cmd/lotus
.PHONY: testground

View File

@ -22,6 +22,11 @@ func main() {
Value: "bls",
Usage: "specify key type to generate (bls or secp256k1)",
},
&cli.StringFlag{
Name: "out",
Aliases: []string{"o"},
Usage: "specify key file name to generate",
},
}
app.Action = func(cctx *cli.Context) error {
memks := wallet.NewMemKeyStore()
@ -50,7 +55,11 @@ func main() {
return err
}
fi, err := os.Create(fmt.Sprintf("%s.key", kaddr))
outFile := fmt.Sprintf("%s.key", kaddr)
if cctx.IsSet("out") {
outFile = fmt.Sprintf("%s.key", cctx.String("out"))
}
fi, err := os.Create(outFile)
if err != nil {
return err
}