[lib] extract code responsible for confirming P2P message to a hook
Summary:
Part of ENG-9456.
I need to reuse this code in next diff.
Test Plan: Tested in next diff
Reviewers: tomek
Reviewed By: tomek
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D13662