How a safe lock works