def create_wallet(): private_key = bytes(Random.get_random_bytes(32)) keypair = KeyPair(priv_key=private_key) return { "private_key": keypair.Export(), "address": keypair.GetAddress() }
def test_should_export_valid_nep2_key_with_emoji_pwd(self): pwd = "hellö♥️" privkey = "03eb20a711f93c04459000c62cc235f9e9da82382206b812b07fd2f81779aa42" # expected outputs target_address = "AXQUduANGZF4e7wDazVAtyRLHwMounaUMA" target_encrypted_key = "6PYWdv8bP9vbfGsNnjzDawCoXCYpk4rnWG8xTZrvdzx6FjB6jv4H9MM586" kp = KeyPair(binascii.unhexlify(privkey)) nep2_key = kp.ExportNEP2(pwd) self.assertEqual(nep2_key, target_encrypted_key) self.assertEqual(kp.GetAddress(), target_address)
def test_should_return_valid_address(self): kp = KeyPair( binascii.unhexlify( "cbf4b9f70470856bb4f40f80b87edb90865997ffee6df315ab166d713af433a5" )) self.assertEqual(kp.GetAddress(), "AStZHy8E6StCqYQbzMqi4poH7YNDHQKxvt")