from typing import Dict
import json


def load_api_keys(keyfile: str) -> Dict[str, str]:
    """
    Loads API keys from a JSON-serialized key file
    :param keyfile: Path to the JSON file to deserialize
    :return: Dictionary containing API keys
    """
    with open(keyfile, "r") as f:
        keys = json.load(f)

    for key in ["bot_id", "airtable_api_key", "airtable_api_url"]:
        if key not in keys or not keys.get(key):
            raise KeyError(f"\"{key}\" not in key file {keyfile}")

    return keys