only public keys are available client side, so by definition it’s ok to use them in the plugin html because you are not supposed to put sensible data in the public key anyway.
For requests with private data you should use a server action, or the api connector, but both will not be available in the html header of the plugin. It will require your end user to setup a workflow in the editor.