The postselection technique is an important proof technique for proving the security of quantum key distribution protocols against coherent attacks via the uplift of any security proof against independent identically distributed collective attacks. In this work, we go through multiple steps to rigorously apply the postselection technique to optical quantum key distribution protocols. First, we place the postselection technique on a rigorous mathematical foundation by fixing a technical flaw in the original postselection paper. Second, we extend the applicability of the postselection technique to prepare-and-measure protocols by using a de Finetti reduction with a fixed marginal. Third, we show how the postselection technique can be used for decoy-state protocols by tagging the source. Finally, we extend the applicability of the postselection technique to realistic optical setups by developing a new variant of the flag-state squasher. We also improve existing de Finetti reductions, which reduce the effect of using the postselection technique on the key rate. These improvements can be more generally applied to other quantum information processing tasks. As an example to demonstrate the applicability of our work, we apply our results to the time-bin-encoded three-state protocol. We observe that the postselection technique performs better than all other known proof techniques against coherent attacks. Published by the American Physical Society 2024