Skip to content

Commit

Permalink
Initial commit cherry-pick Chia-Network#1398.
Browse files Browse the repository at this point in the history
  • Loading branch information
fchirica authored and hoffmang9 committed Apr 19, 2021
1 parent 166ab7c commit 68a11e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions chia/cmds/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def generate_cmd(ctx: click.Context):


@keys_cmd.command("show", short_help="Displays all the keys in keychain")
def show_cmd():
@click.option(
"--show-mnemonic-seed", help="Show the mnemonic seed of the keys", default=False, show_default=True, is_flag=True
)
def show_cmd(show_mnemonic_seed):
from .keys_funcs import show_all_keys

show_all_keys()
show_all_keys(show_mnemonic_seed)


@keys_cmd.command("add", short_help="Add a private key by mnemonic")
Expand Down
9 changes: 5 additions & 4 deletions chia/cmds/keys_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def add_private_key_seed(mnemonic: str):
return


def show_all_keys():
def show_all_keys(show_mnemonic: bool):
"""
Prints all keys and mnemonics (if available).
"""
Expand Down Expand Up @@ -89,9 +89,10 @@ def show_all_keys():
encode_puzzle_hash(create_puzzlehash_for_pk(master_sk_to_wallet_sk(sk, uint32(0)).get_g1()), prefix),
)
assert seed is not None
mnemonic = bytes_to_mnemonic(seed)
print(" Mnemonic seed (24 secret words):")
print(mnemonic)
if show_mnemonic:
mnemonic = bytes_to_mnemonic(seed)
print(" Mnemonic seed (24 secret words):")
print(mnemonic)


def delete(fingerprint: int):
Expand Down

0 comments on commit 68a11e5

Please sign in to comment.