FREE TRIAL: Accelerate your app development career with Hacking with Swift+! >>

App Groups vs Keychain Access Groups

Forums > macOS

Here's a scenario I'm thinking about. Let's say there's a system that's generating log events; not a bajillion of them, let's say it's on the order of a dozen per hour. So we don't want some kind of enterprise cloud scale log processing system.

I want one process to be run via launchd that will go fetch log events that are new since some marker, and a separate application that will display the log events to the human user. In order to fetch the log events, the log system wants the requester to be authorized. So there's an OAUTH path that happens in the second application (the one that does the display to a human) and that path results in an access token from the server. Both of these applications are going to want to have that access token, so it should sit in a shared location.

So far, this seems like it's probably a Keychain item, although it could be a String that's stored in a UserDefaults instance for an App Group -- since either way, it's only accessible to the user who did the authenticating and to the applications that are using it.

Next, though, there's the question of the log events that have been pulled down from the remote system and saved locally so that the GUI app can display them without generating additional load on the remote system. Where should those get written? Let's say they're Codable JSON and each one is pretty small, so conceivably they could fit in a MySQL table. MySQL seems like it's probably overkill, though; probably some kind of file based storage. Should it be in ~/Library/Application Support/niftyLogParser or should it be somewhere else?

Thoughts, anyone?

   

Hacking with Swift is sponsored by Sentry

SPONSORED With Sentry’s error and performance monitoring for iOS you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.

Get started

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.