Island: Remove disused StringEncryptor

This commit is contained in:
Mike Salvatore 2022-07-14 07:58:14 -04:00
parent 86ce7f2cf9
commit 9639acffa5
4 changed files with 0 additions and 31 deletions

View File

@ -15,4 +15,3 @@ from .data_store_encryptor import (
reset_datastore_encryptor, reset_datastore_encryptor,
) )
from .field_encryptors.i_field_encryptor import IFieldEncryptor from .field_encryptors.i_field_encryptor import IFieldEncryptor
from .field_encryptors.string_encryptor import StringEncryptor

View File

@ -1,2 +1 @@
from .i_field_encryptor import IFieldEncryptor from .i_field_encryptor import IFieldEncryptor
from .string_encryptor import StringEncryptor

View File

@ -1,12 +0,0 @@
from ..data_store_encryptor import get_datastore_encryptor
from . import IFieldEncryptor
class StringEncryptor(IFieldEncryptor):
@staticmethod
def encrypt(value: str):
return get_datastore_encryptor().encrypt(value.encode())
@staticmethod
def decrypt(value: str):
return get_datastore_encryptor().decrypt(value).decode()

View File

@ -1,17 +0,0 @@
from monkey_island.cc.server_utils.encryption import StringEncryptor
MOCK_STRING = "m0nk3y"
EMPTY_STRING = ""
def test_encryptor(uses_encryptor):
encrypted_string = StringEncryptor.encrypt(MOCK_STRING)
assert not encrypted_string == MOCK_STRING
decrypted_string = StringEncryptor.decrypt(encrypted_string)
assert decrypted_string == MOCK_STRING
def test_empty_string(uses_encryptor):
# Tests that no erros are raised
encrypted_string = StringEncryptor.encrypt(EMPTY_STRING)
StringEncryptor.decrypt(encrypted_string)