def test_import_identity(self):
     wm = WalletManager()
     wm.open_wallet("./test.json")
     salt = get_random_bytes(16)
     privete_key = '75de8489fcb2dcaf2ef3cd607feffde18789de7da129b5e97c81e001793cb7cf'
     acct = Account(a2b_hex(privete_key.encode()))
     enpri = acct.export_gcm_encrypted_private_key("1", salt, 16384)
     wm.import_identity("label2", enpri, "1", salt,
                        acct.get_address_base58())
Exemplo n.º 2
0
 def test_import_identity(self):
     wm = WalletManager()
     path = os.path.join(os.getcwd(), 'test.json')
     wm.open_wallet(path)
     salt = util.get_random_str(16)
     private_key = '75de8489fcb2dcaf2ef3cd607feffde18789de7da129b5e97c81e001793cb7cf'
     acct = Account(private_key)
     enpri = acct.export_gcm_encrypted_private_key("1", salt, 16384)
     wm.import_identity("label2", enpri, "1", salt,
                        acct.get_address_base58())
     os.remove(path)
 def test_import_identity(self):
     wm = WalletManager()
     path = os.path.join(os.getcwd(), 'test.json')
     wm.open_wallet(path)
     private_key = util.get_random_str(64)
     acct = Account(private_key)
     password = util.get_random_str(10)
     salt = util.get_random_str(16)
     scrypt_n = 16384
     encrypted_private_key = acct.export_gcm_encrypted_private_key(
         password, salt, scrypt_n)
     label = 'label'
     b58_address = acct.get_address_base58()
     wm.import_identity(label, encrypted_private_key, password, salt,
                        b58_address)
     identity = wm.get_default_identity()
     self.assertEqual(label, identity.label)
     wm.write_wallet()
     os.remove(path)
 def test_import_identity(self):
     wm = WalletManager()
     wm.create_wallet_file(path)
     wm.open_wallet(path)
     try:
         private_key = utils.get_random_hex_str(64)
         acct = Account(private_key)
         salt = utils.get_random_hex_str(16)
         scrypt_n = 16384
         encrypted_private_key = acct.export_gcm_encrypted_private_key(
             password, salt, scrypt_n)
         label = 'label'
         b58_address = acct.get_address_base58()
         wm.import_identity(label, encrypted_private_key, password, salt,
                            b58_address)
         identity = wm.get_default_identity()
         self.assertEqual(label, identity.label)
     finally:
         wm.del_wallet_file()