  Self-testing is a method to certify devices from the result of a Bell test.
Although examples of noise tolerant self-testing are known, it is not clear how
to deal efficiently with a finite number of experimental trials to certify the
average quality of a device without assuming that it behaves identically at
each run. As a result, existing self-testing results with finite statistics
have been limited to guarantee the proper working of a device in just one of
all experimental trials, thereby limiting their practical applicability. We
here derive a method to certify through self-testing that a device produces
states on average close to a Bell state without assumption on the actual state
at each run. Thus the method is free of the I.I.D. (independent and identically
distributed) assumption. Applying this new analysis on the data from a recent
loophole-free Bell experiment, we demonstrate the successful distribution of
Bell states over 398 meters with an average fidelity of $\geq$55.50% at a
confidence level of 99%. Being based on a Bell test free of detection and
locality loopholes, our certification is evidently device-independent, that is,
it does not rely on trust in the devices or knowledge of how the devices work.
This guarantees that our link can be integrated in a quantum network for
performing long-distance quantum communications with security guarantees that
are independent of the details of the actual implementation.
