GrapheneOS has been working on a duress feature which will allow you to designate another password/pin which once entered in the lockscreen will immediately wipe the device irreversibly.
It has been in development for a long time and is close to being complete. GrapheneOS had to take a custom approach to how the wiping occurs since the standard device admin API was bypassable and an attacker with physical access to the device as the wipe was occurring could cancel it. That concern is being addressed upstream, though, thanks to GrapheneOS' vulnerability reports. You can read more about that here:
#11721