Door locks, usually, are two types - Rim and Mortise. While the former attaches to the surface of the door, the latter is fitted into a cavity made in the doorframe. These locks feature a latch that works on a spring and automatically bolts the door when shut. Externally, the latch is operated by a knob or handle.
The locking bolt may or may not have a key. Keyless locking bolts are usually used for rooms within the home – such as the bath, toilet, or bedroom – and are secured by a stopper on the inside.