Skip to content

Commit

Permalink
Clear clipboard of the mnemonic
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Sep 2, 2024
1 parent 537127e commit d4106aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ethstaker_deposit/cli/existing_mnemonic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import click
import pyperclip
from typing import (
Any,
Callable,
Expand Down Expand Up @@ -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)
6 changes: 6 additions & 0 deletions ethstaker_deposit/cli/new_mnemonic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import click
import pyperclip
from typing import (
Any,
)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies = [
"eth-typing",
"eth-utils",
"pycryptodome",
"pyperclip",
"py-ecc",
"ssz"
]
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit d4106aa

Please sign in to comment.