From 284311a91c4287a023a1e5ecfbdfff0bc42208f6 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 15 May 2016 16:45:05 +0300 Subject: [PATCH] toxencryptsave finished --- src/toxencryptsave.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/toxencryptsave.py b/src/toxencryptsave.py index e7ee8f8..c46b4d8 100644 --- a/src/toxencryptsave.py +++ b/src/toxencryptsave.py @@ -38,12 +38,19 @@ class LibToxEncryptSave(util.Singleton): libtoxencryptsave = libtox.LibToxEncryptSave() - def __init__(self, passphrase=''): - self._passphrase = passphrase + def __init__(self): + self._passphrase = None def set_password(self, passphrase): self._passphrase = passphrase + def has_password(self): + return bool(self._passphrase) + + def is_data_encrypted(self, data): + result = self.libtoxencryptsave.tox_is_data_encrypted(c_char_p(data)) + return bool(result) + def pass_encrypt(self, data): """ Encrypts the given data with the given passphrase.