import os, json
from decrypt_api import *

if __name__ == "__main__":
    appdata_path = os.getenv('APPDATA')

    with open(f"{appdata_path}\Signal\Local State", "r", encoding="utf-8") as f:
        local_state = json.load(f)

    with open(f"{appdata_path}\Signal\config.json", "r", encoding="utf-8") as f:
        config = json.load(f)

    os_key_b64 = local_state["os_crypt"]["encrypted_key"]
    config_key_hex = config["encryptedKey"]

    decrypt_and_print_cipher_key(os_key_b64, config_key_hex)