staking-deposit-cli/eth2deposit/cli/existing_mnemonic.py

35 lines
740 B
Python
Raw Normal View History

2020-08-24 11:55:06 +00:00
import click
from typing import (
Tuple,
)
from key_handling.key_derivation.mnemonic import (
verify_mnemonic,
)
from utils.constants import (
WORD_LISTS_PATH,
)
def validate_mnemonic(mnemonic: str) -> str:
if verify_mnemonic(mnemonic, WORD_LISTS_PATH):
return mnemonic
else:
raise click.BadParameter('That is not a valid mnemonic in any language.')
@click.command()
@click.option(
'--mnemonic',
prompt='Please enter your mnemonic separated by spaces (" ").',
required=True,
type=str,
)
@click.option(
'--mnemonic-password',
type=str,
defualt='',
)
def existing_mnemonic(mnemonic: str, mnemonic_password: str) -> Tuple[str, str]:
return (mnemonic, mnemonic_password)