toxencryptsave finished

This commit is contained in:
ingvar1995 2016-05-15 16:45:05 +03:00
parent a78f18cce5
commit 284311a91c
1 changed files with 9 additions and 2 deletions

View File

@ -38,12 +38,19 @@ class LibToxEncryptSave(util.Singleton):
libtoxencryptsave = libtox.LibToxEncryptSave() libtoxencryptsave = libtox.LibToxEncryptSave()
def __init__(self, passphrase=''): def __init__(self):
self._passphrase = passphrase self._passphrase = None
def set_password(self, passphrase): def set_password(self, passphrase):
self._passphrase = 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): def pass_encrypt(self, data):
""" """
Encrypts the given data with the given passphrase. Encrypts the given data with the given passphrase.