How to pass parameters to extensions

Is it possible to pass parameters to extensions at runtime?

My usecase is a little bit unusual :wink:
I’m creating a browser extension for OWASP ZAP, which as some of you will know is a security tool :smiley:
ZAP allows users to launch browsers like Firefox and Chrome using Selenium - this allows ZAP to configure the browser to proxy through ZAP and to ignore certificate errors.
The browser extention I’m creating needs to talk to ZAP via it’s API - I’ll need to pass in the API endpoint and an API key. I was hoping that I could set these in the Firefox prefs (which I can do) and then read these in the extension, which I dont appear to be able to do.
Is there a way to make this work, or other suggestions as to how I can get parameters into my extension at runtime?

Hope everyone in the add-ons team is doing well. Your ex-security guy is back as an add-on author :grin:

The best fit for you might be https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/managed where you can just place a JSON file somewhere with the values and read from them.

The option with more freedom is https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging

Thanks @freaktechnik I’ll look into those.