コード例 #1
0
 def create_account_from_wif(self,
                             wif: str,
                             password: str,
                             label: str = '') -> Account:
     private_key = Account.get_private_key_from_wif(wif).hex()
     salt = get_random_hex_str(16)
     if len(label) == 0 or label is None:
         label = uuid.uuid4().hex[0:8]
     info = self.create_account_info(label, password, salt, private_key)
     return self.get_account_by_b58_address(info.address_base58, password)
コード例 #2
0
 def test_get_private_key_from_wif(self):
     private_key = '523c5fcf74823831756f0bcb3634234f10b3beb1c05595058534577752ad2d9f'
     wif = 'KyyZpJYXRfW8CXxH2B6FRq5AJsyTH7PjPACgBht4xRjstz4mxkeJ'
     self.assertEqual(private_key, Account.get_private_key_from_wif(wif).hex())
コード例 #3
0
 def test_get_private_key_from_wif(self):
     hex_private_key = utils.get_random_bytes(32).hex()
     acct = Account(hex_private_key)
     wif = acct.export_wif()
     import_key = Account.get_private_key_from_wif(wif)
     self.assertEqual(hex_private_key, import_key.hex())