The app will create a root structured data with a random ID. All structured data items need to have an ID that is 32 bytes long. Therefore, the app generates a 32 bytes long random ID using this function:
app_utils.js
The root structured data will be used to store your email data (your email ID and your saved emails). This data can be represented using a simple JSON format:
Get a cipher options handle
First, the app fetches a cipher options handle for symmetric encryption.
Your root structured data is encrypted using symmetric encryption. This means that no one else can read its content. Only you can decrypt it. Also, since we don't need versioning (we only want to show the latest data), we create an unversioned structured data (type tag 500).
After your root structured data is successfully created, the app stores its ID in a config file. That way, the app will be able to retrieve your email data in the future.
This config file is stored in the app's root directory, which is private. Therefore, it will automatically be encrypted and no one else will be able to read it.