From 05069854879d755bd608d44869b61aba4901998d Mon Sep 17 00:00:00 2001 From: slush Date: Sat, 2 Dec 2017 16:29:41 +0100 Subject: [PATCH 1/3] New Trezor icon --- icons/trezor.png | Bin 3301 -> 2606 bytes icons/trezor_unpaired.png | Bin 3141 -> 1950 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/icons/trezor.png b/icons/trezor.png index e9c035fe42c5d932e83a5b9051210964988624ae..3edee94f83747f3ecae17b5dd7be1b7d4b72fc67 100644 GIT binary patch delta 2591 zcmV+)3gGqS8LkwNDt`a~0002_L%V+f000SaNLh0L04^f{04^f|c%?sf00007bV*G` z2jL6?4;MIC=sY+8013NEL_t(|UhSM~Y!ufO$A7c-;ycBlQKF zrfm>)DhpHu1qrokfe$T8W2s6Xp+QQden?BDDouhKRjGJXDSu$KLFo(Xm{v)f*aT=O zwB;3BvBAb{v3I>|dv|X?9IxYD&v<6MGqxA}lkOMqoqIk1Irnw$xff>13C%2ni}-+# z01p5wfF-~J;2xj|NB|L_2Y3%S51aum0Jn9@n--=+zzSe3P!D_x5wQsHOz?~XhJjw- zE#L(3d*I5*Z+~|M#lS}3C~yl%Aun$?rGP=;??5APKX(C3fu921OkOy>6a#(>tOp9X zLwN-F1CYdAkjbPJ@L%9tNLO&jpdn569h|i~qjU?{1NgZ^Xh25IsSq!n`ho8PbI5ZZ z1pdae;N*GLK@lW7l7 zh&_v%hdkGeOnF?R&@6*Z76D&D=6qIAKp*f|;LpH0M7%-d<5nRnl!t)NB9m?_LTX4K z{72x|CV6KRyOEbSYhns%;(r0Q0+o7&jiCtm4Db>#fO*;J@?SxghIzqU;7?fV`;x#x zWDRVG3V-1HNK-efLjj$@8r_m+AZw77hS^J{fZqXi`o)-13_OGMnPzn*fFCgNI(tT- z0pCUz{AMrpKJZ2TVl49^WOZX^?J1xMDAg|}cbxh%g}`#Gm3IOe9dn@raY~qtuo|!! z>0VsH$_rbe7_kbo5i*8|H(-*_3a5Z}vrIq$sDC!gG+CSy(1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Ke+6u&|Caddk)A(y?i`VJy8Uaz;pvaIJK1)9$+3}~GtBC|D38&(0iV;9{-WG?-$ z3Rpe>>R7102#aDe_JY2yaZ_g7U_Q55C4qA1^26eZ~Sz$tN4P((5Z zwDK>3Ibp)0n?NJ*F7O*gQLYAi$S{mQ2gdXcX`9V9Xj4VRu-R-)s#L0OQ52;-EZ|Hr z8nBm70^b9Y0WWYGI0_tB6s2Y~;~0ja0pA7Q2GYa&7%)^-?E&h5|JF3E47jQ&%7~Sc Z{|6mo+|4B%WfTAa002ovPDHLkV1j3?UvvNf diff --git a/icons/trezor_unpaired.png b/icons/trezor_unpaired.png index 2c0032d5f018c0511bbe5dc45b7af96275eee7b7..c9854be1af12e16d0306db195681890494e135ae 100644 GIT binary patch delta 1930 zcmV;52X*+x7@iN1Dt`a~0002_L%V+f000SaNLh0L04^f{04^f|c%?sf00007bV*G` z2jL6?4;c{i-nmQw00%2cL_t(|UhSP*XdG1-$A6o|G`&RIRI4JI6{#ZLpj#^%ZAMW9 ztrsdjsEARh@u3#9AYMZr6n!WvUXTVaRWyiTMGIbwo2cNWseiWBB1G+`6}M<ho*;3D7x;B4Sj;CNsf za2OZ?b^+Ugt-vPWS75JAer2H?0?q+ifh9l-D&jPtrocM_90GO&KLG22Pk?RX&yESE z1GfP01ABlB`hW3WEdz`K-vKLu(>Mk=2Y4R%hvJ2^vjf0~z;!?^M=93=p8{i;1u4cd zz;D3)XjO335JN-uCxZ1lC))#b05dsCxEXCVOCes?hJiWo;91IVB+ImMaF_1FXP%7##%u1$K_xAb;AKt^w-s=20i3? zV%wY|$bVvVq+$A~4DbVD*|_F( zbaZ3#_6+a=Fv~t0{{;2R)B)$?F2D6?>*$9+(MbtY3mXIGqt#0&xcOi=Oh>)K)IuIW z#oKR4=Z3F<9i~LUJm5rAqGAb3zy`FnGYL41PJf67!QW_gV4?wNG$ksQpaiVP-Au?K zwBHv52hka86E&!ap%9dSG0ffvM=JK9aGO`qBd!U867ZO%DxgoQ0{X=NY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D%bSwVQ`_4^!TUoj!t4%`OG%y}c{%VcM&n)|r0X0Q7=K_z zMFmSsODB9uPoS(^xsrSK>|tG99aUAOuIp4)b$mx%E^2SRMKdcavV--CijW8EilX$n z-EQ9oBxd=yB=-RLDS)Ri$!kUo!@#9WmvH9H85}%#Fyzxu#l^+gy?ZxSty+bJ3m5uA zTAHT8VzGqIM)jt4oH}(owd3;Tv45!@nVGj!JBo@XO6>pu3L$1mlJtGd0S3VQ1%O}S z_EX{+lU?7^(t-~^{1B&3ox<|v%dvj_dX$uuV8)CYArG0nTf7*i^lAXoWLds7CcG8T zy)en204M;k1Hg}Q=Uw?h%fP?@X3w4-PF&Gtnr0)(4dFg>9O*Wm7Nh@}$*jt(^iy7l40ClC(<*p-mW}PP7QG$6r1M zU>krm049L*0BQi#3L!3rQ!|gMs&*m7FHO^Y0l@N!R02>uUrsa0zd0O^`f%I(e?Jro UOB2M3DF6Tf07*qoM6N<$f_-oA8UO$Q From a30d59912ea9f1693a4956a268e5183be2e68c19 Mon Sep 17 00:00:00 2001 From: slush Date: Sat, 2 Dec 2017 18:34:04 +0100 Subject: [PATCH 2/3] Updated TREZOR plugin to work with trezorlib>=0.8.0. --- plugins/trezor/plugin.py | 7 +------ plugins/trezor/trezor.py | 10 +++++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py index 363d7a787..555635eb7 100644 --- a/plugins/trezor/plugin.py +++ b/plugins/trezor/plugin.py @@ -76,13 +76,8 @@ class TrezorCompatiblePlugin(HW_PluginBase): def _try_hid(self, device): self.print_error("Trying to connect over USB...") - if device.interface_number == 1: - pair = [None, device.path] - else: - pair = [device.path, None] - try: - return self.hid_transport(pair) + return self.hid_transport(device) except BaseException as e: # see fdb810ba622dc7dbe1259cbafb5b28e19d2ab114 # raise diff --git a/plugins/trezor/trezor.py b/plugins/trezor/trezor.py index 72f003cea..32b50de4b 100644 --- a/plugins/trezor/trezor.py +++ b/plugins/trezor/trezor.py @@ -6,9 +6,9 @@ class TrezorKeyStore(TrezorCompatibleKeyStore): device = 'TREZOR' class TrezorPlugin(TrezorCompatiblePlugin): - firmware_URL = 'https://www.mytrezor.com' + firmware_URL = 'https://wallet.trezor.io' libraries_URL = 'https://github.com/trezor/python-trezor' - minimum_firmware = (1, 3, 3) + minimum_firmware = (1, 5, 2) keystore_class = TrezorKeyStore def __init__(self, *args): @@ -20,15 +20,15 @@ class TrezorPlugin(TrezorCompatiblePlugin): self.client_class = client.TrezorClient self.ckd_public = trezorlib.ckd_public self.types = trezorlib.client.types - self.DEVICE_IDS = trezorlib.transport_hid.DEVICE_IDS + self.DEVICE_IDS = (trezorlib.transport_hid.DEV_TREZOR1, trezorlib.transport_hid.DEV_TREZOR2) self.libraries_available = True except ImportError: self.libraries_available = False TrezorCompatiblePlugin.__init__(self, *args) - def hid_transport(self, pair): + def hid_transport(self, device): from trezorlib.transport_hid import HidTransport - return HidTransport(pair) + return HidTransport.find_by_path(device.path) def bridge_transport(self, d): from trezorlib.transport_bridge import BridgeTransport From dda9d4b746700bfc095c80d84f1ac5de46c5f2ca Mon Sep 17 00:00:00 2001 From: slush Date: Fri, 29 Dec 2017 20:31:03 +0100 Subject: [PATCH 3/3] Updated TREZOR plugin to work with trezorlib>=0.9.0. --- plugins/trezor/clientbase.py | 6 +++--- plugins/trezor/plugin.py | 20 ++++++++++---------- plugins/trezor/qt_generic.py | 30 ++++++++++++++++++------------ plugins/trezor/trezor.py | 3 ++- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/plugins/trezor/clientbase.py b/plugins/trezor/clientbase.py index 736fa8785..31a97ca12 100644 --- a/plugins/trezor/clientbase.py +++ b/plugins/trezor/clientbase.py @@ -28,9 +28,9 @@ class GuiMixin(object): # However, making the user acknowledge they cancelled # gets old very quickly, so we suppress those. The NotInitialized # one is misnamed and indicates a passphrase request was cancelled. - if msg.code in (self.types.Failure_PinCancelled, - self.types.Failure_ActionCancelled, - self.types.Failure_NotInitialized): + if msg.code in (self.types.FailureType.PinCancelled, + self.types.FailureType.ActionCancelled, + self.types.FailureType.NotInitialized): raise UserCancelled() raise RuntimeError(msg.message) diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py index 555635eb7..0e424f104 100644 --- a/plugins/trezor/plugin.py +++ b/plugins/trezor/plugin.py @@ -242,7 +242,7 @@ class TrezorCompatiblePlugin(HW_PluginBase): address_path = "%s/%d/%d"%(derivation, change, index) address_n = client.expand_path(address_path) segwit = wallet.keystore.is_segwit() - script_type = self.types.SPENDP2SHWITNESS if segwit else self.types.SPENDADDRESS + script_type = self.types.InputScriptType.SPENDP2SHWITNESS if segwit else self.types.InputScriptType.SPENDADDRESS client.get_address(self.get_coin_name(), address_n, True, script_type=script_type) def tx_inputs(self, tx, for_sig=False, segwit=False): @@ -259,8 +259,8 @@ class TrezorCompatiblePlugin(HW_PluginBase): x_pubkey = x_pubkeys[0] xpub, s = parse_xpubkey(x_pubkey) xpub_n = self.client_class.expand_path(self.xpub_path[xpub]) - txinputtype.address_n.extend(xpub_n + s) - txinputtype.script_type = self.types.SPENDP2SHWITNESS if segwit else self.types.SPENDADDRESS + txinputtype._extend_address_n(xpub_n + s) + txinputtype.script_type = self.types.InputScriptType.SPENDP2SHWITNESS if segwit else self.types.InputScriptType.SPENDADDRESS else: def f(x_pubkey): if is_xpubkey(x_pubkey): @@ -276,7 +276,7 @@ class TrezorCompatiblePlugin(HW_PluginBase): signatures=map(lambda x: bfh(x)[:-1] if x else b'', txin.get('signatures')), m=txin.get('num_sig'), ) - script_type = self.types.SPENDP2SHWITNESS if segwit else self.types.SPENDMULTISIG + script_type = self.types.InputScriptType.SPENDP2SHWITNESS if segwit else self.types.InputScriptType.SPENDMULTISIG txinputtype = self.types.TxInputType( script_type=script_type, multisig=multisig @@ -287,7 +287,7 @@ class TrezorCompatiblePlugin(HW_PluginBase): xpub, s = parse_xpubkey(x_pubkey) if xpub in self.xpub_path: xpub_n = self.client_class.expand_path(self.xpub_path[xpub]) - txinputtype.address_n.extend(xpub_n + s) + txinputtype._extend_address_n(xpub_n + s) break prev_hash = unhexlify(txin['prevout_hash']) @@ -327,7 +327,7 @@ class TrezorCompatiblePlugin(HW_PluginBase): address_n = address_n, ) else: - script_type = self.types.PAYTOP2SHWITNESS if segwit else self.types.PAYTOMULTISIG + script_type = self.types.OutputScriptType.PAYTOP2SHWITNESS if segwit else self.types.OutputScriptType.PAYTOMULTISIG address_n = self.client_class.expand_path("/%d/%d"%index) nodes = map(self.ckd_public.deserialize, xpubs) pubkeys = [ self.types.HDNodePathType(node=node, address_n=address_n) for node in nodes] @@ -344,10 +344,10 @@ class TrezorCompatiblePlugin(HW_PluginBase): txoutputtype = self.types.TxOutputType() txoutputtype.amount = amount if _type == TYPE_SCRIPT: - txoutputtype.script_type = self.types.PAYTOOPRETURN + txoutputtype.script_type = self.types.OutputScriptType.PAYTOOPRETURN txoutputtype.op_return_data = address[2:] elif _type == TYPE_ADDRESS: - txoutputtype.script_type = self.types.PAYTOADDRESS + txoutputtype.script_type = self.types.OutputScriptType.PAYTOADDRESS txoutputtype.address = address outputs.append(txoutputtype) @@ -360,9 +360,9 @@ class TrezorCompatiblePlugin(HW_PluginBase): t.version = d['version'] t.lock_time = d['lockTime'] inputs = self.tx_inputs(tx) - t.inputs.extend(inputs) + t._extend_inputs(inputs) for vout in d['outputs']: - o = t.bin_outputs.add() + o = t._add_bin_outputs() o.amount = vout['value'] o.script_pubkey = bfh(vout['scriptPubKey']) return t diff --git a/plugins/trezor/qt_generic.py b/plugins/trezor/qt_generic.py index d564be6dd..f0510e131 100644 --- a/plugins/trezor/qt_generic.py +++ b/plugins/trezor/qt_generic.py @@ -375,25 +375,31 @@ class SettingsDialog(WindowModalDialog): invoke_client('toggle_passphrase', unpair_after=currently_enabled) def change_homescreen(): - from PIL import Image # FIXME dialog = QFileDialog(self, _("Choose Homescreen")) filename, __ = dialog.getOpenFileName() - if filename: - im = Image.open(str(filename)) - if im.size != (hs_cols, hs_rows): - raise Exception('Image must be 64 x 128 pixels') + + if filename.endswith('.toif'): + img = open(filename, 'rb').read() + if img[:8] != b'TOIf\x90\x00\x90\x00': + raise Exception('File is not a TOIF file with size of 144x144') + else: + from PIL import Image # FIXME + im = Image.open(filename) + if im.size != (128, 64): + raise Exception('Image must be 128 x 64 pixels') im = im.convert('1') pix = im.load() - img = '' - for j in range(hs_rows): - for i in range(hs_cols): - img += '1' if pix[i, j] else '0' - img = ''.join(chr(int(img[i:i + 8], 2)) - for i in range(0, len(img), 8)) + img = bytearray(1024) + for j in range(64): + for i in range(128): + if pix[i, j]: + o = (i + j * 128) + img[o // 8] |= (1 << (7 - o % 8)) + img = bytes(img) invoke_client('change_homescreen', img) def clear_homescreen(): - invoke_client('change_homescreen', '\x00') + invoke_client('change_homescreen', b'\x00') def set_pin(): invoke_client('set_pin', remove=False) diff --git a/plugins/trezor/trezor.py b/plugins/trezor/trezor.py index 32b50de4b..5ee31d390 100644 --- a/plugins/trezor/trezor.py +++ b/plugins/trezor/trezor.py @@ -17,9 +17,10 @@ class TrezorPlugin(TrezorCompatiblePlugin): import trezorlib import trezorlib.ckd_public import trezorlib.transport_hid + import trezorlib.messages self.client_class = client.TrezorClient self.ckd_public = trezorlib.ckd_public - self.types = trezorlib.client.types + self.types = trezorlib.messages self.DEVICE_IDS = (trezorlib.transport_hid.DEV_TREZOR1, trezorlib.transport_hid.DEV_TREZOR2) self.libraries_available = True except ImportError: