What is the type in schema.lua for a file upload

I am writing a custom plugin for my requirement. I have a configuration that takes two parameters that is a private and public keys as files. What type I should specify in schema.lua. I found that /certificates is doing similar operation but it’s taking them as strings but I need to accept them as files. Can anyone please suggest a way to do this.


1 Like

“Files” are not supported as a type in the configuration of a plugin, only strings.

May I ask what is the exact content of those “private and public keys files”, and how will they be used? Please include whether their contents will change over time in that description.

Thank you for the response. My private and public keys are RSA key pairs generated by openssl. Here there contents
Private key

Public key
-----END PUBLIC KEY-----

Frequency of their change
The keys will not change over time. I am planning to apply this plugin for all APIs and has to add a JWT token signed by the private key configured for plugin.


I’m afraid you misunderstood me and that has caused a possible big problem. I didn’t want to see the content of the files, just that you described their use to me.

The problem I’m referring to is that putting your private key on the forum, which is a public place, you have rendered that key insecure - the private key is supposed to be private, and you should never share it with anyone.

If you are using them on any servers, those servers are at risk of being hacked right now. Your first priority should be replacing the old private key for a new one (and not share it with anyone this time). The keys that you posted should never be used again anywhere.

I have edited the keys out in your post [EDIT: we decided to just delete your whole answer just in case] so they are not immediately visible, but someone determined enough will still be able to find them. Please take this seriously and remove them (and don’t share private keys in the future).

Once you have done this, back to your question:

Private and public keys don’t need to be in files in order to work. Strings are perfectly fine for that purpose. You can use strings on the schema.lua file for the private and public keys there. That would be my recommendation.

Also, a note: It’s also quite rare that you need both keys in the plugin. These kinds of keys rarely “go together in the same place”; that’s the the reason why they come in pairs. One (the private key) exists in a single location (usually, a server) while the other one (the public key) can be shared. It’s quite possible that you only need to add the public key to your config. But that would depend on what you want to do with the keys.

Thanks for your concern, I apologize for that. The keys are newly created and posted here, I never used them for any purpose. I’ll remove them.

Thank you