From bccd61cb23a5259e02d6606ac320093d6637d203 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 14 Feb 2018 19:11:21 +0100 Subject: [PATCH] client: implement PassphraseRequest.on_device handling --- trezorlib/client.py | 3 +++ trezorlib/messages/PassphraseAck.py | 1 + trezorlib/messages/PassphraseRequest.py | 3 +++ 3 files changed, 7 insertions(+) diff --git a/trezorlib/client.py b/trezorlib/client.py index 8de8ef108d..8e60f7f066 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -278,6 +278,9 @@ class TextUIMixin(object): return proto.PinMatrixAck(pin=pin) def callback_PassphraseRequest(self, msg): + if msg.on_device is True: + return proto.PassphraseAck() + if os.getenv("PASSPHRASE") is not None: log("Passphrase required. Using PASSPHRASE environment variable.") passphrase = Mnemonic.normalize_string(os.getenv("PASSPHRASE")) diff --git a/trezorlib/messages/PassphraseAck.py b/trezorlib/messages/PassphraseAck.py index 19dcb78204..8f86960e20 100644 --- a/trezorlib/messages/PassphraseAck.py +++ b/trezorlib/messages/PassphraseAck.py @@ -6,5 +6,6 @@ from .. import protobuf as p class PassphraseAck(p.MessageType): FIELDS = { 1: ('passphrase', p.UnicodeType, 0), # required + 2: ('state', p.BytesType, 0), } MESSAGE_WIRE_TYPE = 42 diff --git a/trezorlib/messages/PassphraseRequest.py b/trezorlib/messages/PassphraseRequest.py index 15d470563d..fca49794c8 100644 --- a/trezorlib/messages/PassphraseRequest.py +++ b/trezorlib/messages/PassphraseRequest.py @@ -4,4 +4,7 @@ from .. import protobuf as p class PassphraseRequest(p.MessageType): + FIELDS = { + 1: ('on_device', p.BoolType, 0), + } MESSAGE_WIRE_TYPE = 41