toxencryptsave finished

This commit is contained in:
ingvar1995 2016-05-15 16:45:05 +03:00
parent a78f18cce5
commit 284311a91c

View file

@ -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.