This diff merges types and moves retrieving keys to a different step.
This change is not backward compatible but this Flow hasn't been launched yet so we not breaking anything.
NOTE: It's not that easy to slice this into diffs, so it's possible that in the middle of the stack protocol is not working, it needs to be reviewed as a whole.
Depends on D13964