def test_get_keychain(self):
        seed = bip39.seed(" ".join(["all"] * 12), "")
        cache.set(cache.APP_COMMON_SEED, seed)

        schema = PathSchema("m/44'/1'", 0)
        keychain = await_result(
            get_keychain(wire.DUMMY_CONTEXT, "secp256k1", [schema]))

        # valid path:
        self.assertIsNotNone(keychain.derive([H_(44), H_(1)]))

        # invalid path:
        with self.assertRaises(wire.DataError):
            keychain.derive([44])
Ejemplo n.º 2
0
    def test_get_keychain(self):
        seed = bip39.seed(" ".join(["all"] * 12), "")
        cache.start_session()
        cache.set(cache.APP_COMMON_SEED, seed)

        namespaces = [[44 | HARDENED]]
        keychain = await_result(
            get_keychain(wire.DUMMY_CONTEXT, "secp256k1", namespaces))

        # valid path:
        self.assertIsNotNone(keychain.derive([44 | HARDENED, 1 | HARDENED]))

        # invalid path:
        with self.assertRaises(wire.DataError):
            keychain.derive([44])
Ejemplo n.º 3
0
 def from_address_n(self, address_n):
     schemas = _schemas_from_address_n(PATTERNS_ADDRESS, address_n)
     return await_result(get_keychain(wire.DUMMY_CONTEXT, CURVE, schemas))