add function to restrict qr code generation unless a key is supplied