Securing a switch/light with pincode

There are some entities which I’d like to try secure behind a pin code, like not being able to open my main gate without a pin code. My alarm also doesn’t integrate with HA, but I do have physical inputs on my alarm which I’m planning on triggering by using a Sonoff SV - I wouldn’t want my alarm to be disabled by just tapping the widget.

I would imagine a good implementation would be to set a pin somewhere in the general settings of the app, and then on the individual widget having a toggle which indicates that a pin must be used.

For me a good interface would be that when I hit a specific widget - a pin pad comes up, I put in my pin and hit ok, and the device is switched on/off.