def pack(self, password): new_data = json.dumps(self.to_dict()) new_data_compressed = zlib.compress(new_data.encode()) return better_aes_encrypt(password, new_data_compressed)
def test_better_encrypt_decrypt(self): self.assertEqual( b'valuable value', better_aes_decrypt( 'super secret', better_aes_encrypt('super secret', b'valuable value')))
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)
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'))