lock generator functions based on a key