diff --git a/code/decode.py b/code/decode.py index 692c525..05b113d 100644 --- a/code/decode.py +++ b/code/decode.py @@ -31,7 +31,17 @@ class Message: def get_decryption_key(path): with open(path) as fh: config = json.load(fh) - return config['key'] + key = None + if 'key' in config and 'encryptedKey' in config: + raise Exception('config has both key and encryptedKey in it') + if 'key' in config: + key = 'key' + elif 'encryptedKey' in config: + key = 'encryptedKey' + else: + dict_keys = ', '.join(str(x) for x in config.keys()) + raise Exception(f'no key found for db in config.json, only saw: {dict_keys}') + return config[key] def query_signal_db(db, key, query):