A sliding lock
This is a sliding lock, designed by Bogul. I've made it easy to print it by including the 3MF project file where everything is in-situ.... This saves the need for most of the support material and saves you from having to glue the pin into the bolt-bar because they're now printed already merged together.
3d model print parameters
You can print the entire thing at once with an Ultimaker 3 or S5 or another printer capable of printing soluble supports by loading the .3MF project f...ile in Cura.
Important: It's really tidy how it slides (tight tolerances), but you might want to print the bolt a bit smaller because that will allow you to use it without spending days soaking out the PVA. The tight gaps make it really hard for the PVA to dissolve.