main.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2017 The go-ethereum Authors
  2. // This file is part of go-ethereum.
  3. //
  4. // go-ethereum is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // go-ethereum is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
  16. package main
  17. import (
  18. "fmt"
  19. "os"
  20. "github.com/ethereum/go-ethereum/cmd/utils"
  21. "gopkg.in/urfave/cli.v1"
  22. )
  23. const (
  24. defaultKeyfileName = "keyfile.json"
  25. )
  26. var (
  27. gitCommit = "" // Git SHA1 commit hash of the release (set via linker flags)
  28. app *cli.App // the main app instance
  29. )
  30. var ( // Commonly used command line flags.
  31. passphraseFlag = cli.StringFlag{
  32. Name: "passwordfile",
  33. Usage: "the file that contains the passphrase for the keyfile",
  34. }
  35. jsonFlag = cli.BoolFlag{
  36. Name: "json",
  37. Usage: "output JSON instead of human-readable format",
  38. }
  39. messageFlag = cli.StringFlag{
  40. Name: "message",
  41. Usage: "the file that contains the message to sign/verify",
  42. }
  43. )
  44. // Configure the app instance.
  45. func init() {
  46. app = utils.NewApp(gitCommit, "an Ethereum key manager")
  47. app.Commands = []cli.Command{
  48. commandGenerate,
  49. commandInspect,
  50. commandSignMessage,
  51. commandVerifyMessage,
  52. }
  53. }
  54. func main() {
  55. if err := app.Run(os.Args); err != nil {
  56. fmt.Fprintln(os.Stderr, err)
  57. os.Exit(1)
  58. }
  59. }