flip_api.scripts.generate_trust_api_keys
Generate per-trust API keys and write them into an environment file.
Trust names are read from the TRUST_NAMES env var (a JSON list). Both
plaintext keys (TRUST_API_KEYS) and their hashes (TRUST_API_KEY_HASHES)
are written as JSON dicts into the environment file.
- Usage:
make generate-trust-api-keys make generate-trust-api-keys ENV_FILE=.env.stag
Attributes
Functions
|
Extract trust names from the TRUST_NAMES env var line. |
|
Generate per-trust API keys and write them into the specified environment file. |
Module Contents
- flip_api.scripts.generate_trust_api_keys.REPO_ROOT
- flip_api.scripts.generate_trust_api_keys._parse_trust_names(lines: list[str]) list[str][source]
Extract trust names from the TRUST_NAMES env var line.
- Parameters:
lines (list[str]) – Lines of the environment file.
- Returns:
List of trust names, e.g.
["Trust_1", "Trust_2"].- Return type:
list[str]
- flip_api.scripts.generate_trust_api_keys.main() None[source]
Generate per-trust API keys and write them into the specified environment file.
Reads trust names from
TRUST_NAMES, generates a cryptographically secure key for each trust that doesn’t already have a value in theTRUST_API_KEYSdict (or all if--force), and updates bothTRUST_API_KEYSandTRUST_API_KEY_HASHESJSON dicts in the env file.- Raises:
SystemExit – If the env file is missing or contains no
TRUST_NAMESentry.