Easy and secure way to communicate between processes on macOS

How can I exchange information easily and securely between 2 apps on macOS? 1 of the app will infrequently request a short amount of data from the other one.

Here are the options that I can see:

  1. DistributedNotificationCenter : very easy to implement. However, the notifications are broadcast to any apps that wants to listen to it, and apple's documentation clearly states that it's not secure. I would ideally like a mechanism that is as simple as this, but with a secure communication between 2 aps

  2. Apple Events. I am not sure how to make an app respond to apple event. And I think it would be the same problem : any other app could talk to these 2 apps and get information from them. I ideally want this to be more secure.

  3. XPC, this seems overly complex for what I want to do, as my understanding is that this essentially involves creating a third process that will regulate communication.

  4. Implementing IPC via sockets. It seems reasonable I think, as I can probably secure the communication better. However it feels over-enigneered to set up sockets that always listen for incoming connections, etc

Am I missing a simple mechanism on macOS that could help me in that use case? Or am I looking at things incorrectly for one of these options?

Thanks!

Easy and secure way to communicate between processes on macOS
 
 
Q