mirror of
https://github.com/romanz/amodem.git
synced 2026-04-28 03:56:44 +08:00
trezor: split pinentry tool into a separate file
This commit is contained in:
@@ -16,9 +16,7 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def _message_box(label, sp=subprocess):
|
def _message_box(label, sp=subprocess):
|
||||||
"""Launch an external process for PIN/passphrase entry GUI."""
|
"""Launch an external process for PIN/passphrase entry GUI."""
|
||||||
cmd = ('import sys, pymsgbox; '
|
args = [sys.executable, '-m', 'libagent.device.ui.simple']
|
||||||
'sys.stdout.write(pymsgbox.password(sys.stdin.read()))')
|
|
||||||
args = [sys.executable, '-c', cmd]
|
|
||||||
p = sp.Popen(args=args, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
|
p = sp.Popen(args=args, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
|
||||||
out, err = p.communicate(label.encode('ascii'))
|
out, err = p.communicate(label.encode('ascii'))
|
||||||
exitcode = p.wait()
|
exitcode = p.wait()
|
||||||
|
|||||||
1
libagent/device/ui/__init__.py
Normal file
1
libagent/device/ui/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
"""UIs for PIN/passphrase entry."""
|
||||||
6
libagent/device/ui/simple.py
Normal file
6
libagent/device/ui/simple.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
"""Simple, cross-platform UI for entering a PIN/passhprase."""
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pymsgbox
|
||||||
|
|
||||||
|
sys.stdout.write(pymsgbox.password(sys.stdin.read()))
|
||||||
Reference in New Issue
Block a user