Skip to content
ThePotatoGuy edited this page Sep 24, 2022 · 2 revisions

API Keys

Key Mechanics

Keys are defined by a "feature name", that must be unique. Keys are loaded in init level -980. API Keys are NOT stored in persistent.. They are loaded from a separate JSON file called api_keys.json inside the same folder persistents are stored in. To access and use API keys, see the API below.

API

top

mas_getAPIKey

Gets API key for a specific feature.

Params:

  • feature - string name of the feature to get the API key for

RETURNS the API key as string if found, null string if not found

top

mas_hasAPIKey

Checks if a feature has an API key.

Params:

  • feature - string name of the feature to check API key for

RETURNS true if the feature has an API key, false otherwise

top

mas_registerAPIKey

  • feature - string name of the feature to register API key for
  • display_name - name the feature should use when shown in the API Keys screen
  • on_change - function to run when the API key is changed (includes both adding a key and removing a key)
    • Default: None