Sharing Files and Photos into an App

I had a couple of questions someone could help me with, as I’m trying to do a little research for my team before they do a bunch of coding.

We’re building an anywhere-to-anywhere encrypted file transfer app and wrestling currently with our share functionality. Currently, our users

  1. log into their app on their phone, and:
  2. within the application use a file picker to select files/photos and
  3. then select a destination that they pick from a permission-ed list.

However, we really would like to also add the workflow where the user

  1. opens the photos or files app,
  2. finds a picture/file and then uses the share functionality to pass the object into the application, then
  3. The application launches, allowing the user to log into the app, then
  4. they pick from a list of permission-ed drop targets within the app and send the object

In doing some research this morning regarding sharing files/pictures within our application, I found this thread Eskimo had more or less advised against what we intended to do:

https://developer.apple.com/forums/thread/114485

We don’t want to save session tokens because of security concerns; we’re concerned primarily with third-party actors (governments primarily) having access to encryption keys.

Is there a best-practice way for my team to open the app we're building and then passing the files/photos into our application? Does anyone have any advice on how to securely launch the application and pass the file/pic into the app given the constraints? Thanks!

We don’t want to save session tokens because of security concerns

Putting a token into a this-device-only item in a shared app group within the keychain is pretty darned secure. The only way an attacker could access such an item is if they’ve compromised the device as a whole, at which point they could almost certainly compromise your app’s security in other ways.

However, lemme answer assuming that requirement…

There isn’t a way to launch your container app from your share extension. I think it’s safe to assume that this isn’t an accident. iOS works hard to protect the user from unexpected layer switches [1].

The only option I see is to put the content into a file in the shared app group container and post a notification telling the user that they have to run your app to complete the workflow. If the user taps on the notification, your app comes to the front and you can proceed with the workflow.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Notably, we’re starting to roll out limits like this on macOS as well. See this thread.

Sharing Files and Photos into an App
 
 
Q