Ejemplo n.º 1
0
 def test_better_encrypt_decrypt(self):
     self.assertEqual(
         b'valuable value',
         better_aes_decrypt(
             'super secret',
             better_aes_encrypt('super secret', b'valuable value')))
Ejemplo n.º 2
0
 def test_better_decrypt_error(self, _):
     with self.assertRaises(InvalidPasswordError):
         better_aes_decrypt(
             'super secret but wrong',
             better_aes_encrypt('super secret', b'valuable value')
         )
Ejemplo n.º 3
0
 def pack(self, password):
     assert not self.is_locked, "Cannot pack a wallet with locked/encrypted accounts."
     new_data = json.dumps(self.to_dict())
     new_data_compressed = zlib.compress(new_data.encode())
     return better_aes_encrypt(password, new_data_compressed)