  Quantum key distribution (QKD) protocols aim at allowing two parties to
generate a secret shared key. While many QKD protocols have been proven
unconditionally secure in theory, practical security analyses of experimental
QKD implementations typically do not take into account all possible loopholes,
and practical devices are still not fully characterized for obtaining tight and
realistic key rates. We present a simple method of computing secure key rates
for any practical implementation of discrete-variable QKD (which can also apply
to measurement-device-independent QKD), initially in the single-qubit lossless
regime, and we rigorously prove its unconditional security against any possible
attack. We hope our method becomes one of the standard tools used for
analysing, benchmarking, and standardizing all practical realizations of QKD.
