def test_zil_mykey(self): key = crypto.ZilKey.load_mykey_txt(path_join("mykey.txt")) assert key.address == "967e40168af66f441b73c0146e26069bfc3accc7" with pytest.raises(AssertionError): crypto.ZilKey( "02A349FA10F0E6A614A38D6033588A422357F2C60AF2EEBAE15D06498DF8AF0B05", "75889EA1AF5D402B69E61C654C74D8B569E363D2E271E1E6E2B63FDB9B635173" ) new_key = crypto.ZilKey( "02A349FA10F0E6A614A38D6033588A422357F2C60AF2EEBAE15D06498DF8AF0B05", "75889EA1AF5D402B69E61C654C74D8B569E363D2E271E1E6E2B63FDB9B635174") assert key == new_key assert key != crypto.ZilKey.generate_new() pub_key = "0x03949D29723DA4B2628224D3EC8E74C518ACA98C6630B00527F86B8349E982CB57" private_key = "05C3CF3387F31202CD0798B7AA882327A1BD365331F90954A58C18F61BD08FFC" wallet_address = "95B27EC211F86748DD985E1424B4058E94AA5814" new_key = crypto.ZilKey(public_key=pub_key) assert new_key.address == wallet_address.lower() new_key = crypto.ZilKey(private_key=private_key) assert utils.hex_str_to_int( new_key.keypair_str.public) == utils.hex_str_to_int(pub_key) assert new_key.address == wallet_address.lower()
def test_keypairs(self): keypairs = load_ts_fixtures(path_join("keypairs.fixtures.ts")) for pair in keypairs: key_from_private = crypto.ZilKey(private_key=pair["private"]) key_from_public = crypto.ZilKey(public_key=pair["public"]) assert key_from_private.encoded_public_key == key_from_public.encoded_public_key
def test_address(self): addresses = load_ts_fixtures(path_join("address.fixtures.ts")) for addr in addresses: from_file = addr["address"].lower() from_private = crypto.ZilKey(private_key=addr["private"]).address assert from_private == from_file from_public = crypto.ZilKey(public_key=addr["public"]).address assert from_public == from_file