[identity] move device_info creation to helper function
Summary:
small refactor to dedup
Depends on D7540
Test Plan: confirmed that the login and register RPCs worked the same as before
Reviewers: jon, bartek
Reviewed By: bartek
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D7541