more cleanup

This commit is contained in:
Jonathan Wren 2022-10-01 10:17:55 -07:00
parent 62b733729e
commit 3624bde2c0

View file

@ -12,16 +12,14 @@ class EncryptionMethods(str, Enum):
JRNLV2 = "Jrnlv2Encryption" JRNLV2 = "Jrnlv2Encryption"
ENCRYPTION_METHODS = { def determine_encryption_method(config: str | bool) -> BaseEncryption:
# config: classname (as string) ENCRYPTION_METHODS = {
True: EncryptionMethods.JRNLV2, # the default True: EncryptionMethods.JRNLV2, # the default
False: EncryptionMethods.NONE, False: EncryptionMethods.NONE,
"jrnlv1": EncryptionMethods.JRNLV1, "jrnlv1": EncryptionMethods.JRNLV1,
"jrnlv2": EncryptionMethods.JRNLV2, "jrnlv2": EncryptionMethods.JRNLV2,
} }
def determine_encryption_method(config: str | bool) -> BaseEncryption:
key = config key = config
if isinstance(config, str): if isinstance(config, str):
key = config.lower() key = config.lower()