Need help to add custom validation in Luci UCI form option

I am developing a Luci app for keepalived and I need a small help in that to add custom validation when the form is saved.

When o.validate is executed for the respective UCI option, I want to trigger a command and based on its response display an error. With simple javascript validation, It works fine but I am not a pro in JavaScript/Luci and am unsure what would be the better approach to add validation with command/rpc execution.

o.validate expects, a true, false, or string to display an error, But when I add the command it returns Promise.

In form, It takes user input of SSH private and public keys, I am aware of how to validate it in the command line but can not figure out a way how to handle that in Luci.

Here is the link to the code block and PR for the same.