diff --git a/ethstaker_deposit/cli/existing_mnemonic.py b/ethstaker_deposit/cli/existing_mnemonic.py index 4235344c..af576140 100644 --- a/ethstaker_deposit/cli/existing_mnemonic.py +++ b/ethstaker_deposit/cli/existing_mnemonic.py @@ -1,4 +1,5 @@ import click +import pyperclip from typing import ( Any, Callable, @@ -85,4 +86,9 @@ def validate_mnemonic(ctx: click.Context, param: Any, mnemonic: str) -> str: def existing_mnemonic(ctx: click.Context, mnemonic: str, mnemonic_password: str, **kwargs: Any) -> None: ctx.obj = {} if ctx.obj is None else ctx.obj # Create a new ctx.obj if it doesn't exist ctx.obj.update({'mnemonic': mnemonic, 'mnemonic_password': mnemonic_password}) + # Clear clipboard + try: # Failing this on headless Linux is expected + pyperclip.copy(' ') + except Exception: + pass ctx.forward(generate_keys) diff --git a/ethstaker_deposit/cli/new_mnemonic.py b/ethstaker_deposit/cli/new_mnemonic.py index 45dcbf61..78805813 100644 --- a/ethstaker_deposit/cli/new_mnemonic.py +++ b/ethstaker_deposit/cli/new_mnemonic.py @@ -1,4 +1,5 @@ import click +import pyperclip from typing import ( Any, ) @@ -58,6 +59,11 @@ def new_mnemonic(ctx: click.Context, mnemonic_language: str, **kwargs: Any) -> N click.clear() test_mnemonic = click.prompt(load_text(['msg_mnemonic_retype_prompt']) + '\n\n') click.clear() + # Clear clipboard + try: # Failing this on headless Linux is expected + pyperclip.copy(' ') + except Exception: + pass # Do NOT use mnemonic_password. ctx.obj = {'mnemonic': mnemonic, 'mnemonic_password': ''} ctx.params['validator_start_index'] = 0 diff --git a/pyproject.toml b/pyproject.toml index 944f63ce..7a321bf3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ dependencies = [ "eth-typing", "eth-utils", "pycryptodome", + "pyperclip", "py-ecc", "ssz" ] diff --git a/requirements.txt b/requirements.txt index 800c09ba..61a0d54f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -245,6 +245,8 @@ pycryptodome==3.20.0 \ --hash=sha256:f35d6cee81fa145333137009d9c8ba90951d7d77b67c79cbe5f03c7eb74d8fe2 \ --hash=sha256:f47888542a0633baff535a04726948e876bf1ed880fddb7c10a736fa99146ab3 \ --hash=sha256:fb3b87461fa35afa19c971b0a2b7456a7b1db7b4eba9a8424666104925b78128 +pyperclip==1.9.0 \ + --hash=sha256:b7de0142ddc81bfc5c7507eea19da920b92252b548b96186caf94a5e2527d310 pyrsistent==0.16.1 \ --hash=sha256:aa2ae1c2e496f4d6777f869ea5de7166a8ccb9c2e06ebcf6c7ff1b670c98c5ef six==1.16.0 \