You can determine whether space is flat or curved measuring the angular size of the first peak. The impact of the curvature of space in the relation between actual size and measured angular size of the first peak is given through the definition of the
angular diameter distance d_A.
In general, one has that the actual size l relates to the angular size \theta:
d_A = l / \theta
This means that the angular diameter distance and therefore the curvature and the Hubble parameter d_A = f(\Omega_{k, 0}, H_0), can be expressed as a relation between the measured angular size and the actual size.
The actual size of the first peak corresponds to the size of the horizon during recombination. This depends on the recombination redshift and on the curvature of space at recombination redshift.
The recombination redshift depends on the recombination temperature that in turn depends on the ionization energy of hydrogen and the photon to baryon ratio.
The curvature at recombination redshift can be assumed to be zero (flat space) because for the first peak to exist (or to be interpreted as such) the universe must have underwent an inflationary phase. This implies that the universe was very near to flatness after inflation. After inflation it deviates from flatness either to positive curvature or negative curvature, but for a high redshift such as the recombination epoch space was still nearly flat.
However, I guess you can make the calculations also without relying on this assumption.