how does hkdf generate 2 keys?
The extract and expand steps of HKDF are just two phases of one algorithm run. The PRK created my the extract step is not meant to be used as a key (even though it would not be a problem securitywise).

So if you need to derive two keys from one IKM value, you run the whole algorithm (that is: extract &amp; expand) once with an appropriate info string (like "key1", for instance) and then you run the whole thing a second time with the same salt and IKM but a different info string (like "key2").