Exploring Our Newest Feature — OPUS Offline Mode
In addition to my responsibility of the main iOS app development at OPUS, I am also responsible for our brand new offline mode research and development of the server-side and iOS implementation.
— Krzysztof Mosakowski
In this article, we will discuss the idea behind our new offline mode and its benefits that create a better experience for both OPUS users and artists. In addition, security issues will be covered as well, which are necessary for this function to work to its full potential.
What is ‘offline mode’ all about?
The aim of offline mode is to achieve full playback of tracks that individual users have chosen to download while still online without the need for internet access. Bearing in mind that performance and security is crucial to us, we conducted thorough research and worked on the best possible solution to achieve the goal of a seamless experience without any threats to security.
How do you use ‘offline mode’?
The download for offline use option is located in the popup menu of a given track, next to the star icon that adds a song to a user’s library. The menu button is a 3 dot icon that can be found on the right-hand side of each song list item, listed everywhere on the app.
Offline mode availability depends on your OPUS subscription status. If it turns out that your subscription has expired, you will receive a popup message with information about this expiration and the option to purchase an extension.
What are the benefits of ‘offline mode’?
We can divide benefits of offline mode into two groups: user specific benefits and artist specific benefits.
User specific benefits:
- Offline playback — offline mode provides the possibility to download songs for later playback when internet access is not available.
- Faster buffering — there is a performance boost as well, because the buffering is done directly from smartphone’s local memory instead of calling the server for data chunks
Artist specific benefits:
- Better encryption — the data that is downloaded and saved into local memory is encrypted using more efficient cryptographic algorithms which prevent unauthorized access and theft of the songs.
Sounds cool, but what about security?
The data of a song is stored in encrypted form on IPFS, a decentralized file hosting network. When a user requests to save a song for offline use, the server does the re-encryption of the data using a user-specific unique key, the data is then passed to the user’s smartphone and saved in local memory. When using this approach of security, the data is prepared exclusively for this particular user’s decryption and playback process.
Here are some algorithms that are useful for data security.
RSA (Rivest-Shamir-Adleman) — an asymmetric cryptographic algorithm which uses a pair of keys: a public key for encryption and a private key for decryption of data. Regarding its relatively slow speed, it is used for smaller chunks of data, for example keys.
AES (Advanced Encryption Standard) — in particular, CBC (Cipher Block Chaining) mode — a symmetric cryptographic algorithm, which requires a key and initialization vector (IV). This algorithm allows to decrypt smaller chunks of data instead of entire data buffers. Because of its higher speed comparing to RSA, it is used for bigger chunks of data.
Conclusion
We are certainly developing a desirable feature that a lot of users will use. There are many other good ways to secure data, but considering our goal to get the best performance and security, we had to implement the solutions that best meet our criteria.