DISCLAIMER: I work on the SIG Connect app.

SIG Connect does exactly that: https://www.sigsauer.com/sigconnect

I suspect, since this is HN, you're looking for something more open and hackable. But you might want to check out SIG Connect if you just want something that works out of the box.

Sorry I can't get into "how it works". Feel free to DM me for any questions.