[client-backup] extract logic for getting primary identity public key
Summary:
This code is duplicated and will be duplicated, so wrapping this in one function.
Depends on D9001
Test Plan: Verify function result is correct (SIWE login)
Reviewers: michal, marcin, bartek
Reviewed By: marcin
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D9074