In my React Native (Expo) app, how can I cache downloaded audio files securely?

46 Views Asked by At

I want to enable my app user to be able to download audio files so that they can play them later when not connected to the internet. Access to the audio files should only be possible for those that have a valid subscription in my app.

I recognise that there is no 'perfect' security, but I want to make it reasonably difficult for people to bypass my app and access the audio files my app has downloaded directly (eg using file utilities).

My question as two parts:

  1. What tools or extensions can I use to encrypt or obfuscate files downloaded to the app's local filesystem?
  2. How can I play such files in my app - must I first prepare an unencrypted file and feed that to the audio player, or is there an audio player that can decrypt 'on the fly'?

I have investigated expo-secure-store and crypto-es, but they seem designed for key-value pairs rather than files.

The audio player I am currently using is the one included in expo-av.

Note that I'm relatively new to React Native and Expo, so there might be something straightforward I'm missing.

0

There are 0 best solutions below