  In theory, quantum key distribution (QKD) allows secure communications
between two parties based on physical laws. However, most of the security
proofs of QKD today make unrealistic assumptions and neglect many relevant
device imperfections. As a result, they cannot guarantee the security of the
practical implementations. Recently, the loss-tolerant protocol (K. Tamaki et
al, Phys. Rev. A, 90, 052314, 2014) was proposed to make QKD robust against
state preparation flaws. This protocol relies on the emission of qubit systems
which, unfortunately, is difficult to achieve in practice. In this work, we
remove such qubit assumption and generalise the loss-tolerant protocol to
accommodate multiple optical modes in the emitted signals. These multiple
optical modes could arise, for example, from Trojan horse attacks and/or device
imperfections. Our security proof determines some dominant device parameter
regimes needed for achieving secure communication, and therefore it can serve
as a guideline to characterise QKD transmitters. Furthermore, we compare our
approach with that of Lo and Preskill (H.-K. Lo et al, Quantum Inf. Comput., 7,
431-458, 2007) and identify which method provides the highest secret key
generation rate as a function of the device imperfections. Our work constitutes
an important step towards the best practical and secure implementation for QKD.
