Skip to content

Commit

Permalink
chia keys queries for secret words from stdin (Chia-Network#1247)
Browse files Browse the repository at this point in the history
* chia keys queries for secret words from stdin

* updated changelog

* fixes tests

* fixes chai keys generate
  • Loading branch information
wbendick authored Mar 11, 2021
1 parent 7340c18 commit 34ec287
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ for setuptools_scm/PEP 440 reasons.
## Changed

- Remove `chia plots "-s" "--stripe_size"` - we now always use the best default of 64K
- `chia keys add` takes secret words from stdin instead of command line arguments for security

## 1.0rc5 aka Release Candidate 5 - 2020-03-04

Expand Down
14 changes: 8 additions & 6 deletions src/cmds/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def generate_and_add():
add_private_key_seed(mnemonic)


def query_and_add_private_key_seed():
mnemonic = input("Enter the mnemonic you want to use: ")
add_private_key_seed(mnemonic)


def add_private_key_seed(mnemonic: str):
"""
Add a private key seed to the keyring, with the given mnemonic.
Expand Down Expand Up @@ -143,13 +148,10 @@ def show_cmd():
show_all_keys()


@keys_cmd.command("add", short_help="Add a private key by mnemonic in quotes")
@click.option(
"--mnemonic", "-m", help="Enter the mnemonic you want to use surrounded by a single pair of quotes", type=str
)
@keys_cmd.command("add", short_help="Add a private key by mnemonic")
@click.pass_context
def add_cmd(ctx: click.Context, mnemonic: str):
add_private_key_seed(mnemonic)
def add_cmd(ctx: click.Context):
query_and_add_private_key_seed()
check_keys(ctx.obj["root_path"])


Expand Down

0 comments on commit 34ec287

Please sign in to comment.