client: implement PassphraseRequest.on_device handling

This commit is contained in:
Pavol Rusnak 2018-02-14 19:11:21 +01:00
parent e256281a99
commit bccd61cb23
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 7 additions and 0 deletions

View File

@ -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"))

View File

@ -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

View File

@ -4,4 +4,7 @@ from .. import protobuf as p
class PassphraseRequest(p.MessageType):
FIELDS = {
1: ('on_device', p.BoolType, 0),
}
MESSAGE_WIRE_TYPE = 41