Is there a way to extract an installed Testflight application and compact it into a .ipa file?

Wondering if you could even do this. The Tesflight invitation for a certain app is full and I am trying to get the ipa so someone else can sideload the app with Altstore. If this has legal implications or anything that'd be nice to know or if it is impossible.