aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-12 00:46:58 +0800
committerobscuren <geffobscura@gmail.com>2015-03-12 00:46:58 +0800
commit629f4b1d3cadcf1d43892ae2a0152fec3d185396 (patch)
tree4f48bbeaab928f18113ecd0a9a4fb10483fa8e6a /cmd
parent239e17de126a3d7afa29da7ee423ffc79757877f (diff)
parent99bc44cf526b2b9692b230308f3b940e782eea7b (diff)
downloaddexon-629f4b1d3cadcf1d43892ae2a0152fec3d185396.tar
dexon-629f4b1d3cadcf1d43892ae2a0152fec3d185396.tar.gz
dexon-629f4b1d3cadcf1d43892ae2a0152fec3d185396.tar.bz2
dexon-629f4b1d3cadcf1d43892ae2a0152fec3d185396.tar.lz
dexon-629f4b1d3cadcf1d43892ae2a0152fec3d185396.tar.xz
dexon-629f4b1d3cadcf1d43892ae2a0152fec3d185396.tar.zst
dexon-629f4b1d3cadcf1d43892ae2a0152fec3d185396.zip
merge
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethereum/main.go31
-rw-r--r--cmd/utils/flags.go14
2 files changed, 29 insertions, 16 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 10d9c8fa4..73c67bdc9 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -129,6 +129,7 @@ runtime will execute the file and exit.
utils.RPCEnabledFlag,
utils.RPCListenAddrFlag,
utils.RPCPortFlag,
+ utils.UnencryptedKeysFlag,
utils.VMDebugFlag,
//utils.VMTypeFlag,
}
@@ -230,20 +231,24 @@ func accountList(ctx *cli.Context) {
func accountCreate(ctx *cli.Context) {
am := utils.GetAccountManager(ctx)
- fmt.Println("The new account will be encrypted with a passphrase.")
- fmt.Println("Please enter a passphrase now.")
- auth, err := readPassword("Passphrase: ", true)
- if err != nil {
- utils.Fatalf("%v", err)
- }
- confirm, err := readPassword("Repeat Passphrase: ", false)
- if err != nil {
- utils.Fatalf("%v", err)
- }
- if auth != confirm {
- utils.Fatalf("Passphrases did not match.")
+ passphrase := ""
+ if !ctx.GlobalBool(utils.UnencryptedKeysFlag.Name) {
+ fmt.Println("The new account will be encrypted with a passphrase.")
+ fmt.Println("Please enter a passphrase now.")
+ auth, err := readPassword("Passphrase: ", true)
+ if err != nil {
+ utils.Fatalf("%v", err)
+ }
+ confirm, err := readPassword("Repeat Passphrase: ", false)
+ if err != nil {
+ utils.Fatalf("%v", err)
+ }
+ if auth != confirm {
+ utils.Fatalf("Passphrases did not match.")
+ }
+ passphrase = auth
}
- acct, err := am.NewAccount(auth)
+ acct, err := am.NewAccount(passphrase)
if err != nil {
utils.Fatalf("Could not create the account: %v", err)
}
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 6372aaa42..5c188a41e 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -99,6 +99,10 @@ var (
Name: "mine",
Usage: "Enable mining",
}
+ UnencryptedKeysFlag = cli.BoolFlag{
+ Name: "unencrypted-keys",
+ Usage: "disable private key disk encryption (for testing)",
+ }
LogFileFlag = cli.StringFlag{
Name: "logfile",
@@ -224,9 +228,13 @@ func GetChain(ctx *cli.Context) (*core.ChainManager, ethutil.Database, ethutil.D
func GetAccountManager(ctx *cli.Context) *accounts.Manager {
dataDir := ctx.GlobalString(DataDirFlag.Name)
- ks := crypto.NewKeyStorePassphrase(path.Join(dataDir, "keys"))
- km := accounts.NewManager(ks)
- return km
+ var ks crypto.KeyStore2
+ if ctx.GlobalBool(UnencryptedKeysFlag.Name) {
+ ks = crypto.NewKeyStorePlain(path.Join(dataDir, "plainkeys"))
+ } else {
+ ks = crypto.NewKeyStorePassphrase(path.Join(dataDir, "keys"))
+ }
+ return accounts.NewManager(ks)
}
func StartRPC(eth *eth.Ethereum, ctx *cli.Context) {