def test_getxpub(self): with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data/bip32_vectors.json'), encoding='utf-8') as f: vectors = json.load(f) for vec in vectors: with self.subTest(vector=vec): # Setup with xprv device.wipe(self.client) load_device_by_xprv(client=self.client, xprv=vec['xprv'], pin='', passphrase_protection=False, label='test', language='english') # Test getmasterxpub gmxp_res = process_commands([ '-t', 'trezor', '-d', 'udp:127.0.0.1:21324', 'getmasterxpub' ]) self.assertEqual(gmxp_res['xpub'], vec['master_xpub']) # Test the path derivs for path_vec in vec['vectors']: gxp_res = process_commands([ '-t', 'trezor', '-d', 'udp:127.0.0.1:21324', 'getxpub', path_vec['path'] ]) self.assertEqual(gxp_res['xpub'], path_vec['xpub'])
def test_load_device_xprv_1(self): debuglink.load_device_by_xprv( self.client, xprv="xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73", pin="", passphrase_protection=False, label="test", language="english", ) passphrase_protection = self.client.debug.read_passphrase_protection() assert passphrase_protection is False address = btc.get_address(self.client, "Bitcoin", []) assert address == "128RdrAkJDmqasgvfRf6MC5VcX4HKqH4mR"
def test_load_device_xprv_1(self): debuglink.load_device_by_xprv( self.client, xprv= "xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73", pin="", passphrase_protection=False, label="test", language="english", ) passphrase_protection = self.client.debug.read_passphrase_protection() assert passphrase_protection is False address = btc.get_address(self.client, "Bitcoin", []) assert address == "128RdrAkJDmqasgvfRf6MC5VcX4HKqH4mR"
def test_load_device_xprv_2(self): debuglink.load_device_by_xprv( self.client, xprv="xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73", pin="", passphrase_protection=True, label="test", language="english", ) self.client.set_passphrase("passphrase") passphrase_protection = self.client.debug.read_passphrase_protection() assert passphrase_protection is True address = btc.get_address(self.client, "Bitcoin", []) assert address == "1CHUbFa4wTTPYgkYaw2LHSd5D4qJjMU8ri"
def test_load_device_xprv_2(self): debuglink.load_device_by_xprv( self.client, xprv= "xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73", pin="", passphrase_protection=True, label="test", language="english", ) self.client.set_passphrase("passphrase") passphrase_protection = self.client.debug.read_passphrase_protection() assert passphrase_protection is True address = btc.get_address(self.client, "Bitcoin", []) assert address == "1CHUbFa4wTTPYgkYaw2LHSd5D4qJjMU8ri"